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.
|
A base class for all subsystem_controllers which provides default lifecycle behavior for subsystems. More...
#include <base_subsystem_controller.hpp>
Public Member Functions | |
BaseSubsystemController ()=delete | |
BaseSubsystemController (const rclcpp::NodeOptions &options) | |
Constructor. Set explicitly to support node composition. More... | |
~BaseSubsystemController ()=default | |
void | set_config (BaseSubSystemControllerConfig config) |
virtual void | on_system_alert (const carma_msgs::msg::SystemAlert::UniquePtr msg) |
virtual carma_ros2_utils::CallbackReturn | handle_on_configure (const rclcpp_lifecycle::State &prev_state) |
virtual carma_ros2_utils::CallbackReturn | handle_on_activate (const rclcpp_lifecycle::State &prev_state) |
virtual carma_ros2_utils::CallbackReturn | handle_on_deactivate (const rclcpp_lifecycle::State &prev_state) |
virtual carma_ros2_utils::CallbackReturn | handle_on_cleanup (const rclcpp_lifecycle::State &prev_state) |
virtual carma_ros2_utils::CallbackReturn | handle_on_error (const rclcpp_lifecycle::State &prev_state, const std::string &exception_string) |
virtual carma_ros2_utils::CallbackReturn | handle_on_shutdown (const rclcpp_lifecycle::State &prev_state) |
Protected Member Functions | |
std::vector< std::string > | get_nodes_in_namespace (const std::string &node_namespace) const |
Returns the list of fully qualified node names for all ROS2 nodes in the provided namespace. More... | |
std::vector< std::string > | get_non_intersecting_set (const std::vector< std::string > &set_a, const std::vector< std::string > &set_b) const |
Returns all elements of the provided set_a which are NOT contained in the provided set_b. More... | |
Protected Attributes | |
ros2_lifecycle_manager::Ros2LifecycleManager | lifecycle_mgr_ |
Lifecycle Manager which will track the managed nodes and call their lifecycle services on request. More... | |
rclcpp::Subscription< carma_msgs::msg::SystemAlert >::SharedPtr | system_alert_sub_ |
The subscriber for the system alert topic. More... | |
BaseSubSystemControllerConfig | base_config_ |
The configuration struct. More... | |
bool | trigger_managed_nodes_configure_from_base_class_ = true |
Collection of flags which, if true, will cause the base class to make lifecycle service calls to managed nodes. More... | |
bool | trigger_managed_nodes_activate_from_base_class_ = true |
bool | trigger_managed_nodes_deactivate_from_base_class_ = true |
bool | trigger_managed_nodes_cleanup_from_base_class_ = true |
A base class for all subsystem_controllers which provides default lifecycle behavior for subsystems.
The default behavior which is provided is as follows
Definition at line 39 of file base_subsystem_controller.hpp.
|
delete |
|
explicit |
Constructor. Set explicitly to support node composition.
options | The node options to use for configuring this node |
Definition at line 27 of file base_subsystem_controller.cpp.
References base_config_, subsystem_controllers::BaseSubSystemControllerConfig::call_timeout_ms, subsystem_controllers::BaseSubSystemControllerConfig::full_subsystem_required, subsystem_controllers::BaseSubSystemControllerConfig::required_subsystem_nodes, subsystem_controllers::BaseSubSystemControllerConfig::service_timeout_ms, subsystem_controllers::BaseSubSystemControllerConfig::subsystem_namespace, and subsystem_controllers::BaseSubSystemControllerConfig::unmanaged_required_nodes.
|
default |
|
protected |
Returns the list of fully qualified node names for all ROS2 nodes in the provided namespace.
node_namespace | The ros namespace to get all nodes within. For example /guidance |
Definition at line 279 of file base_subsystem_controller.cpp.
References process_traj_logs::split.
Referenced by handle_on_configure().
|
protected |
Returns all elements of the provided set_a which are NOT contained in the provided set_b.
set_a The set of strings which will have its intersection checked against
set_b The set of strings which will NOT be in the returned set
Definition at line 356 of file base_subsystem_controller.cpp.
Referenced by subsystem_controllers::GuidanceControllerNode::handle_on_configure(), handle_on_configure(), and subsystem_controllers::DriversControllerNode::handle_on_configure().
|
virtual |
Reimplemented in subsystem_controllers::GuidanceControllerNode, and subsystem_controllers::DriversControllerNode.
Definition at line 167 of file base_subsystem_controller.cpp.
References base_config_, subsystem_controllers::BaseSubSystemControllerConfig::call_timeout_ms, lifecycle_mgr_, subsystem_controllers::BaseSubSystemControllerConfig::service_timeout_ms, and trigger_managed_nodes_activate_from_base_class_.
Referenced by subsystem_controllers::GuidanceControllerNode::handle_on_activate(), and subsystem_controllers::DriversControllerNode::handle_on_activate().
|
virtual |
Reimplemented in subsystem_controllers::GuidanceControllerNode.
Definition at line 215 of file base_subsystem_controller.cpp.
References base_config_, subsystem_controllers::BaseSubSystemControllerConfig::call_timeout_ms, lifecycle_mgr_, subsystem_controllers::BaseSubSystemControllerConfig::service_timeout_ms, and trigger_managed_nodes_cleanup_from_base_class_.
Referenced by subsystem_controllers::GuidanceControllerNode::handle_on_cleanup().
|
virtual |
Reimplemented in subsystem_controllers::GuidanceControllerNode, subsystem_controllers::DriversControllerNode, and subsystem_controllers::LocalizationControllerNode.
Definition at line 92 of file base_subsystem_controller.cpp.
References base_config_, subsystem_controllers::BaseSubSystemControllerConfig::call_timeout_ms, subsystem_controllers::BaseSubSystemControllerConfig::full_subsystem_required, get_nodes_in_namespace(), get_non_intersecting_set(), lifecycle_mgr_, on_system_alert(), subsystem_controllers::BaseSubSystemControllerConfig::required_subsystem_nodes, subsystem_controllers::BaseSubSystemControllerConfig::service_timeout_ms, subsystem_controllers::BaseSubSystemControllerConfig::subsystem_namespace, system_alert_sub_, trigger_managed_nodes_configure_from_base_class_, and subsystem_controllers::BaseSubSystemControllerConfig::unmanaged_required_nodes.
Referenced by subsystem_controllers::GuidanceControllerNode::handle_on_configure(), subsystem_controllers::DriversControllerNode::handle_on_configure(), and subsystem_controllers::LocalizationControllerNode::handle_on_configure().
|
virtual |
Reimplemented in subsystem_controllers::GuidanceControllerNode.
Definition at line 191 of file base_subsystem_controller.cpp.
References base_config_, subsystem_controllers::BaseSubSystemControllerConfig::call_timeout_ms, lifecycle_mgr_, subsystem_controllers::BaseSubSystemControllerConfig::service_timeout_ms, and trigger_managed_nodes_deactivate_from_base_class_.
Referenced by subsystem_controllers::GuidanceControllerNode::handle_on_deactivate().
|
virtual |
Definition at line 239 of file base_subsystem_controller.cpp.
References base_config_, subsystem_controllers::BaseSubSystemControllerConfig::call_timeout_ms, lifecycle_mgr_, and subsystem_controllers::BaseSubSystemControllerConfig::service_timeout_ms.
|
virtual |
Reimplemented in subsystem_controllers::GuidanceControllerNode.
Definition at line 259 of file base_subsystem_controller.cpp.
References base_config_, subsystem_controllers::BaseSubSystemControllerConfig::call_timeout_ms, lifecycle_mgr_, and subsystem_controllers::BaseSubSystemControllerConfig::service_timeout_ms.
Referenced by subsystem_controllers::GuidanceControllerNode::handle_on_shutdown().
|
virtual |
Reimplemented in subsystem_controllers::LocalizationControllerNode.
Definition at line 55 of file base_subsystem_controller.cpp.
References base_config_, subsystem_controllers::BaseSubSystemControllerConfig::required_subsystem_nodes, subsystem_controllers::BaseSubSystemControllerConfig::subsystem_namespace, and subsystem_controllers::BaseSubSystemControllerConfig::unmanaged_required_nodes.
Referenced by handle_on_configure(), and subsystem_controllers::LocalizationControllerNode::on_system_alert().
void subsystem_controllers::BaseSubsystemController::set_config | ( | BaseSubSystemControllerConfig | config | ) |
Definition at line 50 of file base_subsystem_controller.cpp.
References base_config_.
|
protected |
The configuration struct.
Definition at line 96 of file base_subsystem_controller.hpp.
Referenced by BaseSubsystemController(), handle_on_activate(), handle_on_cleanup(), subsystem_controllers::GuidanceControllerNode::handle_on_configure(), handle_on_configure(), subsystem_controllers::DriversControllerNode::handle_on_configure(), handle_on_deactivate(), handle_on_error(), handle_on_shutdown(), on_system_alert(), and set_config().
|
protected |
Lifecycle Manager which will track the managed nodes and call their lifecycle services on request.
Definition at line 90 of file base_subsystem_controller.hpp.
Referenced by handle_on_activate(), handle_on_cleanup(), subsystem_controllers::GuidanceControllerNode::handle_on_configure(), handle_on_configure(), subsystem_controllers::DriversControllerNode::handle_on_configure(), handle_on_deactivate(), handle_on_error(), and handle_on_shutdown().
|
protected |
The subscriber for the system alert topic.
Definition at line 93 of file base_subsystem_controller.hpp.
Referenced by handle_on_configure().
|
protected |
Definition at line 105 of file base_subsystem_controller.hpp.
Referenced by handle_on_activate().
|
protected |
Definition at line 107 of file base_subsystem_controller.hpp.
Referenced by handle_on_cleanup().
|
protected |
Collection of flags which, if true, will cause the base class to make lifecycle service calls to managed nodes.
Definition at line 104 of file base_subsystem_controller.hpp.
Referenced by subsystem_controllers::DriversControllerNode::DriversControllerNode(), subsystem_controllers::GuidanceControllerNode::GuidanceControllerNode(), subsystem_controllers::DriversControllerNode::handle_on_activate(), and handle_on_configure().
|
protected |
Definition at line 106 of file base_subsystem_controller.hpp.
Referenced by handle_on_deactivate().