[Documentation] [TitleIndex] [WordIndex


When should I use SMACH?

SMACH is useful when you want a robot to execute some complex plan, where all possible states and state transitions can be described explicitly. This basically takes the hacking out of hacking together different modules to make systems like mobile robotic manipulators do interesting things.

  • Fast prototyping: The straightforward Python-based SMACH syntax makes it easy to quickly prototype a state machine and start running it.
  • Complex state machines: SMACH allows you to design, maintain and debug large, complex hierarchical state machines. You can find an example of a complex hierarchical state machine here.

  • Introspection: SMACH gives you full introspection in your state machines, state transitions, data flow, etc. See the smach_viewer for more details.

When should I NOT use SMACH?

  • Unstructured tasks: SMACH will fall short as the scheduling of your task becomes less structured.
  • Low-level systems: SMACH is not meant to be used as a state machine for low-level systems that require high efficiency, SMACH is a task-level architecture.

  • Smash: Do not use SMACH when you want to smash something, for that use smash.

Is SMACH only a finite state machine library?

You can build a finite state machine using SMACH, but SMACH can do much more. SMACH is a library for task-level execution and coordination, and provides several types of "state containers". One such container, is a finite state machine, but this container can also be a state in another container. See the tutorials page for a list of containers and states built into SMACH.


The documentation page provides an overview of the concepts used in SMACH.

The tutorials page contains an extensive set of tutorials to get you up to speed building and running your own state machines.

Additional State Types

See AdditionalStateTypes for SMACH state classes with a variety of additional behaviors.


On the tutorials page you can find a number of easy examples. But if you are looking for some 'real' examples running SMACH:

Report a Bug

<<TracLink(ros-pkg executive_smach)>>

2024-06-15 12:55