ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Just to elaborate further on Josh Whitley's answer: This is still true in ROS2 Galactic. You can write a node that inherits from rclcpp::LifecycleNode
, implements the lifecycle states, and is launched as either a standalone Node or ComposableNode. However the mechanisms in ros_launch that automate the state transitions only work with LifecycleNode objects. This means that without them, lifecycle nodes will start in the "unconfigured" state, and won't automatically configure or activate themselves, much less shut down properly.
If you really need to run a lifecycle node inside a container, this leaves you with a couple of options (other users please feel free to chime in with any I've missed):
$ ros2 lifecycle set /<node_name> configure/activate/shutdown
. I've tested this out and can confirm it works. Visit this lifecycle demo readme for more information.