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.
capabilities_interface.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 LEIDOS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16
17#ifndef __ARBITRATOR_INCLUDE_CAPABILITIES_INTERFACE_HPP__
18#define __ARBITRATOR_INCLUDE_CAPABILITIES_INTERFACE_HPP__
19
20#include <rclcpp/rclcpp.hpp>
21#include <carma_ros2_utils/carma_lifecycle_node.hpp>
22#include <vector>
23#include <map>
24#include <unordered_set>
25#include <string>
26#include <carma_planning_msgs/srv/plugin_list.hpp>
27#include <carma_planning_msgs/srv/get_plugin_api.hpp>
28#include <carma_planning_msgs/srv/plan_maneuvers.hpp>
29
30
31
32namespace arbitrator
33{
39 {
40 public:
45 CapabilitiesInterface(std::shared_ptr<carma_ros2_utils::CarmaLifecycleNode> nh): nh_(nh) {
46 sc_s_ = nh_->create_client<carma_planning_msgs::srv::GetPluginApi>("plugins/get_strategic_plugins_by_capability");
47 };
48
53 // void initialize();
54
62 std::vector<std::string> get_topics_for_capability(const std::string& query_string);
63
64
77 template<typename MSrvReq, typename MSrvRes>
78 std::map<std::string, std::shared_ptr<MSrvRes>> multiplex_service_call_for_capability(const std::string& query_string, std::shared_ptr<MSrvReq> msg);
79
80
81 const static std::string STRATEGIC_PLAN_CAPABILITY;
82 protected:
83 private:
84 std::shared_ptr<carma_ros2_utils::CarmaLifecycleNode> nh_;
85 std::unordered_map<std::string,carma_ros2_utils::ClientPtr<carma_planning_msgs::srv::PlanManeuvers>> registered_strategic_plugins_;
86
87 carma_ros2_utils::ClientPtr<carma_planning_msgs::srv::GetPluginApi> sc_s_;
88 std::unordered_set <std::string> capabilities_ ;
89
90
91
92 };
93
94}
95
96#include "capabilities_interface.tpp"
97
98#endif
Generic interface for interacting with Plugins via their capabilities instead of directly by their to...
static const std::string STRATEGIC_PLAN_CAPABILITY
std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > nh_
carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::GetPluginApi > sc_s_
std::map< std::string, std::shared_ptr< MSrvRes > > multiplex_service_call_for_capability(const std::string &query_string, std::shared_ptr< MSrvReq > msg)
Template function for calling all nodes which respond to a service associated with a particular capab...
std::unordered_set< std::string > capabilities_
std::unordered_map< std::string, carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanManeuvers > > registered_strategic_plugins_
std::vector< std::string > get_topics_for_capability(const std::string &query_string)
Initialize the Capabilities interface by querying the Health Monitor node and processing the plugins ...
CapabilitiesInterface(std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > nh)
Constructor for Capabilities interface.