vulp  2.3.0
vulp.spine Namespace Reference

Inter-process communication protocol with the spine. More...

Namespaces

 exceptions
 
 request
 
 spine_interface
 

Classes

class  AgentInterface
 Memory map to shared memory. More...
 
class  Spine
 Loop transmitting actions to the actuation and observations to the agent. More...
 
class  StateMachine
 Spine state machine. More...
 

Enumerations

enum class  Request : uint32_t {
  kNone = 0 , kObservation = 1 , kAction = 2 , kStart = 3 ,
  kStop = 4 , kError = 5
}
 
enum class  State : uint32_t {
  kSendStops = 0 , kReset = 1 , kIdle = 2 , kObserve = 3 ,
  kAct = 4 , kShutdown = 5 , kOver = 6
}
 States of the state machine. More...
 
enum class  Event : uint32_t { kCycleBeginning = 0 , kCycleEnd = 1 , kInterrupt = 2 }
 Events that may trigger transitions between states. More...
 

Functions

void allocate_file (int file_descriptor, int bytes)
 Allocate file with some error handling. More...
 
constexpr const char * state_name (const State &state) noexcept
 Name of a state. More...
 

Variables

constexpr size_t kMebibytes = 1 << 20
 
constexpr unsigned kNbStopCycles = 5
 When sending stop cycles, send at least that many. More...
 

Detailed Description

Inter-process communication protocol with the spine.

Design notes: one alternative was a proper FSM with a clear distinction between states (what the spine is doing) and transitions (agent requests, spine replies, etc.). This could have allowed more granularity, such as the spine doing nothing (instead of sending stops) when it is idle, however at the cost of more complexity. We choose to go for the simpler (riskier) version where both agent and spine directly manipulate the agenda.

Enumeration Type Documentation

◆ Event

enum vulp::spine::Event : uint32_t
strong

Events that may trigger transitions between states.

Enumerator
kCycleBeginning 
kCycleEnd 
kInterrupt 

Definition at line 25 of file StateMachine.h.

◆ Request

enum vulp::spine::Request : uint32_t
strong
Enumerator
kNone 
kObservation 
kAction 
kStart 
kStop 
kError 

Definition at line 10 of file Request.h.

◆ State

enum vulp::spine::State : uint32_t
strong

States of the state machine.

Enumerator
kSendStops 
kReset 
kIdle 
kObserve 
kAct 
kShutdown 
kOver 

Definition at line 14 of file StateMachine.h.

Function Documentation

◆ allocate_file()

void vulp::spine::allocate_file ( int  file_descriptor,
int  bytes 
)

Allocate file with some error handling.

Parameters
[in]file_descriptorFile descriptor.
[in]bytesNumber of bytes to allocate.

Definition at line 16 of file AgentInterface.cpp.

◆ state_name()

constexpr const char* vulp::spine::state_name ( const State state)
constexprnoexcept

Name of a state.

Parameters
[in]stateState to name.

Definition at line 35 of file StateMachine.h.

Variable Documentation

◆ kMebibytes

constexpr size_t vulp::spine.kMebibytes = 1 << 20
constexpr

Definition at line 27 of file Spine.h.

◆ kNbStopCycles

constexpr unsigned vulp::spine.kNbStopCycles = 5
constexpr

When sending stop cycles, send at least that many.

Definition at line 11 of file StateMachine.h.