Ask Your Question

How to track success/failure of SMACH states

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

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 -0500

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

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: 2013-08-18 15:19:33 -0500

Seen: 217 times

Last updated: Jun 28 '18