-
Notifications
You must be signed in to change notification settings - Fork 145
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
Let XML executables/nodes be "required" (like in ROS 1) #751
Conversation
Essentially on_exit="shutdown" is equivalent to ROS 1 required="true". This feature is implemented using the python launchfile on_exit mechanism. Right now "shutdown" is the only action accepted by on_exit, but theoretically more "on_exit" actions could be added later. Example: <executable cmd="ls" on_exit="shutdown"/> Signed-off-by: Matthew Elwin <elwin@northwestern.edu>
👍
Linking related issue #174 and PR #179 added similar support for Python launch files via Py Example: nodes_to_launch.append(
Node(
package="my_example_pkg",
executable="example_node_main",
name="example_node",
...
on_exit=Shutdown(),
)
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution.
Besides the fix listed inline, would you also please add this support to YAML? That way we keep feature parity between XML and YAML.
if 'on_exit' not in ignore: | ||
on_exit = entity.get_attr('on_exit', optional=True) | ||
if on_exit is not None: | ||
if on_exit == "shutdown": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our style prefers single-quotes:
if on_exit == "shutdown": | |
if on_exit == 'shutdown': |
Signed-off-by: Matthew Elwin <elwin@northwestern.edu>
Thanks. Fixed the quotes and added a unit test for the yaml support. I think the code I added automatically covers both xml and yaml cases, but please let me know if I'm missing something. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for iterating! This looks great. I'll run CI on it next.
* Let XML nodes be "required" Essentially on_exit="shutdown" is equivalent to ROS 1 required="true". This feature is implemented using the python launchfile on_exit mechanism. Right now "shutdown" is the only action accepted by on_exit, but theoretically more "on_exit" actions could be added later. Example: <executable cmd="ls" on_exit="shutdown"/> * Added tests for yaml Signed-off-by: Matthew Elwin <elwin@northwestern.edu>
* Let XML nodes be "required" Essentially on_exit="shutdown" is equivalent to ROS 1 required="true". This feature is implemented using the python launchfile on_exit mechanism. Right now "shutdown" is the only action accepted by on_exit, but theoretically more "on_exit" actions could be added later. Example: <executable cmd="ls" on_exit="shutdown"/> * Added tests for yaml Signed-off-by: Matthew Elwin <elwin@northwestern.edu> Signed-off-by: Tim Clephas <tim.clephas@nobleo.nl>
#764) Backport #751 for Iron Essentially on_exit="shutdown" is equivalent to ROS 1 required="true". This feature is implemented using the python launchfile on_exit mechanism. Right now "shutdown" is the only action accepted by on_exit, but theoretically more "on_exit" actions could be added later. Example: <executable cmd="ls" on_exit="shutdown"/> * Added tests for yaml Signed-off-by: Matthew Elwin <elwin@northwestern.edu> Signed-off-by: Tim Clephas <tim.clephas@nobleo.nl> Co-authored-by: Matthew Elwin <10161574+m-elwin@users.noreply.github.com>
ros2#764) Backport ros2#751 for Iron Essentially on_exit="shutdown" is equivalent to ROS 1 required="true". This feature is implemented using the python launchfile on_exit mechanism. Right now "shutdown" is the only action accepted by on_exit, but theoretically more "on_exit" actions could be added later. Example: <executable cmd="ls" on_exit="shutdown"/> * Added tests for yaml Signed-off-by: Matthew Elwin <elwin@northwestern.edu> Signed-off-by: Tim Clephas <tim.clephas@nobleo.nl> Co-authored-by: Matthew Elwin <10161574+m-elwin@users.noreply.github.com>
I can see this being backported to iron. Is there a plan to move this to humble as well? |
* Let XML nodes be "required" Essentially on_exit="shutdown" is equivalent to ROS 1 required="true". This feature is implemented using the python launchfile on_exit mechanism. Right now "shutdown" is the only action accepted by on_exit, but theoretically more "on_exit" actions could be added later. Example: <executable cmd="ls" on_exit="shutdown"/> * Added tests for yaml Signed-off-by: Matthew Elwin <elwin@northwestern.edu>
Essentially on_exit="shutdown" is equivalent to ROS 1 required="true".
This feature is implemented using the python launchfile on_exit= mechanism.
Right now "shutdown" is the only action accepted by on_exit, but theoretically more "on_exit" actions could be added later.
Example: