Robotics StackExchange | Archived questions

launch multiple nodes sequentially

I'm finding the ways to run multiple nodes sequentially (e.g., start node B after finished node A). Could you give me any advice?

Asked by kenkainkane on 2022-06-20 13:12:03 UTC

Comments

Maybe try adding delay between starting nodes in launch file. You can see more detail in this post.

Asked by RyanChen.YLC on 2022-06-20 22:33:48 UTC

Answers

Look into tmux and tmuxp.

In tmuxp yaml file just add sleep (amount of time which is taken by node 1 to finish) and then launch second node. I use the same method to launch multiple launch files sequentially

Asked by Hulkthehunter on 2022-06-20 17:43:03 UTC

Comments

I think you should look into the Lifecycle and Composition Nodes:

A managed life cycle for nodes allows greater control over the state of ROS system. It will allow roslaunch to ensure that all components have been instantiated correctly before it allows any component to begin executing its behaviour. It will also allow nodes to be restarted or replaced on-line.

ROS 2 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 contain a state machine with a set of predefined 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 ROS 2 design page.

Lifecycle is introduced in ROS 2 to systematically manage the bringup and shutdown of the different nodes involved in the robot’s operation. The use of Lifecycle nodes ensures that all nodes are successfully instantiated before they begin their execution and Nav2 shuts down all nodes if there is any unresponsive node.

Asked by ljaniec on 2022-06-21 02:07:16 UTC

Comments