ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

What is the standard way of performing overall/main control with ROS robots?

asked 2021-08-26 21:03:52 -0600

ROSNewbie gravatar image

updated 2021-08-26 21:04:40 -0600

I am working on a team putting together a simple robot and we've done our nodes individually that ccomplish single tasks.

We've reached the point where we need to combine everything to work together but this is where I'm stuck. How do we coordinate when certain tasks get done and others get started?

We came to the conclusion that a state machine is needed so I looked into the smach package but I cannot understand it.

Actions tutorials made sense but not smach.

Is this the standard way of overall control of ROS robots? Are their simpler alternatives? Better smach tutorials that explain things more detailed?

A more clearer example of what I'm asking is for robots such as the turtlebot3 or PR2 there are multiple things happening at the same time. For example navigation and sending out signals to motors. What did they use to coordinate all these tasks, ornplan out when they happen?


edit retag flag offensive close merge delete



For example navigation and sending out signals to motors. What did they use to coordinate all these tasks, ornplan out when they happen?

SMACH or other state machines.

These days, you'd probably want to look at either BehaviorTree/BehaviorTree.ROS, something like py_trees_ros or smacc (ignore all the whacky marketing gimmicks).

In general: if you're not really familiar with the formalisms behind these tools, it may help reading some (online) books or articles about that first. Learning new tools and theory at the same time is not always the most efficient.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-27 01:33:09 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-08-28 10:01:36 -0600

Mike Scheutzow gravatar image

ROS is a distributed system. All nodes run in parallel, and each is listening on its inputs for new messages. When a message arrives, the node processes it. The node may then publish one or more new messages on output(s), which will then cause other nodes to do stuff.

In general, the overall system does not have "a state machine" to coordinate all nodes. More typically, what happens is that a human sends a command/request to a single node, and additional messages propagate outward from that event.

Google for distributed system or publish/subscribe to learn more about this kind of architecture.

edit flag offensive delete link more


While this is technically true, note that you're only describing the publish-subscribe (ie: dataflow) side of a ROS node graph.

Services and actions behave quite differently, and are definitely aspects which can be controlled.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-28 13:35:00 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-08-26 21:03:52 -0600

Seen: 128 times

Last updated: Aug 28 '21