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 <guidance_state_machine.hpp>
Public Types | |
enum | Signal { INITIALIZED = 0 , ACTIVATED = 1 , ENGAGE = 2 , DISENGAGED = 3 , SHUTDOWN = 4 , OVERRIDE = 5 , PARK = 6 } |
enum | State { OFF = 0 , STARTUP = 1 , DRIVERS_READY = 2 , ACTIVE = 3 , ENGAGED = 4 , INACTIVE = 5 , ENTER_PARK = 6 } |
Public Member Functions | |
GuidanceStateMachine (rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger) | |
constructor for GuidanceStateMachine More... | |
void | onVehicleStatus (autoware_msgs::msg::VehicleStatus::UniquePtr msg) |
Handle vehicle status message from ROS network. More... | |
void | onGuidanceInitialized () |
Updates Guidance State Machine with INITIALIZED signal. More... | |
void | onGuidanceShutdown () |
Updates Guidance State Machine with SHUTDOWN signal. More... | |
void | onSetGuidanceActive (bool msg) |
Handle set_guidance_active service call from ROS network. More... | |
void | onRoboticStatus (carma_driver_msgs::msg::RobotEnabled::UniquePtr msg) |
Handle robotic_status message from ROS network. More... | |
void | onRouteEvent (carma_planning_msgs::msg::RouteEvent::UniquePtr msg) |
Handle route event message. More... | |
bool | shouldCallSetEnableRobotic () |
Indicate if SetEnableRobotic needs to be called in ACTIVE state. More... | |
uint8_t | getCurrentState () |
Get current state machine status. More... | |
Private Member Functions | |
void | onGuidanceSignal (Signal signal) |
Actual state machine logic driven by signal enum. More... | |
Private Attributes | |
State | current_guidance_state_ {State::STARTUP} |
bool | robotic_active_status_ {false} |
bool | called_robotic_engage_in_active_ {false} |
double | current_velocity_ = 0.0 |
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr | logger_ |
Definition at line 28 of file guidance_state_machine.hpp.
Enumerator | |
---|---|
INITIALIZED | |
ACTIVATED | |
ENGAGE | |
DISENGAGED | |
SHUTDOWN | |
OVERRIDE | |
PARK |
Definition at line 32 of file guidance_state_machine.hpp.
Enumerator | |
---|---|
OFF | |
STARTUP | |
DRIVERS_READY | |
ACTIVE | |
ENGAGED | |
INACTIVE | |
ENTER_PARK |
Definition at line 43 of file guidance_state_machine.hpp.
guidance::GuidanceStateMachine::GuidanceStateMachine | ( | rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr | logger | ) |
constructor for GuidanceStateMachine
logger | The logger interface that will be used by this object |
Definition at line 21 of file guidance_state_machine.cpp.
uint8_t guidance::GuidanceStateMachine::getCurrentState | ( | ) |
Get current state machine status.
Definition at line 157 of file guidance_state_machine.cpp.
References current_guidance_state_.
Referenced by guidance::GuidanceWorker::guidance_activation_cb(), and guidance::GuidanceWorker::spin_cb().
void guidance::GuidanceStateMachine::onGuidanceInitialized | ( | ) |
Updates Guidance State Machine with INITIALIZED signal.
Definition at line 103 of file guidance_state_machine.cpp.
References onGuidanceSignal().
Referenced by guidance::GuidanceWorker::handle_on_activate().
void guidance::GuidanceStateMachine::onGuidanceShutdown | ( | ) |
Updates Guidance State Machine with SHUTDOWN signal.
Definition at line 108 of file guidance_state_machine.cpp.
References onGuidanceSignal(), and arbitrator::SHUTDOWN.
Referenced by guidance::GuidanceWorker::handle_on_shutdown().
|
private |
Actual state machine logic driven by signal enum.
Definition at line 24 of file guidance_state_machine.cpp.
References lightbar_manager::ACTIVE, current_guidance_state_, lightbar_manager::DISENGAGED, lightbar_manager::ENGAGED, port_drayage_plugin::INACTIVE, lightbar_manager::OFF, and arbitrator::SHUTDOWN.
Referenced by onGuidanceInitialized(), onGuidanceShutdown(), onRoboticStatus(), onRouteEvent(), onSetGuidanceActive(), and onVehicleStatus().
void guidance::GuidanceStateMachine::onRoboticStatus | ( | carma_driver_msgs::msg::RobotEnabled::UniquePtr | msg | ) |
Handle robotic_status message from ROS network.
Definition at line 125 of file guidance_state_machine.cpp.
References onGuidanceSignal(), and robotic_active_status_.
Referenced by guidance::GuidanceWorker::robot_status_cb().
void guidance::GuidanceStateMachine::onRouteEvent | ( | carma_planning_msgs::msg::RouteEvent::UniquePtr | msg | ) |
Handle route event message.
Definition at line 141 of file guidance_state_machine.cpp.
References current_velocity_, lightbar_manager::DISENGAGED, logger_, and onGuidanceSignal().
Referenced by guidance::GuidanceWorker::route_event_cb().
void guidance::GuidanceStateMachine::onSetGuidanceActive | ( | bool | msg | ) |
Handle set_guidance_active service call from ROS network.
Definition at line 113 of file guidance_state_machine.cpp.
References lightbar_manager::DISENGAGED, and onGuidanceSignal().
Referenced by guidance::GuidanceWorker::guidance_activation_cb().
void guidance::GuidanceStateMachine::onVehicleStatus | ( | autoware_msgs::msg::VehicleStatus::UniquePtr | msg | ) |
Handle vehicle status message from ROS network.
Definition at line 88 of file guidance_state_machine.cpp.
References current_guidance_state_, current_velocity_, and onGuidanceSignal().
Referenced by guidance::GuidanceWorker::vehicle_status_cb().
bool guidance::GuidanceStateMachine::shouldCallSetEnableRobotic | ( | ) |
Indicate if SetEnableRobotic needs to be called in ACTIVE state.
Definition at line 162 of file guidance_state_machine.cpp.
References ACTIVE, called_robotic_engage_in_active_, and current_guidance_state_.
Referenced by guidance::GuidanceWorker::spin_cb().
|
private |
Definition at line 114 of file guidance_state_machine.hpp.
Referenced by shouldCallSetEnableRobotic().
|
private |
Definition at line 108 of file guidance_state_machine.hpp.
Referenced by getCurrentState(), onGuidanceSignal(), onVehicleStatus(), and shouldCallSetEnableRobotic().
|
private |
Definition at line 117 of file guidance_state_machine.hpp.
Referenced by onRouteEvent(), and onVehicleStatus().
|
private |
Definition at line 120 of file guidance_state_machine.hpp.
Referenced by onRouteEvent().
|
private |
Definition at line 111 of file guidance_state_machine.hpp.
Referenced by onRoboticStatus().