(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.


Description: Finite State Machine Intro

Keywords: decision_making

Tutorial Level: BEGINNER

Next Tutorial: decision_making/Tutorials/FSM(C++)


An example of a very simple mechanism that can be modeled by a state machine is a turnstile [http://en.wikipedia.org/wiki/Finite-state_machine].

Canonical FSM example

Though FSM are a simple executive concept, there are several alternatives for describing the desired execution using an FSM (we refer to them as passive and active FSM):

  1. Passive FSM, models Transition as Actions to be executed when a condition is fulfilled or when an event is received. Using such representation the state itself is idle waiting for an action to be emposed.

  2. Active FSM, models States as Actions, either using Entry actions and Exit actions or by representing the state itself as an action.

Passive FSM are more likely to be utilized to model logical transitions, while active FSM are more suitable for purely reactive systems.

For system that require internal state motivation or proactive actions see Behavior Trees decision_making/Tutorials/BehaviorTree



  • DOT language supports the definition of directed graphs, where double circles and/or filled point/circle are usually used to define the starting state.

Reading material

  1. FSM, HSM and Behavior treeshttps://www.cs.umd.edu/class/spring2018/cmsc425/Lects/lect21-ai-dec-making.pdf

Wiki: decision_making/Tutorials/FSM (last edited 2021-11-08 14:45:36 by TillKoch)