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.
|
Class defining the state transition table behavior for the LCIStrategic Strategic Plugin. More...
#include <lci_state_transition_table.hpp>
Public Types | |
using | TransitionCallback = std::function< void(TransitState prev_state, TransitState new_state, TransitEvent signal)> |
Public Member Functions | |
LCIStrategicStateTransitionTable ()=default | |
Default Constructor. More... | |
TransitState | getState () const |
Returns the current state. More... | |
void | signal (TransitEvent signal) |
Trigger signal for the transition table. More... | |
void | setTransitionCallback (TransitionCallback cb) |
Callback setting function. The provided callback will be triggered any time the current state changes to a new state. More... | |
Private Member Functions | |
void | signalWhenUNAVAILABLE (TransitEvent signal) |
void | signalWhenAPPROACHING (TransitEvent signal) |
void | signalWhenWAITING (TransitEvent signal) |
void | signalWhenDEPARTING (TransitEvent signal) |
void | logDebugSignal (TransitEvent signal) const |
Helper function for logging the provide signal. More... | |
void | setAndLogState (TransitState new_state, TransitEvent source_signal) |
Function to change the current state and log the details of the transition. More... | |
Private Attributes | |
TransitState | state_ = TransitState::UNAVAILABLE |
Current state. This state should only ever be set using the setAndLogState() function. More... | |
TransitionCallback | transition_callback_ |
Class defining the state transition table behavior for the LCIStrategic Strategic Plugin.
Definition at line 25 of file lci_state_transition_table.hpp.
using lci_strategic_plugin::LCIStrategicStateTransitionTable::TransitionCallback = std::function<void(TransitState prev_state, TransitState new_state, TransitEvent signal)> |
Definition at line 28 of file lci_state_transition_table.hpp.
|
default |
Default Constructor.
TransitState lci_strategic_plugin::LCIStrategicStateTransitionTable::getState | ( | ) | const |
Returns the current state.
Definition at line 29 of file lci_state_transition_table.cpp.
References state_.
Referenced by lci_strategic_plugin::LCIStrategicPlugin::plan_maneuvers_callback().
|
private |
Helper function for logging the provide signal.
signal | The signal to be logged |
Definition at line 118 of file lci_state_transition_table.cpp.
References signal(), and state_.
Referenced by signalWhenAPPROACHING(), signalWhenDEPARTING(), signalWhenUNAVAILABLE(), and signalWhenWAITING().
|
private |
Function to change the current state and log the details of the transition.
new_state | The state to set. |
source_signal | The signal which caused the new_state to be set |
Definition at line 124 of file lci_state_transition_table.cpp.
References state_, and transition_callback_.
Referenced by signalWhenAPPROACHING(), signalWhenDEPARTING(), signalWhenUNAVAILABLE(), and signalWhenWAITING().
void lci_strategic_plugin::LCIStrategicStateTransitionTable::setTransitionCallback | ( | TransitionCallback | cb | ) |
Callback setting function. The provided callback will be triggered any time the current state changes to a new state.
cb | The callback function which will be provided with the previous state, new current state, and the signal which caused the transition. |
Definition at line 59 of file lci_state_transition_table.cpp.
References transition_callback_.
void lci_strategic_plugin::LCIStrategicStateTransitionTable::signal | ( | TransitEvent | signal | ) |
Trigger signal for the transition table.
signal | The signal for the transition table to evaluate |
Definition at line 34 of file lci_state_transition_table.cpp.
References lci_strategic_plugin::APPROACHING, lci_strategic_plugin::DEPARTING, signal(), signalWhenAPPROACHING(), signalWhenDEPARTING(), signalWhenUNAVAILABLE(), signalWhenWAITING(), state_, lci_strategic_plugin::UNAVAILABLE, and lci_strategic_plugin::WAITING.
Referenced by logDebugSignal(), lci_strategic_plugin::LCIStrategicPlugin::planWhenAPPROACHING(), lci_strategic_plugin::LCIStrategicPlugin::planWhenDEPARTING(), lci_strategic_plugin::LCIStrategicPlugin::planWhenUNAVAILABLE(), lci_strategic_plugin::LCIStrategicPlugin::planWhenWAITING(), signal(), signalWhenAPPROACHING(), signalWhenDEPARTING(), signalWhenUNAVAILABLE(), and signalWhenWAITING().
|
private |
Definition at line 76 of file lci_state_transition_table.cpp.
References lci_strategic_plugin::CROSSED_STOP_BAR, lci_strategic_plugin::DEPARTING, logDebugSignal(), setAndLogState(), signal(), lci_strategic_plugin::STOPPED, and lci_strategic_plugin::WAITING.
Referenced by signal().
|
private |
Definition at line 106 of file lci_state_transition_table.cpp.
References lci_strategic_plugin::INTERSECTION_EXIT, logDebugSignal(), setAndLogState(), signal(), and lci_strategic_plugin::UNAVAILABLE.
Referenced by signal().
|
private |
Definition at line 64 of file lci_state_transition_table.cpp.
References lci_strategic_plugin::APPROACHING, lci_strategic_plugin::IN_STOPPING_RANGE, logDebugSignal(), setAndLogState(), and signal().
Referenced by signal().
|
private |
Definition at line 94 of file lci_state_transition_table.cpp.
References lci_strategic_plugin::DEPARTING, logDebugSignal(), lci_strategic_plugin::RED_TO_GREEN_LIGHT, setAndLogState(), and signal().
Referenced by signal().
|
private |
Current state. This state should only ever be set using the setAndLogState() function.
Definition at line 59 of file lci_state_transition_table.hpp.
Referenced by getState(), logDebugSignal(), setAndLogState(), and signal().
|
private |
Definition at line 61 of file lci_state_transition_table.hpp.
Referenced by setAndLogState(), and setTransitionCallback().