-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected value of launch argument in 'on_exit' clause #501
Comments
So you are talking about two different things here, I believe. One is that we never made progress on ros/robot_state_publisher#144 . As far as I can tell from the end of that conversation, there is no fundamental objection to that, it's just that nobody spent the time to write the code to allow the robot description to come from a topic. If you are interested in that, please consider submitting a pull request for it which we'd be happy to review. The other thing you are talking about is making the current system work with robot_description as a parameter. My understanding is that something like you've shown above should work in the launch system, but there may be some subtlety that I'm missing. Hopefully one of the launch maintainers can steer you in the correct direction. |
This is related to #313. Launch files are included within their parent scope, and thus both launch files in the example above refer to the same Short term, you may explicitly push and pop scopes before and after including a launch file with the |
@clalancette yes, apologies, reference to #144 was more meant as background to the particular problem I was trying to solve. I'll see if I can work up a PR though. @hidmic I read #313 but couldn't see exactly how this relates though I may be missing something. Surely, whether 'r' is within a separate scope or not, both of the ExecuteProcess actions in test2.launch.py should see the same value of 'r' in a given invocation of the launch file? I tried changing the calling launch file to:
But this gives:
As with the original example, I get the expected output for the first ExecuteProcess but it seems that the second ExecuteProcess, attached to the 'on_exit' is not in the local scope and does not see the local 'r'. I also tried doing RegisterEventHandler(OnProcessExit(...)) attached to the first ExecuteProcess and saw the same thing. Is this to do with the scope of an event handler? |
The lack of scope means arguments, just like variables, can be overridden. First include sets
Hmm, may be onto something here. Event handlers do not carry a closure of the local launch configurations in the scope they were registered. That's true, and CC @ivanpauno @wjwwood for feedback. |
Bug report
Steps to reproduce issue
Expected behavior
echo commands print:
Actual behavior
Additional information
Somewhat related to ros/robot_state_publisher#144 I wish to run a robot_state_publisher per robot in a multi robot system where all the robot are identical, and they all get the URDF model from a topic published by the owner of the model, which in this case is a docker container running Gazebo. Since robot_state_publisher does not support receiving a model via topic, my workaround was to have a helper node receive the model and write it to a temporary local file, after which robot_state_publisher could be started.
A launch file is invoked per robot with a different value launch parameter uniquely naming the robot and the temporary file. Using the style of
test2.launch.py
to achieve this was unsuccessful, because the value of the launch configuration variable 'r' is always 'r2' in the 'on_exit' ExecuteProcess.I'm quite new to the Python launch system and would welcome any pointers to what I might be doing wrong here.
The text was updated successfully, but these errors were encountered: