vulp  2.3.0
vulp.spine::StateMachine Class Reference

Spine state machine. More...

#include <StateMachine.h>

Public Member Functions

 StateMachine (AgentInterface &interface) noexcept
 Initialize state machine. More...
 
void process_event (const Event &event) noexcept
 Process a new event. More...
 
const Statestate () const noexcept
 Get current state. More...
 
bool is_over_after_this_cycle () const noexcept
 Whether we transition to the terminal state at the next end-cycle event. More...
 

Detailed Description

Spine state machine.

The overall specification of the state machine is summarized in the following diagram:

States have the following purposes:

  • Stop: do nothing, send stop commands to servos
  • Reset: apply runtime configuration to actuation interface and observers
    • The reset state is not time-critical, i.e., configuration can take time.
  • Idle: do nothing
  • Observe: write observation from the actuation interface
  • Act: send action to the actuation interface
  • Shutdown: terminal state, exit the control loop

There are three possible events:

  • begin: beginning of a control cycle,
  • end: end of a control cycle.
  • SIGINT: the process received an interrupt signal.

Guards, indicated between brackets, may involve two variables:

  • req: the current request from the agent.
  • stop_cycles: the number of stop commands cycled in the current state (only available in "stop" and "shutdown" states).

Definition at line 88 of file StateMachine.h.

Constructor & Destructor Documentation

◆ StateMachine()

vulp.spine::StateMachine::StateMachine ( AgentInterface interface)
explicitnoexcept

Initialize state machine.

Parameters
[in]interfaceInterface to communicate with the agent.

Definition at line 12 of file StateMachine.cpp.

Member Function Documentation

◆ is_over_after_this_cycle()

bool vulp.spine::StateMachine::is_over_after_this_cycle ( ) const
inlinenoexcept

Whether we transition to the terminal state at the next end-cycle event.

Definition at line 106 of file StateMachine.h.

◆ process_event()

void vulp.spine::StateMachine::process_event ( const Event event)
noexcept

Process a new event.

Parameters
[in]eventNew event.

Definition at line 17 of file StateMachine.cpp.

◆ state()

const State& vulp.spine::StateMachine::state ( ) const
inlinenoexcept

Get current state.

Definition at line 103 of file StateMachine.h.


The documentation for this class was generated from the following files: