Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
arbitrator::ArbitratorStateMachine Class Reference

#include <arbitrator_state_machine.hpp>

Collaboration diagram for arbitrator::ArbitratorStateMachine:
Collaboration graph

Public Member Functions

 ArbitratorStateMachine ()
 
ArbitratorState submit_event (ArbitratorEvent event)
 
ArbitratorState get_state ()
 

Private Attributes

const std::vector< ArbitratorStateTransitionARBITRATOR_TRANSITIONS
 
ArbitratorState current_state
 

Detailed Description

The ArbitratorStateMachine class is responsible for regulating the state transitions within the Arbitrator node. It processess events and correlates them against a list of legal transitions to generate the next state the Arbitrator will take. The transition list is defined internally and each transition must be unique/deterministic (each state/event pair must transition to one-and-only-one other state) or behavior is undefined.

Definition at line 74 of file arbitrator_state_machine.hpp.

Constructor & Destructor Documentation

◆ ArbitratorStateMachine()

arbitrator::ArbitratorStateMachine::ArbitratorStateMachine ( )
inline

Member Function Documentation

◆ get_state()

ArbitratorState arbitrator::ArbitratorStateMachine::get_state ( )

Get the current state of the Arbitrator

Returns
The state of the Arbitrator

Definition at line 23 of file arbitrator_state_machine.cpp.

24 {
25 return current_state;
26 }

References current_state.

◆ submit_event()

ArbitratorState arbitrator::ArbitratorStateMachine::submit_event ( ArbitratorEvent  event)

Submit an event for evaluation by the Arbitrator state machine.

Parameters
Theevent to process
Returns
The state of the Arbitrator after the event has been processed.

Definition at line 29 of file arbitrator_state_machine.cpp.

30 {
31 for (auto pair : ARBITRATOR_TRANSITIONS)
32 {
33 if (current_state == pair.current_state && event == pair.input_event)
34 {
35 // In the event of multiple legal transistions this will take the last transition,
36 // But ultimately this condition should never arise.
37 current_state = pair.final_state;
38 break;
39 }
40 }
41
42 return current_state;
43 }
const std::vector< ArbitratorStateTransition > ARBITRATOR_TRANSITIONS

References ARBITRATOR_TRANSITIONS, and current_state.

Member Data Documentation

◆ ARBITRATOR_TRANSITIONS

const std::vector<ArbitratorStateTransition> arbitrator::ArbitratorStateMachine::ARBITRATOR_TRANSITIONS
private

◆ current_state

ArbitratorState arbitrator::ArbitratorStateMachine::current_state
private

Definition at line 115 of file arbitrator_state_machine.hpp.

Referenced by get_state(), and submit_event().


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