ros2_rust: Nodes should exit cleanly

Currently, sending Ctrl-C to a node makes it exit with code 130 (on a Linux machine). It should instead exit cleanly.

If we follow the rclcpp example, this would be achieved by a signal handler which calls rcl_shutdown().

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 27 (9 by maintainers)

Most upvoted comments

rclcpp allows developers to create multiple ROS contexts, this is important when you partition the ROS network with multiple domain IDs, or run loggers from multiple nodes in the same process. The rclcpp global context is still a thing but you can use it indirectly through a local context. I use multiple rclcpp::Context local-variables in ros-gst-bridge, and I’ve added the same to my port of fuse, I’d be surprised if it wasn’t needed by people implementing interfaces for ros_control

why didn’t rclcpp do that?

The rclcpp Node / Excutor / CallbackGroup model had a substantial refactor in Foxy, most of that was shaking off ROS1 baggage of one-process-one-node. I think if you can ditch globals in rclrs, rclcpp will try to adopt your model.

I’ll be following this thread with interest because I have a race condition on sigint between rclcpp and GLib