ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You can try using Licycle Nodes:
Introduction
ROS2 introduces the concept of managed nodes, also called LifecycleNodes. In the following tutorial, we explain the purpose of these nodes, what makes them different from regular nodes and how they comply to a lifecycle management. Managed nodes are scoped within a state machine of a finite amount of states. These states can be changed by invoking a transition id which indicates the succeeding consecutive state. The state machine is implemented as described at the ROS2 design page.
Our implementation differentiates between Primary States and Transition States. Primary States are supposed to be steady states in which any node can do the respected task. On the other hand, Transition States are meant as temporary intermediate states attached to a transition. The result of these intermediate states are used to indicate whether a transition between two primary states is considered successful or not. Thus, any managed node can be in one of the following states:
Primary States (steady states):
unconfigured inactive active shutdown
Transition States (intermediate states):
configuring activating deactivating cleaningup shuttingdown
The possible transitions to invoke are:
configure activate deactivate cleanup shutdown
https://design.ros2.org/articles/node_lifecycle.html (ROS2 Design for LN)
https://index.ros.org/p/lifecycle/github-ros2-demos/ (demo example)
https://www.youtube.com/watch?v=ikmTPO9GoJc (short video tutorial)