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

Can a sequence of nodes be run in SMACH, behavior trees, or similar?

asked 2016-06-12 03:35:51 -0600

Juan gravatar image

updated 2016-06-12 03:36:31 -0600


I am looking for a solution to the idea of creating a state machine as a sequence of nodes, or a sequence of concurrent nodes. Where the nodes, could be nodes of any type that a user has created.

SMACH/pi-trees/flexbe, out-of-the box seems to work with actionlib, services, topic monitoring. But what if you want to take an FSM and do as follows:

state1 (node1) -> state 2(node 2) -> state3(node3), while checking some kind of transition checking.

Or perhaps running nodes concurrently: state1 (node1,node2) -> state 2(node3, node4) -> state3(node5), this would also be similar to having each state call a launch file....


edit retag flag offensive close merge delete


Did you find a solution/workaround for your question? If yes, Please add a comment. I am looking something similar to your question.

ghkraju gravatar image ghkraju  ( 2016-10-14 05:02:20 -0600 )edit

Generally speaking, it is preferred to launch all the needed nodes together during startup. Each node can then be "activated" or "deactivated" by using ROS topics or services rather than launching nodes dynamically during runtime.

Pi Robot gravatar image Pi Robot  ( 2016-10-14 08:02:29 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-24 09:53:54 -0600

Juan gravatar image

Thanks @Pi Robot @ghkraju! Yes, now I see that we can use SMACH to activate/deactivate nodes through services. We do startup all nodes, and have them sleep until a service event triggers a particular behavior. We are getting examples out on this repo:

edit flag offensive delete link more


@Juan: Thanks. For my purpose, I am using ActionServers in the sameway (which are way better than services atleast for my case). I will start all the action servers at initialization and send a request whenever needed. you can check them once. This might be helpful for you too.

ghkraju gravatar image ghkraju  ( 2017-01-24 10:52:15 -0600 )edit

Can you elaborate on what you mean by you have your nodes sleep until a service event triggers them. I am using a ZED camera which is fairly resource hungry. It would be nice for it to not take up those resources in states where it is not needed.

shoemakerlevy9 gravatar image shoemakerlevy9  ( 2017-04-14 15:48:39 -0600 )edit

Question Tools



Asked: 2016-06-12 03:35:51 -0600

Seen: 884 times

Last updated: Jan 24 '17