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

running several nodes automatically and as per need

asked 2015-06-27 08:03:17 -0600

sobot gravatar image


I am looking to figure out how to setup an Automatic Launch method for a project in ROS involving several nodes in different packages. Idea is that those nodes need to be executed at different times, as per need or pause and re-run if a certain condition arose.

I can be wrong but as far as i know with a Launch file you can start the the nodes at one time or - somewhere in this website i read - nodes could be launched conditionally through the launch file.

What i am looking to figure out is how to go about to achieve the following type of automatic Execution of nodes:

Run the initial node (node A) from a package and then when there is the right time (depending on; a condition is met or an interesting information is received or a job is done by another node) Node B starts and deals with its own assignment and sleeps again waiting to be called again or not. project could have more nodes and different orders of executions.

Lets say there is a Patrol Robot that starts its job, then when it receives an alarm or detects an abnormality in the area it enters a Sweep mode (node from another package) to thoroughly explore that certain part of the perimeter and when it clears the area, robot pause or stops the Sweeping and goes back to normal Patrolling mode unless there is another alarm, etc. (Something like this or more complex in terms of number of nodes)

Would be nice if you could either explain the way to go about it or link resources for me read.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-06-27 09:51:51 -0600

gvdhoorn gravatar image

updated 2015-06-27 12:54:12 -0600

What you describe sounds like behaviour modelling, which can be done with an hierarchical state machine (HSM) for instance, or a behaviour tree. While it can be done by starting and stopping different nodes, I'd say that a HSM which coordinates the activation of nodes would be much simpler.


Thank you @gvdhoorn i just googled HSM + ROS and came up with SMACH. just to be clear is that the kind of approach that you are suggesting for this job?

SMACH is indeed the go-to HSM implementation in ROS. But there are probably many more.

For behaviour trees specifically, see for instance (unfinished).

For all sorts of behaviour modeling tools, see wiki/decision_making.

These are just examples, I don't necessarily particularly recommend any of these.

edit flag offensive delete link more


Thank you @gvdhoorn i just googled HSM + ROS and came up with SMACH. just to be clear is that the kind of approach that you are suggesting for this job?

sobot gravatar image sobot  ( 2015-06-27 12:07:13 -0600 )edit

Question Tools

1 follower


Asked: 2015-06-27 08:03:17 -0600

Seen: 384 times

Last updated: Jun 27 '15