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 LocalizationManager. More...
#include <LocalizationTransitionTable.hpp>
Public Types | |
using | TransitionCallback = std::function< void(LocalizationState prev_state, LocalizationState new_state, LocalizationSignal signal)> |
Public Member Functions | |
LocalizationTransitionTable (LocalizerMode mode) | |
Constructor. More... | |
LocalizationState | getState () const |
Returns the current state. More... | |
void | signal (LocalizationSignal 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 | signalWhenUNINITIALIZED (LocalizationSignal signal) |
void | signalWhenINITIALIZING (LocalizationSignal signal) |
void | signalWhenOPERATIONAL (LocalizationSignal signal) |
void | signalWhenDEGRADED (LocalizationSignal signal) |
void | signalWhenDEGRADED_NO_LIDAR_FIX (LocalizationSignal signal) |
void | signalWhenAWAIT_MANUAL_INITIALIZATION (LocalizationSignal signal) |
void | logDebugSignal (LocalizationSignal signal) const |
Helper function for logging the provide signal. More... | |
void | setAndLogState (LocalizationState new_state, LocalizationSignal source_signal) |
Function to change the current state and log the details of the transition. More... | |
Private Attributes | |
LocalizationState | state_ = LocalizationState::UNINITIALIZED |
Current state. This state should only ever be set using the setAndLogState() function. More... | |
LocalizerMode | mode_ = LocalizerMode::AUTO_WITHOUT_TIMEOUT |
TransitionCallback | transition_callback_ |
Class defining the state transition table behavior for the LocalizationManager.
Definition at line 26 of file LocalizationTransitionTable.hpp.
using localization_manager::LocalizationTransitionTable::TransitionCallback = std::function<void(LocalizationState prev_state, LocalizationState new_state, LocalizationSignal signal)> |
Definition at line 29 of file LocalizationTransitionTable.hpp.
localization_manager::LocalizationTransitionTable::LocalizationTransitionTable | ( | LocalizerMode | mode | ) |
Constructor.
mode | Defines the operational mode of the state machine which modifies some of the state transitions |
Definition at line 22 of file LocalizationTransitionTable.cpp.
LocalizationState localization_manager::LocalizationTransitionTable::getState | ( | ) | const |
Returns the current state.
Definition at line 24 of file LocalizationTransitionTable.cpp.
References state_.
Referenced by localization_manager::LocalizationManager::getState(), localization_manager::LocalizationManager::gnssPoseCallback(), localization_manager::LocalizationManager::poseAndStatsCallback(), localization_manager::LocalizationManager::posePubTick(), and localization_manager::LocalizationManager::timerCallback().
|
private |
Helper function for logging the provide signal.
signal | The signal to be logged |
Definition at line 29 of file LocalizationTransitionTable.cpp.
References signal(), and state_.
Referenced by signalWhenAWAIT_MANUAL_INITIALIZATION(), signalWhenDEGRADED(), signalWhenDEGRADED_NO_LIDAR_FIX(), signalWhenINITIALIZING(), signalWhenOPERATIONAL(), and signalWhenUNINITIALIZED().
|
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 34 of file LocalizationTransitionTable.cpp.
References mode_, state_, and transition_callback_.
Referenced by signalWhenAWAIT_MANUAL_INITIALIZATION(), signalWhenDEGRADED(), signalWhenDEGRADED_NO_LIDAR_FIX(), signalWhenINITIALIZING(), signalWhenOPERATIONAL(), and signalWhenUNINITIALIZED().
void localization_manager::LocalizationTransitionTable::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 247 of file LocalizationTransitionTable.cpp.
References transition_callback_.
Referenced by localization_manager::LocalizationManager::LocalizationManager().
void localization_manager::LocalizationTransitionTable::signal | ( | LocalizationSignal | signal | ) |
Trigger signal for the transition table.
signal | The signal for the transition table to evaluate |
Definition at line 219 of file LocalizationTransitionTable.cpp.
References localization_manager::AWAIT_MANUAL_INITIALIZATION, localization_manager::DEGRADED, localization_manager::DEGRADED_NO_LIDAR_FIX, localization_manager::INITIALIZING, localization_manager::OPERATIONAL, signal(), signalWhenAWAIT_MANUAL_INITIALIZATION(), signalWhenDEGRADED(), signalWhenDEGRADED_NO_LIDAR_FIX(), signalWhenINITIALIZING(), signalWhenOPERATIONAL(), signalWhenUNINITIALIZED(), state_, and localization_manager::UNINITIALIZED.
Referenced by localization_manager::LocalizationManager::gnssPoseCallback(), localization_manager::LocalizationManager::initialPoseCallback(), logDebugSignal(), localization_manager::LocalizationManager::poseAndStatsCallback(), localization_manager::LocalizationManager::posePubTick(), signal(), signalWhenAWAIT_MANUAL_INITIALIZATION(), signalWhenDEGRADED(), signalWhenDEGRADED_NO_LIDAR_FIX(), signalWhenINITIALIZING(), signalWhenOPERATIONAL(), signalWhenUNINITIALIZED(), localization_manager::LocalizationManager::systemAlertCallback(), and localization_manager::LocalizationManager::timerCallback().
|
private |
Definition at line 199 of file LocalizationTransitionTable.cpp.
References localization_manager::DEGRADED_NO_LIDAR_FIX, localization_manager::GNSS, localization_manager::GNSS_WITH_FIXED_OFFSET, localization_manager::INITIAL_POSE, localization_manager::INITIALIZING, logDebugSignal(), mode_, setAndLogState(), and signal().
Referenced by signal().
|
private |
Definition at line 133 of file LocalizationTransitionTable.cpp.
References localization_manager::AUTO_WITH_TIMEOUT, localization_manager::AUTO_WITHOUT_TIMEOUT, localization_manager::AWAIT_MANUAL_INITIALIZATION, localization_manager::DEGRADED_NO_LIDAR_FIX, localization_manager::GOOD_NDT_FREQ_AND_FITNESS_SCORE, localization_manager::INITIAL_POSE, localization_manager::INITIALIZING, localization_manager::LIDAR_SENSOR_FAILURE, logDebugSignal(), mode_, localization_manager::OPERATIONAL, setAndLogState(), signal(), and localization_manager::UNUSABLE_NDT_FREQ_OR_FITNESS_SCORE.
Referenced by signal().
|
private |
Definition at line 169 of file LocalizationTransitionTable.cpp.
References localization_manager::AUTO_WITHOUT_TIMEOUT, localization_manager::AWAIT_MANUAL_INITIALIZATION, localization_manager::GNSS, localization_manager::GNSS_DATA_TIMEOUT, localization_manager::GNSS_WITH_FIXED_OFFSET, localization_manager::GNSS_WITH_NDT_INIT, localization_manager::GOOD_NDT_FREQ_AND_FITNESS_SCORE, localization_manager::INITIAL_POSE, localization_manager::INITIALIZING, logDebugSignal(), mode_, localization_manager::OPERATIONAL, setAndLogState(), signal(), and localization_manager::TIMEOUT.
Referenced by signal().
|
private |
Definition at line 70 of file LocalizationTransitionTable.cpp.
References localization_manager::AWAIT_MANUAL_INITIALIZATION, localization_manager::DEGRADED, localization_manager::DEGRADED_NO_LIDAR_FIX, localization_manager::GOOD_NDT_FREQ_AND_FITNESS_SCORE, localization_manager::LIDAR_SENSOR_FAILURE, logDebugSignal(), mode_, localization_manager::NDT, localization_manager::OPERATIONAL, localization_manager::POOR_NDT_FREQ_OR_FITNESS_SCORE, setAndLogState(), signal(), and localization_manager::TIMEOUT.
Referenced by signal().
|
private |
Definition at line 100 of file LocalizationTransitionTable.cpp.
References localization_manager::AUTO_WITH_TIMEOUT, localization_manager::AUTO_WITHOUT_TIMEOUT, localization_manager::AWAIT_MANUAL_INITIALIZATION, localization_manager::DEGRADED, localization_manager::DEGRADED_NO_LIDAR_FIX, localization_manager::GNSS_WITH_NDT_INIT, localization_manager::INITIAL_POSE, localization_manager::INITIALIZING, localization_manager::LIDAR_INITIALIZED_SWITCH_TO_GPS, localization_manager::LIDAR_SENSOR_FAILURE, logDebugSignal(), mode_, localization_manager::POOR_NDT_FREQ_OR_FITNESS_SCORE, setAndLogState(), signal(), and localization_manager::UNUSABLE_NDT_FREQ_OR_FITNESS_SCORE.
Referenced by signal().
|
private |
Definition at line 50 of file LocalizationTransitionTable.cpp.
References localization_manager::DEGRADED_NO_LIDAR_FIX, localization_manager::GNSS, localization_manager::GNSS_WITH_FIXED_OFFSET, localization_manager::INITIAL_POSE, localization_manager::INITIALIZING, logDebugSignal(), mode_, setAndLogState(), and signal().
Referenced by signal().
|
private |
Definition at line 65 of file LocalizationTransitionTable.hpp.
Referenced by setAndLogState(), signalWhenAWAIT_MANUAL_INITIALIZATION(), signalWhenDEGRADED(), signalWhenDEGRADED_NO_LIDAR_FIX(), signalWhenINITIALIZING(), signalWhenOPERATIONAL(), and signalWhenUNINITIALIZED().
|
private |
Current state. This state should only ever be set using the setAndLogState() function.
Definition at line 63 of file LocalizationTransitionTable.hpp.
Referenced by getState(), logDebugSignal(), setAndLogState(), and signal().
|
private |
Definition at line 67 of file LocalizationTransitionTable.hpp.
Referenced by setAndLogState(), and setTransitionCallback().