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 ApproachingEmergencyVehiclePlugin. More...
#include <approaching_emergency_vehicle_transition_table.hpp>
Public Types | |
using | TransitionCallback = std::function< void(ApproachingEmergencyVehicleState prev_state, ApproachingEmergencyVehicleState new_state, ApproachingEmergencyVehicleEvent event)> |
Public Member Functions | |
ApproachingEmergencyVehicleTransitionTable ()=default | |
ApproachingEmergencyVehicleTransitionTable Constructor. More... | |
ApproachingEmergencyVehicleState | getState () const |
Returns the current state. More... | |
void | event (ApproachingEmergencyVehicleEvent event) |
Trigger event 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 | eventWhenNO_APPROACHING_ERV (ApproachingEmergencyVehicleEvent event) |
void | eventWhenMOVING_OVER_FOR_APPROACHING_ERV (ApproachingEmergencyVehicleEvent event) |
void | eventWhenSLOWING_DOWN_FOR_ERV (ApproachingEmergencyVehicleEvent event) |
void | logDebugEvent (ApproachingEmergencyVehicleEvent event) const |
Helper function for logging the provide event. More... | |
void | setAndLogState (ApproachingEmergencyVehicleState new_state, ApproachingEmergencyVehicleEvent source_event) |
Function to change the current state and log the details of the transition. More... | |
Private Attributes | |
ApproachingEmergencyVehicleState | state_ = ApproachingEmergencyVehicleState::NO_APPROACHING_ERV |
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 ApproachingEmergencyVehiclePlugin.
Definition at line 28 of file approaching_emergency_vehicle_transition_table.hpp.
using approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::TransitionCallback = std::function<void(ApproachingEmergencyVehicleState prev_state, ApproachingEmergencyVehicleState new_state, ApproachingEmergencyVehicleEvent event)> |
Definition at line 31 of file approaching_emergency_vehicle_transition_table.hpp.
|
default |
ApproachingEmergencyVehicleTransitionTable Constructor.
mode | Defines the operational mode of the state machine which modifies some of the state transitions |
void approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::event | ( | ApproachingEmergencyVehicleEvent | event | ) |
Trigger event for the transition table.
event | The event for the transition table to evaluate |
Definition at line 27 of file approaching_emergency_vehicle_transition_table.cpp.
References event(), eventWhenMOVING_OVER_FOR_APPROACHING_ERV(), eventWhenNO_APPROACHING_ERV(), eventWhenSLOWING_DOWN_FOR_ERV(), approaching_emergency_vehicle_plugin::MOVING_OVER_FOR_APPROACHING_ERV, approaching_emergency_vehicle_plugin::NO_APPROACHING_ERV, approaching_emergency_vehicle_plugin::SLOWING_DOWN_FOR_ERV, and state_.
Referenced by approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::checkForErvTimeout(), event(), eventWhenMOVING_OVER_FOR_APPROACHING_ERV(), eventWhenNO_APPROACHING_ERV(), eventWhenSLOWING_DOWN_FOR_ERV(), approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::getSecondsUntilPassing(), approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::incomingBsmCallback(), logDebugEvent(), and approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::plan_maneuvers_callback().
|
private |
Definition at line 79 of file approaching_emergency_vehicle_transition_table.cpp.
References approaching_emergency_vehicle_plugin::APPROACHING_ERV_IN_PATH, approaching_emergency_vehicle_plugin::APPROACHING_ERV_NOT_IN_PATH, approaching_emergency_vehicle_plugin::ERV_PASSING_IN_PATH, approaching_emergency_vehicle_plugin::ERV_UPDATE_TIMEOUT, event(), logDebugEvent(), approaching_emergency_vehicle_plugin::MOVING_OVER_FOR_APPROACHING_ERV, approaching_emergency_vehicle_plugin::NO_APPROACHING_ERV, setAndLogState(), and approaching_emergency_vehicle_plugin::SLOWING_DOWN_FOR_ERV.
Referenced by event().
|
private |
Definition at line 53 of file approaching_emergency_vehicle_transition_table.cpp.
References approaching_emergency_vehicle_plugin::APPROACHING_ERV_IN_PATH, approaching_emergency_vehicle_plugin::APPROACHING_ERV_NOT_IN_PATH, approaching_emergency_vehicle_plugin::ERV_PASSING_IN_PATH, event(), logDebugEvent(), approaching_emergency_vehicle_plugin::MOVING_OVER_FOR_APPROACHING_ERV, approaching_emergency_vehicle_plugin::NO_APPROACHING_ERV, setAndLogState(), and approaching_emergency_vehicle_plugin::SLOWING_DOWN_FOR_ERV.
Referenced by event().
|
private |
Definition at line 109 of file approaching_emergency_vehicle_transition_table.cpp.
References approaching_emergency_vehicle_plugin::APPROACHING_ERV_IN_PATH, approaching_emergency_vehicle_plugin::APPROACHING_ERV_NOT_IN_PATH, approaching_emergency_vehicle_plugin::ERV_PASSED, approaching_emergency_vehicle_plugin::ERV_PASSING_IN_PATH, approaching_emergency_vehicle_plugin::ERV_UPDATE_TIMEOUT, event(), logDebugEvent(), approaching_emergency_vehicle_plugin::MOVING_OVER_FOR_APPROACHING_ERV, approaching_emergency_vehicle_plugin::NO_APPROACHING_ERV, setAndLogState(), and approaching_emergency_vehicle_plugin::SLOWING_DOWN_FOR_ERV.
Referenced by event().
ApproachingEmergencyVehicleState approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::getState | ( | ) | const |
Returns the current state.
Definition at line 22 of file approaching_emergency_vehicle_transition_table.cpp.
References state_.
Referenced by approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::generateApproachingErvStatusMessage(), approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::getSecondsUntilPassing(), approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::plan_maneuvers_callback(), and approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::publishHazardLightStatus().
|
private |
Helper function for logging the provide event.
event | The event to be logged |
Definition at line 143 of file approaching_emergency_vehicle_transition_table.cpp.
References event(), and state_.
Referenced by eventWhenMOVING_OVER_FOR_APPROACHING_ERV(), eventWhenNO_APPROACHING_ERV(), and eventWhenSLOWING_DOWN_FOR_ERV().
|
private |
Function to change the current state and log the details of the transition.
new_state | The state to set. |
source_event | The event which caused the new_state to be set |
Definition at line 149 of file approaching_emergency_vehicle_transition_table.cpp.
References state_, and transition_callback_.
Referenced by eventWhenMOVING_OVER_FOR_APPROACHING_ERV(), eventWhenNO_APPROACHING_ERV(), and eventWhenSLOWING_DOWN_FOR_ERV().
void approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::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 event which caused the transition. |
Definition at line 48 of file approaching_emergency_vehicle_transition_table.cpp.
References transition_callback_.
|
private |
Current state. This state should only ever be set using the setAndLogState() function.
Definition at line 65 of file approaching_emergency_vehicle_transition_table.hpp.
Referenced by event(), getState(), logDebugEvent(), and setAndLogState().
|
private |
Definition at line 67 of file approaching_emergency_vehicle_transition_table.hpp.
Referenced by setAndLogState(), and setTransitionCallback().