ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

launch multiple nodes sequentially

asked 2022-06-20 13:12:03 -0600

kenkainkane gravatar image

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?

edit retag flag offensive close merge delete

Comments

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

RyanChen.YLC gravatar image RyanChen.YLC  ( 2022-06-20 22:33:48 -0600 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2022-06-20 17:43:03 -0600

Hulkthehunter gravatar image

updated 2022-06-20 17:45:01 -0600

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

edit flag offensive delete link more
0

answered 2022-06-21 02:07:16 -0600

ljaniec gravatar image

updated 2022-06-21 02:08:11 -0600

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-06-20 13:12:03 -0600

Seen: 992 times

Last updated: Jun 21 '22