19#include <rclcpp/rclcpp.hpp>
21#include <carma_ros2_utils/containers/containers.hpp>
22#include <boost/shared_ptr.hpp>
23#include <boost/uuid/uuid_generators.hpp>
24#include <boost/uuid/uuid_io.hpp>
25#include <boost/property_tree/ptree.hpp>
26#include <boost/property_tree/json_parser.hpp>
28#include <geometry_msgs/msg/pose_stamped.hpp>
29#include <geometry_msgs/msg/twist_stamped.hpp>
30#include <lanelet2_core/primitives/Lanelet.h>
31#include <lanelet2_core/geometry/LineString.h>
32#include <carma_v2x_msgs/msg/mobility_response.hpp>
33#include <carma_v2x_msgs/msg/mobility_request.hpp>
34#include <carma_v2x_msgs/msg/bsm.hpp>
35#include <carma_planning_msgs/msg/maneuver_plan.hpp>
36#include <carma_planning_msgs/msg/trajectory_plan.hpp>
37#include <carma_planning_msgs/msg/lane_change_status.hpp>
38#include <carma_perception_msgs/msg/roadway_obstacle.hpp>
40#include <lanelet2_extension/projection/local_frame_projector.h>
41#include <std_msgs/msg/string.hpp>
72 carma_ros2_utils::SubPtr<geometry_msgs::msg::PoseStamped>
pose_sub_;
73 carma_ros2_utils::SubPtr<geometry_msgs::msg::TwistStamped>
twist_sub_;
76 carma_ros2_utils::SubPtr<carma_v2x_msgs::msg::BSM>
bsm_sub_;
123 void pose_cb(
const geometry_msgs::msg::PoseStamped::UniquePtr msg);
129 void twist_cb(
const geometry_msgs::msg::TwistStamped::UniquePtr msg);
135 void bsm_cb(
const carma_v2x_msgs::msg::BSM::UniquePtr msg);
142 std::string
bsmIDtoString(carma_v2x_msgs::msg::BSMCoreData bsm_core);
165 rcl_interfaces::msg::SetParametersResult
175 std::vector<carma_planning_msgs::msg::TrajectoryPlanPoint>
plan_lanechange(carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr req);
186 double find_current_gap(
long veh2_lanelet_id,
double veh2_downtrack, carma_planning_msgs::msg::VehicleState& ego_state)
const;
199 carma_v2x_msgs::msg::MobilityRequest
create_mobility_request(std::vector<carma_planning_msgs::msg::TrajectoryPlanPoint>& trajectory_plan, carma_planning_msgs::msg::Maneuver& maneuver);
206 carma_v2x_msgs::msg::Trajectory
trajectory_plan_to_trajectory(
const std::vector<carma_planning_msgs::msg::TrajectoryPlanPoint>& traj_points)
const;
214 carma_v2x_msgs::msg::LocationECEF
trajectory_point_to_ecef(
const carma_planning_msgs::msg::TrajectoryPlanPoint& traj_point)
const;
223 carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr resp,
224 const std::vector<carma_planning_msgs::msg::TrajectoryPlanPoint>& planned_trajectory_points);
236 std::shared_ptr<rmw_request_id_t>,
237 carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr req,
238 carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr resp)
override;
TacticalPlugin base class which can be extended by user provided plugins which wish to implement the ...
The class responsible for generating cooperative lanechange trajectories from received lane change ma...
carma_v2x_msgs::msg::LocationECEF trajectory_point_to_ecef(const carma_planning_msgs::msg::TrajectoryPlanPoint &traj_point) const
Converts Trajectory Point to ECEF frame using map projection.
geometry_msgs::msg::PoseStamped pose_msg_
std::string map_georeference_
carma_planning_msgs::msg::VehicleState ending_state_before_buffer_
bool get_availability() override
Get the availability status of this plugin based on the current operating environment....
carma_v2x_msgs::msg::MobilityRequest create_mobility_request(std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > &trajectory_plan, carma_planning_msgs::msg::Maneuver &maneuver)
Creates a mobility request message from planned trajectory and requested maneuver info.
void bsm_cb(const carma_v2x_msgs::msg::BSM::UniquePtr msg)
Callback for the BSM subscriber, which will store the latest BSM Core Data broadcasted by the host ve...
FRIEND_TEST(CooperativeLaneChangePlugin, TestLaneChangefunctions)
carma_ros2_utils::SubPtr< geometry_msgs::msg::TwistStamped > twist_sub_
void add_trajectory_to_response(carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr req, carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr resp, const std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > &planned_trajectory_points)
Adds the generated trajectory plan to the service response.
std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > plan_lanechange(carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr req)
Creates a vector of Trajectory Points from maneuver information in trajectory request.
void mobilityresponse_cb(const carma_v2x_msgs::msg::MobilityResponse::UniquePtr msg)
Callback to subscribed mobility response topic.
std::unordered_map< std::string, LaneChangeManeuverOriginalValues > original_lc_maneuver_values_
double find_current_gap(long veh2_lanelet_id, double veh2_downtrack, carma_planning_msgs::msg::VehicleState &ego_state) const
Calculates distance between subject vehicle and vehicle 2.
void plan_trajectory_callback(std::shared_ptr< rmw_request_id_t >, carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr req, carma_planning_msgs::srv::PlanTrajectory::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::BSM > bsm_sub_
std::string bsmIDtoString(carma_v2x_msgs::msg::BSMCoreData bsm_core)
Method for extracting the BSM ID from a BSM Core Data object and converting it to a string.
CooperativeLaneChangePlugin(const rclcpp::NodeOptions &)
CooperativeLaneChangePlugin constructor.
carma_v2x_msgs::msg::BSMCoreData bsm_core_
bool is_lanechange_accepted_
void pose_cb(const geometry_msgs::msg::PoseStamped::UniquePtr msg)
Callback for the pose subscriber, which will store latest pose locally.
carma_ros2_utils::SubPtr< std_msgs::msg::String > georeference_sub_
carma_wm::WorldModelConstPtr wm_
std::string get_version_id() override
Returns the version id of this plugin.
void twist_cb(const geometry_msgs::msg::TwistStamped::UniquePtr msg)
Callback for the twist subscriber, which will store latest twist locally.
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::LaneChangeStatus > lanechange_status_pub_
carma_ros2_utils::PubPtr< carma_v2x_msgs::msg::MobilityRequest > outgoing_mobility_request_pub_
std::string clc_request_id_
void georeference_cb(const std_msgs::msg::String::UniquePtr msg)
Callback for map projection string to define lat/lon -> map conversion.
std::shared_ptr< lanelet::projection::LocalFrameProjector > map_projector_
rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector< rclcpp::Parameter > ¶meters)
Callback for dynamic parameter updates.
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::PoseStamped > pose_sub_
FRIEND_TEST(CooperativeLaneChangePlugin, Testcurrentgapcb)
rclcpp::Time request_sent_time_
std::string DEFAULT_STRING_
FRIEND_TEST(CooperativeLaneChangePlugin, TestNoPath_roadwayobject)
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::MobilityResponse > incoming_mobility_response_sub_
carma_v2x_msgs::msg::Trajectory trajectory_plan_to_trajectory(const std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > &traj_points) const
Converts Trajectory Plan to (Mobility) Trajectory.
double maneuver_fraction_completed_
std::shared_ptr< const WorldModel > WorldModelConstPtr
basic_autonomy::waypoint_generation::PointSpeedPair PointSpeedPair
Stuct containing the algorithm configuration values for cooperative_lanechange.
Convenience struct for storing the original start_dist and starting_lane_id associated with a receive...
double original_longitudinal_vel_ms
double original_start_dist
std::string original_starting_lane_id