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.
|
#include <port_drayage_state_machine.hpp>
Public Member Functions | |
PortDrayageStateMachine (rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger) | |
Constructor the PortDrayageStateMachine. More... | |
void | processEvent (PortDrayageEvent event) |
PortDrayageState | getState () const |
Get the current state of the state machine. More... | |
void | setOnSystemStartupCallback (const std::function< void()> &cb) |
Set the callback to be invoked upon transitioning out of the inactive state. More... | |
void | setOnReceivedNewDestinationCallback (const std::function< void()> &cb) |
Set the callback to be invoked upon transitioning into the EN_ROUTE state. More... | |
void | setOnArrivedAtDestinationCallback (const std::function< void()> &cb) |
Set the callback to be invoked upon transitioning into the AWAITING_DESTINATION state. More... | |
void | setOnDrayageCompletedCallback (const std::function< void()> &cb) |
Set the callback to be invoked upon transitioning into the inactive state. More... | |
Private Attributes | |
PortDrayageState | state_ |
std::function< void()> | on_system_startup_ |
std::function< void()> | on_received_new_destination_ |
std::function< void()> | on_arrived_at_destination_ |
std::function< void()> | on_drayage_completed_ |
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr | logger_ |
\Brief An implementation of the state machine for the PortDrayagePlugin.
The state machine accepts events as inputs which drive the internal state changes. This state can be queried at any given point in time, but also each transition into a state has an associated callback which will be invoked when that state is entered.
Definition at line 71 of file port_drayage_state_machine.hpp.
|
inline |
Constructor the PortDrayageStateMachine.
The system initially starts in INACTIVE state.
Definition at line 89 of file port_drayage_state_machine.hpp.
PortDrayageState port_drayage_plugin::PortDrayageStateMachine::getState | ( | ) | const |
Get the current state of the state machine.
Definition at line 59 of file port_drayage_state_machine.cpp.
References state_.
Referenced by port_drayage_plugin::PortDrayageWorker::composeArrivalMessage(), port_drayage_plugin::PortDrayageWorker::getPortDrayageState(), port_drayage_plugin::PortDrayageWorker::onGuidanceState(), and port_drayage_plugin::PortDrayageWorker::onRouteEvent().
void port_drayage_plugin::PortDrayageStateMachine::processEvent | ( | PortDrayageEvent | event | ) |
\Brief Inform the state machine that an event has transpired.
event | The event that took place. |
Definition at line 21 of file port_drayage_state_machine.cpp.
References port_drayage_plugin::ARRIVED_AT_DESTINATION, port_drayage_plugin::AWAITING_DIRECTION, port_drayage_plugin::DRAYAGE_START, port_drayage_plugin::EN_ROUTE_TO_INITIAL_DESTINATION, port_drayage_plugin::EN_ROUTE_TO_RECEIVED_DESTINATION, port_drayage_plugin::INACTIVE, logger_, on_arrived_at_destination_, on_received_new_destination_, port_drayage_plugin::RECEIVED_NEW_DESTINATION, and state_.
Referenced by port_drayage_plugin::PortDrayageWorker::onGuidanceState(), port_drayage_plugin::PortDrayageWorker::onInboundMobilityOperation(), and port_drayage_plugin::PortDrayageWorker::onRouteEvent().
void port_drayage_plugin::PortDrayageStateMachine::setOnArrivedAtDestinationCallback | ( | const std::function< void()> & | cb | ) |
Set the callback to be invoked upon transitioning into the AWAITING_DESTINATION state.
cb | The std::function callback object |
Definition at line 71 of file port_drayage_state_machine.cpp.
References on_arrived_at_destination_.
Referenced by port_drayage_plugin::PortDrayageWorker::PortDrayageWorker().
void port_drayage_plugin::PortDrayageStateMachine::setOnDrayageCompletedCallback | ( | const std::function< void()> & | cb | ) |
Set the callback to be invoked upon transitioning into the inactive state.
cb | The std::function callback object |
Definition at line 75 of file port_drayage_state_machine.cpp.
References on_drayage_completed_.
void port_drayage_plugin::PortDrayageStateMachine::setOnReceivedNewDestinationCallback | ( | const std::function< void()> & | cb | ) |
Set the callback to be invoked upon transitioning into the EN_ROUTE state.
cb | The std::function callback object |
Definition at line 67 of file port_drayage_state_machine.cpp.
References on_received_new_destination_.
Referenced by port_drayage_plugin::PortDrayageWorker::PortDrayageWorker().
void port_drayage_plugin::PortDrayageStateMachine::setOnSystemStartupCallback | ( | const std::function< void()> & | cb | ) |
Set the callback to be invoked upon transitioning out of the inactive state.
cb | The std::function callback object |
Definition at line 63 of file port_drayage_state_machine.cpp.
References on_system_startup_.
|
private |
Definition at line 81 of file port_drayage_state_machine.hpp.
Referenced by processEvent().
|
private |
Definition at line 77 of file port_drayage_state_machine.hpp.
Referenced by processEvent(), and setOnArrivedAtDestinationCallback().
|
private |
Definition at line 78 of file port_drayage_state_machine.hpp.
Referenced by setOnDrayageCompletedCallback().
|
private |
Definition at line 76 of file port_drayage_state_machine.hpp.
Referenced by processEvent(), and setOnReceivedNewDestinationCallback().
|
private |
Definition at line 75 of file port_drayage_state_machine.hpp.
Referenced by setOnSystemStartupCallback().
|
private |
Definition at line 74 of file port_drayage_state_machine.hpp.
Referenced by getState(), and processEvent().