launch every robot and every entrypoint - #296
Conversation
|
ros2 launch {self.launch_file} x:=… entity:={entity} {extra_config} ros2 internally handles this and dont raise any errors. |
| Boolean, | ||
| 5000, | ||
| ) | ||
| if robot_entities is not None: |
| used.add(new_name) | ||
|
|
||
| @staticmethod | ||
| def wait(robot_launchers): |
| entity: str = "" | ||
| start_pose: Optional[list] = [] | ||
|
|
||
| @staticmethod |
| module: str | ||
| launch_file: str | ||
| threads: List[Any] = [] | ||
| entity: str = "" |
There was a problem hiding this comment.
Entity does not need to be stored
|
|
||
| logging.getLogger("roslaunch").setLevel(logging.CRITICAL) | ||
|
|
||
| self.entity = entity |
| ) | ||
|
|
||
| def reset(self, robot_entity=None): | ||
| def reset(self, robot_entities=None): |
There was a problem hiding this comment.
If you change this to accept an array, then the default must be an array
| launcher.unpause() | ||
|
|
||
| def reset(self, robot_entity=None): | ||
| def reset(self, robot_entities=None): |
There was a problem hiding this comment.
If you change this to accept an array, then the default must be an array
| self.robot_launchers = [] | ||
| self.robot_configs = robot_cfgs | ||
| for robot_cfg in robot_cfgs: | ||
| if robot_cfg["type"] is None: |
There was a problem hiding this comment.
This only happened before. Please, try to understand what I have already told you multiple times
There was a problem hiding this comment.
in ra views.py it was changed right to send [ ] instead of none.
it was done on 14 th july right and ram hasn't updated after that i got it what all created a whole confusion here.
There was a problem hiding this comment.
I told you multiple times after that day
There was a problem hiding this comment.
hm you told me first about this on 10th july till that dat views.py has no changes so i never get what you meant about this.
sorry this created a whole loop of confusion several times.
i think i got this know i will resolve this.
| if self.robot_launcher is not None: | ||
| self.robot_launcher.run( | ||
| for launcher, robot_cfg in zip(self.robot_launchers, self.robot_configs): | ||
| if launcher is None: |
There was a problem hiding this comment.
Same with this. I already modified this for you so the robots are a list and if one world does not have any robot then it is an empty list. I have told you multiple times
There was a problem hiding this comment.
okk got it i thought you handled that on the 15th july in your last commit.
i didnt understand it early what you meant.
i got this time.
| raise Exception("User code not found") | ||
|
|
||
| _, file_extension = os.path.splitext(entrypoint) | ||
| # The workspace is built once, as soon as any entrypoint needs it |
There was a problem hiding this comment.
Why change something not related to your PR
javizqh
left a comment
There was a problem hiding this comment.
Right now you are compiling the code the same amount of entrypoints there are. Please stop writing code without knowing
|
I will not review a single line of code more until you spend a couple of days understanding how the RAM works |
|
okk i am going through the entrypoints part but i guess rest of the changes are ok. |
|
No, I don't need to review the rest after viewing such error. First comprehend what you are doing, then change it |
hi i know due that confusion i have messed up. a combination of py+py or cpp+py like this [ from this we might trigger it building twice beacuse when you call build it will build all so this is unecessary to prevent this we can have a boolean flag now suppose it first run the mouse application process->mouse later it runs the cat so application_process->cat we lost the mouse so we cant control its lifecycle right ? so what i am planning and how states looks would be Now my question is ? so for drone cat mouse and other existing files there could be one cpp one py. so with which set of files i should go with ? |
|
i was coding this then saw your comment and stopped do let me know i am in right direction or not? |
this was because i just restored humble devel version for entrypoint and working on entrypoints. |
forgot to mention but linter has same duplicate problem |
|
also had a doubt about this entrypoint.endswith(".launch.py") so is this related to bt studio ? |
Let me get this straight. When running the application there are 2 steps:
You do not need to reinvent the wheel about what to compile storing variables or something else. You just need to modify step 2 |
No, this is functionality that Robotics Academy supports as can be seen in video https://youtu.be/0vTp6PnbPcU?si=1TZe0eyYc0ow7a4u |
|
Hi i am done with the entrypoints part. |
| raise Exception("User code not found") | ||
|
|
||
| _, file_extension = os.path.splitext(entrypoint) | ||
| _, file_extension = os.path.splitext(entrypoints[0]) |
There was a problem hiding this comment.
Absolutely not. Can you tell me what happens if the entrypoints are the following:
["a.py","b.cpp"]
Answer: it will not work, because you have only checked the first one
There was a problem hiding this comment.
according to me this one in image snippet is right but you denied with this i don't know why ?
even i tested with this approach i can share videos.
i didn't found any bug implementing this one
There was a problem hiding this comment.
Please, take a minute to think.
Let's imagine we have the next entrypoints: ["a.py","b.cpp","c.cpp"]
Now, with this snippet you are compiling "b.cpp" and "c.cpp", then it is wrong because you are compiling twice.
With your latest changes you are not compiling at all because "a.py" is the first one, which is also wrong
There was a problem hiding this comment.
yeah so that why i mentioned to keep a boolean flag earlier
There was a problem hiding this comment.
i will make it true on first build
There was a problem hiding this comment.
should i go with this? and do a final push
There was a problem hiding this comment.
Do whatever. I will only do a final review. If there are major flaws or problems, I will not lose more time because I cannot be reviewing your changes and not doing my other jobs
|
leaving linter one since you mentioned about that. i know its lintinig again and again the same py files but now i dont want to change that without discussion on it. |
|
The linter is completely independent from the entrypoints. It uses its own list of files. errors = self.linter.evaluate_source_code(to_lint)
failed_linter = False
for error in errors:
if error != "":
failed_linter = True
self.write_to_tool_terminal(error + "\n\n")
if failed_linter:
raise Exception(errors) |


Tested locally follow line runs on both python as well as c++
drone cat mouse tested as well for python.
both robots spawn in same world play pause reset functionality everything tested well.
also while testing the two entrypoints i found that an entrypoint inside a subdirectory could not import the libraries.
i added the root of the code to PYTHONPATH when starting them.