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 <lightbar_manager_node.hpp>
Public Member Functions | |
LightBarManager (const rclcpp::NodeOptions &) | |
std::shared_ptr< LightBarManagerWorker > | getWorker () |
Get ptr to lightbar_manager_worker (for ease of unit testing) More... | |
void | turnOffAll () |
Miscellaneous function that forces the state to disengaged and turn off all indicators. Used in special demo cases as well as when carma is disengaged. More... | |
int | setIndicator (LightBarIndicator ind, IndicatorStatus ind_status, const std::string &requester_name) |
Try to turn the given indicator ON or OFF (comm with hardware) upon the given component's request. More... | |
void | turnSignalCallback (automotive_platform_msgs::msg::TurnSignalCommand::UniquePtr msg_ptr) |
Callback function for turning signal. More... | |
carma_ros2_utils::CallbackReturn | handle_on_configure (const rclcpp_lifecycle::State &) |
carma_ros2_utils::CallbackReturn | handle_on_activate (const rclcpp_lifecycle::State &) |
Private Member Functions | |
void | processTurnSignal (const automotive_platform_msgs::msg::TurnSignalCommand &msg) |
Turn signal callback function helper. More... | |
bool | spinCallBack () |
bool | requestControlCallBack (const std::shared_ptr< rmw_request_id_t >, const std::shared_ptr< carma_msgs::srv::RequestIndicatorControl::Request > req, std::shared_ptr< carma_msgs::srv::RequestIndicatorControl::Response > resp) |
bool | releaseControlCallBack (const std::shared_ptr< rmw_request_id_t >, const std::shared_ptr< carma_msgs::srv::ReleaseIndicatorControl::Request > req, std::shared_ptr< carma_msgs::srv::ReleaseIndicatorControl::Response > resp) |
bool | setIndicatorCallBack (const std::shared_ptr< rmw_request_id_t >, const std::shared_ptr< carma_driver_msgs::srv::SetLightBarIndicator::Request > req, std::shared_ptr< carma_driver_msgs::srv::SetLightBarIndicator::Response > resp) |
void | stateChangeCallBack (carma_planning_msgs::msg::GuidanceState::UniquePtr msg_ptr) |
FRIEND_TEST (LightBarManagerNodeTest, testSetIndicator) | |
FRIEND_TEST (LightBarManagerNodeTest, testTurnOffAll) | |
FRIEND_TEST (LightBarManagerNodeTest, testTurnSignalCallback) | |
Private Attributes | |
Config | config_ |
std::string | node_name_ = "lightbar_manager" |
double | spin_rate_ = 10.0 |
std::map< lightbar_manager::LightBarIndicator, std::string > | prev_owners_before_turn_ |
carma_ros2_utils::ServicePtr< carma_msgs::srv::RequestIndicatorControl > | request_control_server_ |
carma_ros2_utils::ServicePtr< carma_msgs::srv::ReleaseIndicatorControl > | release_control_server_ |
carma_ros2_utils::ServicePtr< carma_driver_msgs::srv::SetLightBarIndicator > | set_indicator_server_ |
carma_ros2_utils::ClientPtr< carma_driver_msgs::srv::SetLights > | lightbar_driver_client_ |
carma_ros2_utils::PubPtr< carma_msgs::msg::LightBarIndicatorControllers > | indicator_control_publisher_ |
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::GuidanceState > | guidance_state_subscriber_ |
carma_ros2_utils::SubPtr< automotive_platform_msgs::msg::TurnSignalCommand > | turn_signal_subscriber_ |
std::shared_ptr< LightBarManagerWorker > | lbm_ |
rclcpp::TimerBase::SharedPtr | pub_timer_ |
Definition at line 68 of file lightbar_manager_node.hpp.
|
explicit |
Definition at line 26 of file lightbar_manager_node.cpp.
References config_, lbm_, lightbar_manager::Config::normal_operation, and lightbar_manager::Config::spin_rate_hz.
|
private |
|
private |
|
private |
std::shared_ptr< LightBarManagerWorker > LightBarManager::getWorker | ( | ) |
Get ptr to lightbar_manager_worker (for ease of unit testing)
Definition at line 329 of file lightbar_manager_node.cpp.
References lbm_.
carma_ros2_utils::CallbackReturn LightBarManager::handle_on_activate | ( | const rclcpp_lifecycle::State & | ) |
Definition at line 114 of file lightbar_manager_node.cpp.
References config_, pub_timer_, lightbar_manager::Config::spin_rate_hz, and spinCallBack().
carma_ros2_utils::CallbackReturn LightBarManager::handle_on_configure | ( | const rclcpp_lifecycle::State & | ) |
Definition at line 38 of file lightbar_manager_node.cpp.
References config_, lightbar_manager::GREEN_FLASH, lightbar_manager::GREEN_SOLID, guidance_state_subscriber_, process_bag::i, indicator_control_publisher_, INDICATOR_COUNT, lbm_, lightbar_manager::Config::lightbar_cda_table, lightbar_driver_client_, lightbar_manager::Config::lightbar_ind_table, lightbar_manager::Config::lightbar_priorities, node_name_, lightbar_manager::Config::normal_operation, lightbar_manager::OFF, release_control_server_, releaseControlCallBack(), request_control_server_, requestControlCallBack(), set_indicator_server_, setIndicatorCallBack(), lightbar_manager::Config::spin_rate_hz, stateChangeCallBack(), turn_signal_subscriber_, and turnSignalCallback().
|
private |
Turn signal callback function helper.
Definition at line 273 of file lightbar_manager_node.cpp.
References lbm_, node_name_, lightbar_manager::OFF, lightbar_manager::ON, prev_owners_before_turn_, and setIndicator().
Referenced by turnSignalCallback().
|
private |
Definition at line 204 of file lightbar_manager_node.cpp.
References INDICATOR_COUNT, and lbm_.
Referenced by handle_on_configure().
|
private |
Definition at line 152 of file lightbar_manager_node.cpp.
References INDICATOR_COUNT, and lbm_.
Referenced by handle_on_configure().
int LightBarManager::setIndicator | ( | LightBarIndicator | ind, |
IndicatorStatus | ind_status, | ||
const std::string & | requester_name | ||
) |
Try to turn the given indicator ON or OFF (comm with hardware) upon the given component's request.
Definition at line 334 of file lightbar_manager_node.cpp.
References INDICATOR_COUNT, lbm_, and lightbar_driver_client_.
Referenced by processTurnSignal(), setIndicatorCallBack(), stateChangeCallBack(), and turnOffAll().
|
private |
Definition at line 379 of file lightbar_manager_node.cpp.
References lbm_, and setIndicator().
Referenced by handle_on_configure().
|
private |
Definition at line 235 of file lightbar_manager_node.cpp.
References indicator_control_publisher_, and lbm_.
Referenced by handle_on_activate().
|
private |
Definition at line 241 of file lightbar_manager_node.cpp.
References lightbar_manager::ACTIVE, lightbar_manager::DISENGAGED, lightbar_manager::ENGAGED, lightbar_manager::GREEN_FLASH, lightbar_manager::GREEN_SOLID, lbm_, node_name_, lightbar_manager::ON, setIndicator(), and turnOffAll().
Referenced by handle_on_configure().
void LightBarManager::turnOffAll | ( | ) |
Miscellaneous function that forces the state to disengaged and turn off all indicators. Used in special demo cases as well as when carma is disengaged.
Definition at line 122 of file lightbar_manager_node.cpp.
References lightbar_manager::GREEN_FLASH, lightbar_manager::GREEN_SOLID, lbm_, node_name_, lightbar_manager::OFF, and setIndicator().
Referenced by stateChangeCallBack().
void LightBarManager::turnSignalCallback | ( | automotive_platform_msgs::msg::TurnSignalCommand::UniquePtr | msg_ptr | ) |
Callback function for turning signal.
Definition at line 268 of file lightbar_manager_node.cpp.
References processTurnSignal().
Referenced by handle_on_configure().
|
private |
Definition at line 111 of file lightbar_manager_node.hpp.
Referenced by LightBarManager(), handle_on_activate(), and handle_on_configure().
|
private |
Definition at line 149 of file lightbar_manager_node.hpp.
Referenced by handle_on_configure().
|
private |
Definition at line 146 of file lightbar_manager_node.hpp.
Referenced by handle_on_configure(), and spinCallBack().
|
private |
Definition at line 153 of file lightbar_manager_node.hpp.
Referenced by LightBarManager(), getWorker(), handle_on_configure(), processTurnSignal(), releaseControlCallBack(), requestControlCallBack(), setIndicator(), setIndicatorCallBack(), spinCallBack(), stateChangeCallBack(), and turnOffAll().
|
private |
Definition at line 143 of file lightbar_manager_node.hpp.
Referenced by handle_on_configure(), and setIndicator().
|
private |
Definition at line 120 of file lightbar_manager_node.hpp.
Referenced by handle_on_configure(), processTurnSignal(), stateChangeCallBack(), and turnOffAll().
|
private |
Definition at line 122 of file lightbar_manager_node.hpp.
Referenced by processTurnSignal().
|
private |
Definition at line 155 of file lightbar_manager_node.hpp.
Referenced by handle_on_activate().
|
private |
Definition at line 141 of file lightbar_manager_node.hpp.
Referenced by handle_on_configure().
|
private |
Definition at line 140 of file lightbar_manager_node.hpp.
Referenced by handle_on_configure().
|
private |
Definition at line 142 of file lightbar_manager_node.hpp.
Referenced by handle_on_configure().
|
private |
Definition at line 121 of file lightbar_manager_node.hpp.
|
private |
Definition at line 150 of file lightbar_manager_node.hpp.
Referenced by handle_on_configure().