State Machine  0.5.0
This repository contains packages for creating and running general purpose state machines.
State Machine

This repository contains packages for creating and running general purpose state machines.

The source code is released under a proprietary license.

Author: Remo Diethelm

Branch Build Status Build Job
master N/A Link
pre-release N/A Link
release N/A Link

Concept of a state machine

A state machine is a tool to schedule and execute states in a deterministic way. Each state has a set of possible outcomes. Depending the outcome, the corresponding transition determines the following state.

The following image shows an example state machine:

Example State Machine



Core library containing state machine base classes and utilities. In order to create your own state machine, create states deriving from one of the following three base classes:

  • State: Simple state, base class to single tasks.
  • StateMachine: State container which executes child states in sequence. An initial state has to be defined.
  • Concurrency: State container which executes child states in parallel. No initial state can be set.

As both StateMachine and Concurrency are States themselves, it is possible to nest the classes. States can share any type of data by using the global data container.

During execution, the state machine can write a report, as long as the interface is provided.


ROS wrapper for the state_machine library, adding a ROS node handle to the states. Also, it implements a ROS interface for writing reports, as well as an interface to the ROS clock.


ROS message and service definitions for state_machine_ros.


Library containing a collection of commonly used states, such as sleeping, checks or supervisions.


Library containing a state planner, finding the optimal sequence of states to reach a goal state.


Doxygen documentation of the state machine tools.

Open work packages

  • [DONE] Create state_machine_ros, state_machine_msgs, and state_machine_basics packages.
  • [DONE] Use -Wall -Werror.
  • [DONE] Add override and default keywords.
  • [DONE] Use clang.
  • [DONE] Remove ROS dependency from report.
  • [DONE] Create a ROS independent interface to the time, and derive a ROS dependent interface from it.
  • [DONE] Split packages into several repositories.
  • Make method ordering consistent in state_machine library.
  • Remove argos audio dependencies from report msgs.
  • Work on TODOs indicated in code.
  • Write unit tests.
  • Use plugins.
  • Move startup and shutdown of ROS interfaces to preExectution and postExecution.
  • Derive protected/private instead of public?
  • Turn some Container methods from public into protected.
  • Properly group public, protected and private members.
  • Add exceptions to avoid segfaults.
  • Remove all references to the mission.
  • Create dedicated class for inconsistencies which include state nested name and message, and potentially distinguish between warning and error.
  • Fix: Clear inconsistencies in classes with no parent state. A solution could be to introduce a separate method which wraps the isConsistent(..) method.