Using a state machine to perform YMCA
Finite-state machines are powerful mechanisms for controlling the behavior of a system, especially robotic systems. ROS has implemented a state machine structure and behaviors in a Python-based library called SMACH. The SMACH library is independent of ROS and can be used with any Python project. SMACH provides an architecture for implementing hierarchical tasks and mechanisms to define transitions between these tasks. The advantages of using SMACH for a system include the following:
Rapid prototyping of a state machine for testing and use
Defining complex behaviors using a clear, straightforward method for design, maintenance, and debugging
Introspection of the state machine, its transitions, and data flow using SMACH tools
For a complete set of documentation and tutorials on SMACH, examine these websites:
Some basic rules for implementing state machines on a robot are as follows:
A robot can...