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.
platoon_strategic_plugin_node_ihp.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021-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/*
18 * Originally Developed for ROS1 by the UCLA Mobility Lab, 10/20/2021.
19 *
20 * Creator: Xu Han
21 * Author: Xu Han, Xin Xia, Jiaqi Ma
22 *
23 * 8/15/2022: Ported to ROS2
24 */
25
26#pragma once
27
28#include <rclcpp/rclcpp.hpp>
29#include <functional>
30#include <carma_planning_msgs/msg/plugin.hpp>
31#include <carma_planning_msgs/srv/plan_trajectory.hpp>
32#include <carma_v2x_msgs/msg/mobility_response.hpp>
33#include <carma_v2x_msgs/msg/mobility_request.hpp>
34#include <carma_v2x_msgs/msg/mobility_operation.hpp>
35#include <carma_planning_msgs/msg/platooning_info.hpp>
36#include <std_msgs/msg/string.hpp>
38#include <functional>
39
41
43#include "platoon_config_ihp.h"
44
46{
47
52 {
53
54 private:
55
56 // Publishers
57 carma_ros2_utils::PubPtr<carma_planning_msgs::msg::PlatooningInfo> platoon_info_pub;
58 carma_ros2_utils::PubPtr<carma_v2x_msgs::msg::MobilityResponse> mob_response_pub;
59 carma_ros2_utils::PubPtr<carma_v2x_msgs::msg::MobilityRequest> mob_request_pub;
60 carma_ros2_utils::PubPtr<carma_v2x_msgs::msg::MobilityOperation> mob_operation_pub;
61
62 // Subscribers
63 carma_ros2_utils::SubPtr<carma_v2x_msgs::msg::MobilityRequest> mob_request_sub;
64 carma_ros2_utils::SubPtr<carma_v2x_msgs::msg::MobilityResponse> mob_response_sub;
65 carma_ros2_utils::SubPtr<carma_v2x_msgs::msg::MobilityOperation> mob_operation_sub;
66 carma_ros2_utils::SubPtr<geometry_msgs::msg::PoseStamped> current_pose_sub;
67 carma_ros2_utils::SubPtr<geometry_msgs::msg::TwistStamped> current_twist_sub;
68 carma_ros2_utils::SubPtr<geometry_msgs::msg::TwistStamped> cmd_sub;
69 carma_ros2_utils::SubPtr<std_msgs::msg::String> georeference_sub;
70
71 // Timers
72 rclcpp::TimerBase::SharedPtr loop_timer_;
73
74 // Node configuration
76
77 // Worker
78 std::shared_ptr<PlatoonStrategicIHPPlugin> worker_;
79
80 public:
84 explicit Node(const rclcpp::NodeOptions &);
85
89 rcl_interfaces::msg::SetParametersResult
90 parameter_update_callback(const std::vector<rclcpp::Parameter> &parameters);
91
92
94 // Overrides
97 std::shared_ptr<rmw_request_id_t>,
98 carma_planning_msgs::srv::PlanManeuvers::Request::SharedPtr req,
99 carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp) override;
100
101 bool get_availability() override;
102
103 std::string get_version_id() override;
104
108 carma_ros2_utils::CallbackReturn on_configure_plugin();
109 carma_ros2_utils::CallbackReturn on_cleanup_plugin();
110
111 };
112
113} // platoon_strategic_ihp
StrategicPlugin base class which can be extended by user provided plugins which wish to implement the...
ROS Node to for Platooning Strategic Plugin IHP2 variant. It includes all the service clients,...
rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector< rclcpp::Parameter > &parameters)
Callback for dynamic parameter updates.
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::MobilityRequest > mob_request_sub
carma_ros2_utils::PubPtr< carma_v2x_msgs::msg::MobilityResponse > mob_response_pub
bool get_availability() override
Get the availability status of this plugin based on the current operating environment....
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::MobilityOperation > mob_operation_sub
std::string get_version_id() override
Returns the version id of this plugin.
rclcpp::TimerBase::SharedPtr loop_timer_
carma_ros2_utils::PubPtr< carma_v2x_msgs::msg::MobilityOperation > mob_operation_pub
Node(const rclcpp::NodeOptions &)
Node constructor.
carma_ros2_utils::CallbackReturn on_cleanup_plugin()
Method which is triggered when this plugin is moved from the INACTIVE to UNCONFIGURED states....
carma_ros2_utils::PubPtr< carma_v2x_msgs::msg::MobilityRequest > mob_request_pub
carma_ros2_utils::SubPtr< geometry_msgs::msg::TwistStamped > cmd_sub
carma_ros2_utils::SubPtr< geometry_msgs::msg::PoseStamped > current_pose_sub
carma_ros2_utils::SubPtr< std_msgs::msg::String > georeference_sub
carma_ros2_utils::CallbackReturn on_configure_plugin()
This method should be used to load parameters and will be called on the configure state transition.
carma_ros2_utils::SubPtr< geometry_msgs::msg::TwistStamped > current_twist_sub
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::PlatooningInfo > platoon_info_pub
std::shared_ptr< PlatoonStrategicIHPPlugin > worker_
void plan_maneuvers_callback(std::shared_ptr< rmw_request_id_t >, carma_planning_msgs::srv::PlanManeuvers::Request::SharedPtr req, carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp) override
Extending class provided callback which should return a planned trajectory based on the provided traj...
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::MobilityResponse > mob_response_sub
Stuct containing the algorithm configuration values for the yield_pluginConfig.