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.
platooning_control_worker.hpp
Go to the documentation of this file.
1/*------------------------------------------------------------------------------
2* Copyright (C) 2024 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
19#include <rclcpp/rclcpp.hpp>
20#include <carma_v2x_msgs/msg/mobility_operation.hpp>
21#include <carma_v2x_msgs/msg/mobility_request.hpp>
22#include <carma_v2x_msgs/msg/mobility_response.hpp>
23#include <geometry_msgs/msg/pose_stamped.hpp>
24#include <carma_v2x_msgs/msg/plan_type.hpp>
25#include <carma_planning_msgs/msg/trajectory_plan.hpp>
28#include <boost/optional.hpp>
29
30namespace platooning_control
31{
36 // Static ID is permanent ID for each vehicle
37 std::string staticId;
38 // Current BSM Id for each CAV
39 std::string bsmId;
40 // Vehicle real time command speed in m/s
42 // Actual vehicle speed in m/s
44 // Vehicle current down track distance on the current route in m
46 // The local time stamp when the host vehicle update any informations of this member
48 // leader index in the platoon
50 // Number of vehicles in front
52
53 };
54
55 // Leader info: platoonmember + leader index + number of vehicles in front
60 {
61 public:
62
67
72 double get_last_speed_command() const;
73
78 void generate_speed(const carma_planning_msgs::msg::TrajectoryPlanPoint& point);
79
84 void set_leader(const PlatoonLeaderInfo& leader);
85
86
91 void set_current_speed(double speed);
92
93 // Member Variables
94
95 // Platoon Leader
97
98 // config parameters
99 std::shared_ptr<PlatooningControlPluginConfig> ctrl_config_ = std::make_shared<PlatooningControlPluginConfig>();
100
101 double speedCmd = 0;
102 double currentSpeed = 0;
103 double lastCmdSpeed = 0.0;
104 double speedCmd_ = 0;
105 double steerCmd_ = 0;
106 double angVelCmd_ = 0;
107 double desired_gap_ = ctrl_config_->stand_still_headway_m;
108 double actual_gap_ = 0.0;
109 bool last_cmd_set_ = false;
110
111
112 private:
113
114 // pid controller object
116
118
119
120 };
121}
This class includes logic for PID controller. PID controller is used in this plugin to maintain the i...
This is the worker class for platoon controller. It is responsible for generating and smoothing the s...
void set_leader(const PlatoonLeaderInfo &leader)
Sets the platoon leader object using info from msg.
void set_current_speed(double speed)
set current speed
double get_last_speed_command() const
Returns latest speed command.
std::shared_ptr< PlatooningControlPluginConfig > ctrl_config_
PlatooningControlWorker()
Default constructor for platooning control worker.
void generate_speed(const carma_planning_msgs::msg::TrajectoryPlanPoint &point)
Generates speed commands (in m/s) based on the trajectory point.