Contents
SMACH Tutorials
Learning SMACH
If you just want to look at code, try out the learning by example. If you rather follow a step-by-step guide, choose the step-by-step tutorials.
Learning Step-by-Step |
Learning by Example |
|
|
SMACH Containers
- StateMachine container
This tutorial teaches you how to use the StateMachine container.
- Concurrence container
This tutorial teaches you how to use the Concurrence container.
- Sequence container
This tutorial teaches you how to use the Sequence container.
- Iterator container
This tutorial teaches you how to use the Iterator container.
- Wrapping a Container With actionlib
This tutorial explains how to serve out a SMACH plan as an action over actionlib.
SMACH States
- Generic State
This tutorial show how to implement a generic SMACH State
- CBState
This tutorial gives an example of how to use CBState, a state that simply executes a callback when it is active.
- SimpleActionState (ROS)
This tutorial show how to use the SimpleActionState to directly call an action interface using SMACH
- ServiceState (ROS)
This tutorial shows how to represent the execution of a service as a SMACH state.
- MonitorState (ROS)
Monitor a state!
Advanced SMACH
- Writing Custom Container Classes
Most tasks can be performed without writing new types of container classes, but this tutorial explains how to write a new one.
- State Preemption Implementation
This tutorial shows how to implement simple flag-based preemption in SMACH states.
- StateMachinePreemption
Example of a state machine that implements preemption, using a concurrence container and monitor state.
- Writing Custom State Classes with User-defined Callbacks
Sometimes you want to create a state class like smach.SimpleActionState which receives user callbacks as arguments. If these callbacks change the SMACH interface of a state (outcomes, userdata keys), then the callbacks need to be annotated with this information.
- State Preemption Implementation
This tutorial shows how to implement simple flag-based preemption in SMACH states.
- Writing Custom Container Classes
Most tasks can be performed without writing new types of container classes, but this tutorial explains how to write a new one.
- Writing Custom State Classes with User-defined Callbacks
Sometimes you want to create a state class like smach.SimpleActionState which receives user callbacks as arguments. If these callbacks change the SMACH interface of a state (outcomes, userdata keys), then the callbacks need to be annotated with this information.
- StateMachinePreemption
Example of a state machine that implements preemption, using a concurrence container and monitor state.
Create a new tutorial:
Test your SMACH knowledge
If you're interested in testing your SMACH knowledge, this page has a step-by-step test/example to test your knowledge of different states and containers.