Skip to content

launch every robot and every entrypoint - #296

Open
anishk85 wants to merge 5 commits into
JdeRobot:humble-develfrom
anishk85:multi-robot-support
Open

launch every robot and every entrypoint#296
anishk85 wants to merge 5 commits into
JdeRobot:humble-develfrom
anishk85:multi-robot-support

Conversation

@anishk85

Copy link
Copy Markdown

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.

@anishk85

Copy link
Copy Markdown
Author

ros2 launch {self.launch_file} x:=… entity:={entity} {extra_config}
i am passing entity to every robot launch file
for example f1.launch.py doesn't have an argument but during testing it handled that i tested the robot spawned.

ros2 internally handles this and dont raise any errors.

@javizqh javizqh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only change the things related to your PR.

This is really annoying, I have told you multiple times to NOT modify anything else. It is not complicated to add a for loop, it is the only thing we require you to do

Boolean,
5000,
)
if robot_entities is not None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

used.add(new_name)

@staticmethod
def wait(robot_launchers):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method must not be static

entity: str = ""
start_pose: Optional[list] = []

@staticmethod

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move outside of the class

module: str
launch_file: str
threads: List[Any] = []
entity: str = ""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entity does not need to be stored


logging.getLogger("roslaunch").setLevel(logging.CRITICAL)

self.entity = entity

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely useless

)

def reset(self, robot_entity=None):
def reset(self, robot_entities=None):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only happened before. Please, try to understand what I have already told you multiple times

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I told you multiple times after that day

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change something not related to your PR

@javizqh javizqh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now you are compiling the code the same amount of entrypoints there are. Please stop writing code without knowing

@javizqh

javizqh commented Jul 28, 2026

Copy link
Copy Markdown
Member

I will not review a single line of code more until you spend a couple of days understanding how the RAM works

@anishk85

Copy link
Copy Markdown
Author

okk i am going through the entrypoints part but i guess rest of the changes are ok.

@javizqh

javizqh commented Jul 28, 2026

Copy link
Copy Markdown
Member

No, I don't need to review the rest after viewing such error. First comprehend what you are doing, then change it

@anishk85

Copy link
Copy Markdown
Author

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.
also before this comment i was looking into the entrypoint
so we will be receiving two or more entrypoints from the frontend
suppose we are getting this as an entrypoint the previous functionality and your comment of backward compatibility points to this earlier due to single functionality of the excersice entrypoint is limited to one only.
so here there could be multiple cases on to which this should work

a combination of py+py or cpp+py like this
so we need to loop over our entrypoints arrays and then extract extension from it(already being done)
if its .cpp file build() run_cpp() and continue this we need to do why continue to so that it can proceed with the further files
if extension is .py then run_python()

[
a.cpp,
b.py
] and more.

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 we need to store it
self.application_processes = []

so what i am planning and how states looks would be
compiled=false->cat.cpp->needs build?->yes->colcon build->compiled=true->run cat->store processes->next file->mouse.py->run python->store it->next file.

Now my question is ?
right now no excersice send two cpp files as per you i should be concerned with drone cat mouse only?
so sending two cpp there's an issue you know about this.

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 ?

@anishk85

Copy link
Copy Markdown
Author

i was coding this then saw your comment and stopped do let me know i am in right direction or not?

@anishk85

anishk85 commented Jul 28, 2026

Copy link
Copy Markdown
Author

Right now you are compiling the code the same amount of entrypoints there are. Please stop writing code without knowing

this was because i just restored humble devel version for entrypoint and working on entrypoints.

@anishk85

Copy link
Copy Markdown
Author

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. also before this comment i was looking into the entrypoint so we will be receiving two or more entrypoints from the frontend suppose we are getting this as an entrypoint the previous functionality and your comment of backward compatibility points to this earlier due to single functionality of the excersice entrypoint is limited to one only. so here there could be multiple cases on to which this should work

a combination of py+py or cpp+py like this so we need to loop over our entrypoints arrays and then extract extension from it(already being done) if its .cpp file build() run_cpp() and continue this we need to do why continue to so that it can proceed with the further files if extension is .py then run_python()

[ a.cpp, b.py ] and more.

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 we need to store it self.application_processes = []

so what i am planning and how states looks would be compiled=false->cat.cpp->needs build?->yes->colcon build->compiled=true->run cat->store processes->next file->mouse.py->run python->store it->next file.

Now my question is ? right now no excersice send two cpp files as per you i should be concerned with drone cat mouse only? so sending two cpp there's an issue you know about this.

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 ?

forgot to mention but linter has same duplicate problem

@anishk85

Copy link
Copy Markdown
Author

also had a doubt about this entrypoint.endswith(".launch.py")
cuurently as per my knowledge none of the excersice of robotics academy passes this as an entrypoint.

so is this related to bt studio ?

@javizqh

javizqh commented Jul 28, 2026

Copy link
Copy Markdown
Member

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. also before this comment i was looking into the entrypoint so we will be receiving two or more entrypoints from the frontend suppose we are getting this as an entrypoint the previous functionality and your comment of backward compatibility points to this earlier due to single functionality of the excersice entrypoint is limited to one only. so here there could be multiple cases on to which this should work

a combination of py+py or cpp+py like this so we need to loop over our entrypoints arrays and then extract extension from it(already being done) if its .cpp file build() run_cpp() and continue this we need to do why continue to so that it can proceed with the further files if extension is .py then run_python()

[ a.cpp, b.py ] and more.

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 we need to store it self.application_processes = []

so what i am planning and how states looks would be compiled=false->cat.cpp->needs build?->yes->colcon build->compiled=true->run cat->store processes->next file->mouse.py->run python->store it->next file.

Now my question is ? right now no excersice send two cpp files as per you i should be concerned with drone cat mouse only? so sending two cpp there's an issue you know about this.

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 ?

Let me get this straight. When running the application there are 2 steps:

  1. Compile the code: this is for C++ or *.launch.py entrypoints
  2. Run the entrypoints

You do not need to reinvent the wheel about what to compile storing variables or something else. You just need to modify step 2

@javizqh

javizqh commented Jul 28, 2026

Copy link
Copy Markdown
Member

also had a doubt about this entrypoint.endswith(".launch.py") cuurently as per my knowledge none of the excersice of robotics academy passes this as an entrypoint.

so is this related to bt studio ?

No, this is functionality that Robotics Academy supports as can be seen in video https://youtu.be/0vTp6PnbPcU?si=1TZe0eyYc0ow7a4u

@anishk85

Copy link
Copy Markdown
Author

Hi i am done with the entrypoints part.

@javizqh javizqh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are wasting my times with the reviews.

The next one will be my last one if I see that you do not care at all

raise Exception("User code not found")

_, file_extension = os.path.splitext(entrypoint)
_, file_extension = os.path.splitext(entrypoints[0])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i know about this but earlier i pushed this then it was wrong too
below is snippet attached

image

when i was iterating over every entry point

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@javizqh javizqh Jul 29, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah so that why i mentioned to keep a boolean flag earlier

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will make it true on first build

@anishk85 anishk85 Jul 29, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should i go with this? and do a final push

@javizqh javizqh Jul 29, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@anishk85

Copy link
Copy Markdown
Author

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.
already a lot of stress this pr given to me.

@javizqh

javizqh commented Jul 29, 2026

Copy link
Copy Markdown
Member

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants