19#include <carma_planning_msgs/msg/plugin.hpp>
20#include <carma_planning_msgs/srv/get_plugin_api.hpp>
21#include <carma_planning_msgs/srv/plugin_list.hpp>
22#include <carma_planning_msgs/srv/plugin_activation.hpp>
23#include <ros2_lifecycle_manager/lifecycle_manager_interface.hpp>
24#include <unordered_set>
39 using SrvHeader =
const std::shared_ptr<rmw_request_id_t>;
43 using ServiceNamesAndTypesFunc = std::function<std::map<std::string, std::vector<std::string, std::allocator<std::string>>>(
const std::string &,
const std::string &)>;
65 PluginManager(
const std::vector<std::string>& required_plugins,
66 const std::vector<std::string>& auto_activated_plugins,
67 std::shared_ptr<ros2_lifecycle_manager::LifecycleManagerInterface> plugin_lifecycle_mgr,
70 std::chrono::nanoseconds service_timeout, std::chrono::nanoseconds call_timeout);
98 void get_registered_plugins(
SrvHeader, carma_planning_msgs::srv::PluginList::Request::SharedPtr req, carma_planning_msgs::srv::PluginList::Response::SharedPtr res);
107 void get_active_plugins(
SrvHeader, carma_planning_msgs::srv::PluginList::Request::SharedPtr req, carma_planning_msgs::srv::PluginList::Response::SharedPtr res);
116 void activate_plugin(
SrvHeader, carma_planning_msgs::srv::PluginActivation::Request::SharedPtr req, carma_planning_msgs::srv::PluginActivation::Response::SharedPtr res);
178 bool matching_capability(
const std::vector<std::string>& base_capability_levels,
const std::vector<std::string>& compared_capability_levels);
An entry manager keeps track of the set of entries and makes it easy to add or remove entries.
The PluginManager serves as a component to manage CARMA Guidance Plugins via their ros2 lifecycle int...
std::shared_ptr< ros2_lifecycle_manager::LifecycleManagerInterface > plugin_lifecycle_mgr_
Lifecycle Manager which will track the plugin nodes and call their lifecycle services on request.
void add_plugin(const Entry &plugin)
Add the specified entry to our plugin management This function will attempt to move the newly detecte...
void get_control_plugins_by_capability(SrvHeader, carma_planning_msgs::srv::GetPluginApi::Request::SharedPtr req, carma_planning_msgs::srv::GetPluginApi::Response::SharedPtr res)
Get control plugins by capability.
PluginManager(const std::vector< std::string > &required_plugins, const std::vector< std::string > &auto_activated_plugins, std::shared_ptr< ros2_lifecycle_manager::LifecycleManagerInterface > plugin_lifecycle_mgr, GetParentNodeStateFunc get_parent_state_func, ServiceNamesAndTypesFunc get_service_names_and_types_func, std::chrono::nanoseconds service_timeout, std::chrono::nanoseconds call_timeout)
Constructor for PluginManager.
std::unordered_set< std::string > auto_activated_plugins_
Set of use specified auto activated plugins which will automatically started without need for user in...
const std::string plan_trajectory_suffix_
Base service name of plan_trajectory service.
std::unordered_set< std::string > required_plugins_
Set of required plugins a failure of which necessitates system shutdown.
const std::string plan_maneuvers_suffix_
Base service name of plan_trajectory service.
bool matching_capability(const std::vector< std::string > &base_capability_levels, const std::vector< std::string > &compared_capability_levels)
Returns true if the provided base capability hierarchy can achieve the requested capability hierarchy...
std::chrono::nanoseconds call_timeout_
The timeout for service calls to return.
void get_registered_plugins(SrvHeader, carma_planning_msgs::srv::PluginList::Request::SharedPtr req, carma_planning_msgs::srv::PluginList::Response::SharedPtr res)
Returns the list of known plugins.
GetParentNodeStateFunc get_parent_state_func_
Callback to retrieve the lifecycle state of the parent process.
void update_plugin_status(carma_planning_msgs::msg::Plugin::UniquePtr msg)
Update the status of a certain plugin.
void get_active_plugins(SrvHeader, carma_planning_msgs::srv::PluginList::Request::SharedPtr req, carma_planning_msgs::srv::PluginList::Response::SharedPtr res)
Get the list of currently active plugins.
std::chrono::nanoseconds service_timeout_
The timeout for services to be available.
void get_strategic_plugins_by_capability(SrvHeader, carma_planning_msgs::srv::GetPluginApi::Request::SharedPtr req, carma_planning_msgs::srv::GetPluginApi::Response::SharedPtr res)
Get strategic plugins by capability.
void get_tactical_plugins_by_capability(SrvHeader, carma_planning_msgs::srv::GetPluginApi::Request::SharedPtr req, carma_planning_msgs::srv::GetPluginApi::Response::SharedPtr res)
Get tactical plugins by capability.
void activate_plugin(SrvHeader, carma_planning_msgs::srv::PluginActivation::Request::SharedPtr req, carma_planning_msgs::srv::PluginActivation::Response::SharedPtr res)
Activate the specified plugin.
ServiceNamesAndTypesFunc get_service_names_and_types_func_
Callback to get service names and types for the given node.
bool is_ros2_lifecycle_node(const std::string &node)
Returns true if the specified fully qualified node name is a ROS2 lifecycle node.
EntryManager em_
Entry manager to keep track of detected plugins.
const std::string control_trajectory_suffix_
Base topic name of control plugin trajectory input topic.
std::function< uint8_t()> GetParentNodeStateFunc
std::function< std::map< std::string, std::vector< std::string, std::allocator< std::string > > >(const std::string &, const std::string &)> ServiceNamesAndTypesFunc
Function which will return a map of service names and their message types based on the provided base ...
const std::shared_ptr< rmw_request_id_t > SrvHeader
An entry represents a driver details for the purposes of tracking.