Skip to content
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

Add support for interruptible ROS processes #129

Merged
merged 4 commits into from
Nov 19, 2024

Conversation

mhidalgo-bdai
Copy link
Contributor

By default, rclpy will install signal handlers for SIGINT and SIGTERM upon global context initialization. These handlers shutdown ROS 2 contexts. process-wide, making it impossible for ROS 2 aware processes to use most ROS 2 interfaces during shutdown. E.g. a simple example script cannot command a robot to adopt a safe configuration on Ctrl + C,

This patch adds the notion of an interruptible ROS process. An interruptible ROS process will not shutdown when interrupted (SIGINT or SIGTERM) but raise a suitable exception (KeyboardInterrupt or SystemExit). When using process-wide APIs, the global context will eventually be shutdown accordingly. This is an opt-in feature.

Copy link
Contributor

@khughes-bdai khughes-bdai left a comment

Choose a reason for hiding this comment

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

LGTM -- eventually would be nice to have an example (maybe located internally?) that uses this

Signed-off-by: Michel Hidalgo <[email protected]>
@mhidalgo-bdai mhidalgo-bdai marked this pull request as ready for review November 19, 2024 21:30
@mhidalgo-bdai
Copy link
Contributor Author

eventually would be nice to have an example (maybe located internally?) that uses this

@khughes-bdai example added.

@mhidalgo-bdai mhidalgo-bdai force-pushed the mhidalgo-bdai/interruptible-ros-process branch from c39db13 to df9f689 Compare November 19, 2024 21:59
@mhidalgo-bdai
Copy link
Contributor Author

With green CI, getting this one in.

@mhidalgo-bdai mhidalgo-bdai merged commit 02ca14e into main Nov 19, 2024
4 checks passed
@mhidalgo-bdai mhidalgo-bdai deleted the mhidalgo-bdai/interruptible-ros-process branch November 19, 2024 22:22
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.

3 participants