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

How to track success/failure of SMACH states

asked 2013-08-18 15:19:33 -0600

Pi Robot gravatar image


I have a SMACH state machine that simulates navigating to three different rooms and performing a number of cleaning tasks in each room. I'd like to be able to track which tasks succeed or fail as well as which rooms may not be reached at all, perhaps due to obstacles. I'm using the SimpleActionState to wrap move_base for navigating to each room. I then have simple states for each cleaning task such as Vacuum(), Mop(), etc. The top level state machine navigates to a room, performs the tasks for that room, then moves to the next room and so on.

My question is: what is the SMACH way to track which tasks were completed and which rooms were actually reached? Should I be passing userdata, using callbacks, or some kind of global Python variable(s)? When the state machine completes, I want to know if certain rooms or tasks need to be revisited.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-28 11:22:04 -0600

Mark Rose gravatar image

The best way is probably to use userdata, as you suggest. If you can process the rooms in any order, you might have the states loop back to a single, starting, decision state that uses the accumulated info in userdata to decide what transition to perform. (Though this might be more easily modeled using a different paradigm like behavior trees.)

edit flag offensive delete link more

Question Tools



Asked: 2013-08-18 15:19:33 -0600

Seen: 254 times

Last updated: Jun 28 '18