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.
approaching_emergency_vehicle_plugin_node.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022-2023 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#pragma once
18
19#include <rclcpp/rclcpp.hpp>
20#include <functional>
21#include <std_msgs/msg/string.hpp>
22#include <std_srvs/srv/empty.hpp>
23#include <carma_planning_msgs/msg/plugin.hpp>
24#include <carma_planning_msgs/msg/upcoming_lane_change_status.hpp>
25#include <carma_planning_msgs/msg/route_state.hpp>
26#include <carma_planning_msgs/msg/guidance_state.hpp>
27#include <carma_v2x_msgs/msg/bsm.hpp>
28#include <carma_v2x_msgs/msg/emergency_vehicle_response.hpp>
29#include <carma_v2x_msgs/msg/bsm.hpp>
30#include <carma_v2x_msgs/msg/emergency_vehicle_ack.hpp>
31#include <carma_msgs/msg/ui_instructions.hpp>
32#include <geometry_msgs/msg/twist_stamped.hpp>
35#include <lanelet2_core/geometry/Lanelet.h>
36#include <lanelet2_extension/projection/local_frame_projector.h>
37#include <lanelet2_extension/io/autoware_osm_parser.h>
39#include <boost/format.hpp>
40#include <std_msgs/msg/bool.hpp>
41#include <unordered_map>
42
47
54#define GET_MANEUVER_PROPERTY(mvr, property)\
55 (((mvr).type == carma_planning_msgs::msg::Maneuver::INTERSECTION_TRANSIT_LEFT_TURN ? (mvr).intersection_transit_left_turn_maneuver.property :\
56 ((mvr).type == carma_planning_msgs::msg::Maneuver::INTERSECTION_TRANSIT_RIGHT_TURN ? (mvr).intersection_transit_right_turn_maneuver.property :\
57 ((mvr).type == carma_planning_msgs::msg::Maneuver::INTERSECTION_TRANSIT_STRAIGHT ? (mvr).intersection_transit_straight_maneuver.property :\
58 ((mvr).type == carma_planning_msgs::msg::Maneuver::LANE_CHANGE ? (mvr).lane_change_maneuver.property :\
59 ((mvr).type == carma_planning_msgs::msg::Maneuver::LANE_FOLLOWING ? (mvr).lane_following_maneuver.property :\
60 ((mvr).type == carma_planning_msgs::msg::Maneuver::STOP_AND_WAIT ? (mvr).stop_and_wait_maneuver.property :\
61 throw std::invalid_argument("GET_MANEUVER_PROPERTY (property) called on maneuver with invalid type id " + std::to_string((mvr).type)))))))))
62
64{
65
70 std::string vehicle_id; // The vehicle ID asssociated with an ERV
71 double current_speed; // The current speed (m/s) of an ERV
72 double current_latitude; // The current latitude of an ERV
73 double current_longitude; // The current longitude of an ERV
74 lanelet::BasicPoint2d current_position_in_map; // The current position of the ERV in the map frame
75 lanelet::ConstLanelet intersecting_lanelet; // The first intersecting lanelet between ERV's future route and CMV's future shortest path
76 double seconds_until_passing; // The estimated duration (seconds) until the ERV will pass the ego vehicle
77 // based on their current positions and current speeds
78 int previous_lane_index; // The lane index of the
79 int lane_index = 0; // The ERV's current lane index
80 // NOTE 1: For 'lane index', 0 is rightmost lane, 1 is second rightmost, etc.; Only the current travel direction is considered
81 // NOTE 2: To prevent "noisy" lane index calculations from the ERV, this value is only updated when the lane index of the ERV (according to a processed BSM) matches
82 // previous_lane_index, which was obtained from the previously processed BSM.
83 rclcpp::Time latest_update_time; // The timestamp (from this node's clock) associated with the last update of this object
84 };
85
91 lanelet::ConstLanelet starting_lanelet; // The starting lanelet of the upcoming lane change
92 lanelet::ConstLanelet ending_lanelet; // The ending lanelet of the upcoming lane change
93 bool is_right_lane_change; // Flag to indicate lane change direction; true if a right lane change, false if a left lane change
94 double start_dist; // The starting downtrack of the upcoming lane change
95 double end_dist; // The ending downtrack of the upcoming lane change
96 double start_speed; // The start speed of the upcoming lane change
97 double end_speed; // The end speed of the upcoming lane change
98 std::string maneuver_id; // The maneuver ID of the upcoming lane change
99 };
100
101 // Constant for converting from meters per second to miles per hour
102 constexpr double METERS_PER_SEC_TO_MILES_PER_HOUR = 2.23694;
103
111 {
112
113 private:
114 // Subscribers
115 carma_ros2_utils::SubPtr<carma_v2x_msgs::msg::BSM> incoming_bsm_sub_;
116
117 carma_ros2_utils::SubPtr<std_msgs::msg::String> georeference_sub_;
118
119 carma_ros2_utils::SubPtr<carma_planning_msgs::msg::RouteState> route_state_sub_;
120
121 carma_ros2_utils::SubPtr<geometry_msgs::msg::TwistStamped> twist_sub_;
122
123 carma_ros2_utils::SubPtr<carma_v2x_msgs::msg::EmergencyVehicleAck> incoming_emergency_vehicle_ack_sub_;
124
125 carma_ros2_utils::SubPtr<carma_planning_msgs::msg::GuidanceState> guidance_state_sub_;
126
127 carma_ros2_utils::SubPtr<carma_planning_msgs::msg::Route> route_sub_;
128
129 // Publishers
130 carma_ros2_utils::PubPtr<carma_v2x_msgs::msg::EmergencyVehicleResponse> outgoing_emergency_vehicle_response_pub_;
131
132 carma_ros2_utils::PubPtr<carma_msgs::msg::UIInstructions> approaching_erv_status_pub_;
133
134 carma_ros2_utils::PubPtr<std_msgs::msg::Bool> hazard_light_cmd_pub_;
135
143 boost::optional<lanelet::BasicPoint2d> getErvPositionInMap(const double& current_latitude, const double& current_longitude);
144
152 lanelet::Optional<lanelet::routing::Route> generateErvRoute(double current_latitude, double current_longitude,
153 std::vector<carma_v2x_msgs::msg::Position3D> erv_destination_points);
154
161 boost::optional<lanelet::ConstLanelet> getRouteIntersectingLanelet(const lanelet::routing::Route& erv_future_route);
162
175 boost::optional<double> getSecondsUntilPassing(lanelet::Optional<lanelet::routing::Route>& erv_future_route, const lanelet::BasicPoint2d& erv_position_in_map,
176 const double& erv_current_speed, lanelet::ConstLanelet& intersecting_lanelet);
177
186 boost::optional<ErvInformation> getErvInformationFromBsm(carma_v2x_msgs::msg::BSM::UniquePtr msg);
187
194 void checkForErvTimeout();
195
204
210
215
222 carma_msgs::msg::UIInstructions generateApproachingErvStatusMessage();
223
231 boost::optional<lanelet::ConstLanelet> getLaneletOnEgoRouteFromMapPosition(const double& x_position, const double& y_position);
232
238 double getLaneletSpeedLimit(const lanelet::ConstLanelet& lanelet);
239
246 rclcpp::Duration getManeuverDuration(const carma_planning_msgs::msg::Maneuver &maneuver, double epsilon) const;
247
258 carma_planning_msgs::msg::Maneuver composeLaneFollowingManeuverMessage(double start_dist, double end_dist,
259 double start_speed, double target_speed, int lanelet_id, rclcpp::Time& start_time) const;
260
272 carma_planning_msgs::msg::Maneuver composeLaneChangeManeuverMessage(double start_dist, double end_dist,
273 double start_speed, double target_speed, lanelet::Id starting_lane_id, lanelet::Id ending_lane_id, rclcpp::Time& start_time) const;
274
286 carma_planning_msgs::msg::Maneuver composeStopAndWaitManeuverMessage(double start_dist, double end_dist, double start_speed,
287 lanelet::Id starting_lane_id, lanelet::Id ending_lane_id, double stopping_deceleration, rclcpp::Time& start_time) const;
288
306 void addStopAndWaitToEndOfPlan(carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp,
307 double downtrack_progress, double stop_maneuver_beginning_downtrack, double end_of_route_downtrack,
308 double stopping_entry_speed, double stopping_deceleration, double current_lanelet_ending_downtrack,
309 lanelet::ConstLanelet current_lanelet, rclcpp::Time time_progress);
310
327 void generateReducedSpeedLaneFollowingeManeuverPlan(carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp,
328 lanelet::ConstLanelet current_lanelet, double downtrack_progress, double current_lanelet_ending_downtrack,
329 double speed_progress, double target_speed, rclcpp::Time time_progress, bool is_maintaining_non_reduced_speed);
330
347 void generateMoveOverManeuverPlan(carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp,
348 lanelet::ConstLanelet current_lanelet, double downtrack_progress, double current_lanelet_ending_downtrack,
349 double speed_progress, double target_speed, rclcpp::Time time_progress,
350 int ego_lane_index, int erv_lane_index);
351
361 std::vector<lanelet::BasicPoint2d> filter_points_ahead(const lanelet::BasicPoint2d& reference_point, const std::vector<lanelet::BasicPoint2d>& original_points) const;
362
363 // ApproachingEmergencyVehiclePlugin configuration
365
366 // State Machine Transition table
368
369 // ErvInformation object, which includes information on the currently-tracked ERV
371
372 // Boolean flag to indicate whether an ERV is being actively tracked by this plugin. When true, the
373 // tracked_erv_ object contains the latest received information pertaining to the ERV.
374 // NOTE: An ERV is only actively tracked if it is considered to be approaching or passing the ego vehicle.
375 bool has_tracked_erv_ = false;
376
377 // The ego vehicle's current lane index (NOTE: For 'lane index', 0 is rightmost lane, 1 is second rightmost, etc.; Only the current travel direction is considered)
379
380 // The latest maneuver plan generated by this plugin
381 carma_planning_msgs::msg::ManeuverPlan latest_maneuver_plan_;
382
390 const std::string APPROACHING_ERV_STATUS_PARAMS = "HAS_APPROACHING_ERV:%1%,TIME_UNTIL_PASSING:%2$.1f,EGO_VEHICLE_ACTION:%3%";
391
392 // Timer used to check whether a timeout has occurred with the currently-tracked ERV
393 rclcpp::TimerBase::SharedPtr erv_timeout_timer_;
394
395 // Boolean flag to indicate whether the ego vehicle has broadcasted EmergencyVehicleResponse warning message(s) to an approaching ERV
397
398 // Boolean flag to indicate that EmergencyVehicleResponse warning message(s) should be broadcasted to the currently-tracked ERV
399 // Note: These are broadcasted when the ego vehicle is in the ERV's path but is unable to change lanes
401
402 // Counter for the number of EmergencyVehicleResponse warning messages broadcasted to the currently-tracked ERV
404
405 // Timer used to trigger the broadcast of an EmergencyVehicleResponse warning message to the currently-tracked ERV
406 rclcpp::TimerBase::SharedPtr warning_broadcast_timer_;
407
408 // Timer used to trigger the publication of a message describing the status of this plugin and the ego vehicle's current action in response to an approaching ERV
410
411 // Timer used to command the hazard lights to turn ON/OFF (true/false)
412 rclcpp::TimerBase::SharedPtr hazard_light_timer_;
413
414 // Object to store the parameters of an upcoming lane change maneuver so that the same parameters are used when the
415 // maneuver plan is regenerated
417
418 // Boolean flag to indicate that this plugin has planned an upcoming lane change, and those same lane change maneuver
419 // parameters should be used for the next generated maneuver plan as well
421
422 // Boolean flag to command turning ON/OFF (true/false) the hazard lights
423 bool hazard_light_cmd_ = false;
424
425 // (Seconds) A threshold; if the estimated duration until an ERV passes the ego vehicle is below this and the
426 // ego vehicle is in the same lane as the ERV, then the ego vehicle will not reduce its speed, because
427 // doing so could cause a safety hazard.
428 // NOTE: This value is not configurable because it is considered to be a safety threshold.
429 const double MAINTAIN_SPEED_THRESHOLD = 8.0;
430
431 // Boolean flag to indicate that transition_table_ is in the 'SLOWING_DOWN_FOR_ERV' state, but the ego vehicle will maintain a non-reduced speed since the
432 // ERV is in the same lane as the ego vehicle and is estimated to pass the ego vehicle in less than the 'MAINTAIN_SPEED_THRESHOLD' time threshold.
434
435 // (m/s) The target speed that the ego vehicle shall maintain when the 'is_maintaining_non_reduced_speed_' flag is true. Set to the latest ego vehicle
436 // speed at the moment transition_table_ most recently received the 'ERV_PASSING_IN_PATH' event and the ERV was estimated to pass the ego
437 // vehicle in less than the 'MAINTAIN_SPEED_THERSHOLD' time threshold.
438 double non_reduced_speed_to_maintain_ = 4.4704; // Default is 4.4704 m/s or 10 mph
439
440 // Boolean flag to indicate whether guidance is currently engaged
442
443 // Boolean flag to indicate whether if each ERV and CMV are going on same direction
444 std::unordered_map<std::string, bool> is_same_direction_;
445
446 // Unordered map to store the latest time a BSM was processed for a given active ERV
447 std::unordered_map<std::string, rclcpp::Time> latest_erv_update_times_;
448
449 // Pointer for map projector
450 boost::optional<std::string> map_projector_;
451
452 // Latest route state
453 carma_planning_msgs::msg::RouteState latest_route_state_;
454
455 // Ego vehicle's current speed
457
458 // Boolean flag to indicate whether this node has received a Route State message in routeStateCallback()
460
462
463 // Logger name for this plugin
464 std::string logger_name = "approaching_emergency_vehicle_plugin";
465
466 // The name of this strategic plugin
467 std::string strategic_plugin_name_ = "approaching_emergency_vehicle_plugin";
468
469 // Separate world model object for storing the ERV's route and enabling downtrack calculations on its route
470 std::shared_ptr<carma_wm::CARMAWorldModel> erv_world_model_;
471
472 // Parameter for comparisons to 0
473 double epsilon_ = 0.0001;
474
475 // Unit Test Accessors
476 FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testStateMachineTransitions);
477 FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testBSMProcessing);
478 FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testRouteConflict);
479 FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testManeuverPlanWhenSlowingDownForErv);
480 FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testManeuverPlanWhenMovingOverForErv);
481 FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testWarningBroadcast);
482 FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testApproachingErvStatusMessage);
483 FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, filter_points_ahead);
484
485 public:
489 explicit ApproachingEmergencyVehiclePlugin(const rclcpp::NodeOptions &);
490
494 rcl_interfaces::msg::SetParametersResult
495 parameter_update_callback(const std::vector<rclcpp::Parameter> &parameters);
496
503 void incomingBsmCallback(carma_v2x_msgs::msg::BSM::UniquePtr msg);
504
509 void routeStateCallback(carma_planning_msgs::msg::RouteState::UniquePtr msg);
510
515 void routeCallback(carma_planning_msgs::msg::Route::UniquePtr msg);
516
521 void georeferenceCallback(const std_msgs::msg::String::UniquePtr msg);
522
528 void incomingEmergencyVehicleAckCallback(const carma_v2x_msgs::msg::EmergencyVehicleAck::UniquePtr msg);
529
534 void twistCallback(geometry_msgs::msg::TwistStamped::UniquePtr msg);
535
539 void guidanceStateCallback(const carma_planning_msgs::msg::GuidanceState::UniquePtr msg);
540
542 // Overrides
545 std::shared_ptr<rmw_request_id_t>,
546 carma_planning_msgs::srv::PlanManeuvers::Request::SharedPtr req,
547 carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp) override;
548
549 bool get_availability() override;
550
551 std::string get_version_id() override;
552
556 carma_ros2_utils::CallbackReturn on_configure_plugin();
557
561 carma_ros2_utils::CallbackReturn on_activate_plugin();
562
563 // World Model pointer
565
566 };
567
568} // approaching_emergency_vehicle_plugin
Class that implements the Approaching Emergency Vehicle Plugin (ERV) strategic plugin....
FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testManeuverPlanWhenSlowingDownForErv)
boost::optional< lanelet::ConstLanelet > getRouteIntersectingLanelet(const lanelet::routing::Route &erv_future_route)
Helper function to obtain the earliest lanelet that exists on both an ERV's future route and the ego ...
rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector< rclcpp::Parameter > &parameters)
Callback for dynamic parameter updates.
void publishApproachingErvStatus()
This is a callback function for the approaching_emergency_vehicle_status_timer_. It makes a call to g...
rclcpp::Duration getManeuverDuration(const carma_planning_msgs::msg::Maneuver &maneuver, double epsilon) const
Helper function to obtain the (seconds) of a provided maneuver.
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::EmergencyVehicleAck > incoming_emergency_vehicle_ack_sub_
carma_ros2_utils::CallbackReturn on_activate_plugin()
This method is used to create a timer and will be called on the activate transition.
void generateMoveOverManeuverPlan(carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp, lanelet::ConstLanelet current_lanelet, double downtrack_progress, double current_lanelet_ending_downtrack, double speed_progress, double target_speed, rclcpp::Time time_progress, int ego_lane_index, int erv_lane_index)
Function to generate a maneuver plan when the ego vehicle must change lanes due to being in the MOVIN...
lanelet::Optional< lanelet::routing::Route > generateErvRoute(double current_latitude, double current_longitude, std::vector< carma_v2x_msgs::msg::Position3D > erv_destination_points)
Helper function to generate an ERV's route based on its current position and its future route destina...
void broadcastWarningToErv()
This is a callback function for the warning_broadcast_timer_, and is called to broadcast an Emergency...
carma_planning_msgs::msg::Maneuver composeLaneFollowingManeuverMessage(double start_dist, double end_dist, double start_speed, double target_speed, int lanelet_id, rclcpp::Time &start_time) const
Function to compose a lane following maneuver message based on the provided maneuver parameters.
FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testManeuverPlanWhenMovingOverForErv)
void checkForErvTimeout()
This is a callback function for the erv_timeout_timer_ timer, and is called to determine whether a ti...
boost::optional< lanelet::ConstLanelet > getLaneletOnEgoRouteFromMapPosition(const double &x_position, const double &y_position)
Helper function to convert a map x,y coordinate pair to a lanelet on the ego vehicle's route.
void addStopAndWaitToEndOfPlan(carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp, double downtrack_progress, double stop_maneuver_beginning_downtrack, double end_of_route_downtrack, double stopping_entry_speed, double stopping_deceleration, double current_lanelet_ending_downtrack, lanelet::ConstLanelet current_lanelet, rclcpp::Time time_progress)
Function to add a stop and wait maneuver to the end of the maneuver plan contained in the provided 'r...
ApproachingEmergencyVehiclePlugin(const rclcpp::NodeOptions &)
ApproachingEmergencyVehiclePlugin constructor.
bool get_availability() override
Get the availability status of this plugin based on the current operating environment....
carma_ros2_utils::CallbackReturn on_configure_plugin()
This method is used to load parameters and will be called on the configure state transition.
carma_ros2_utils::PubPtr< carma_v2x_msgs::msg::EmergencyVehicleResponse > outgoing_emergency_vehicle_response_pub_
void routeStateCallback(carma_planning_msgs::msg::RouteState::UniquePtr msg)
Route State subscription callback, with is used to update this plugin's latest_route_state_ object.
void guidanceStateCallback(const carma_planning_msgs::msg::GuidanceState::UniquePtr msg)
Subscription callback to process the latest guidance state and update the is_guidance_engaged_ flag a...
void incomingEmergencyVehicleAckCallback(const carma_v2x_msgs::msg::EmergencyVehicleAck::UniquePtr msg)
Subscription callback for incoming EmergencyVehicleAck messages. If the message is from the currently...
carma_planning_msgs::msg::Maneuver composeStopAndWaitManeuverMessage(double start_dist, double end_dist, double start_speed, lanelet::Id starting_lane_id, lanelet::Id ending_lane_id, double stopping_deceleration, rclcpp::Time &start_time) const
Function to compose a stop and wait maneuver message based on the provided maneuver parameters.
boost::optional< double > getSecondsUntilPassing(lanelet::Optional< lanelet::routing::Route > &erv_future_route, const lanelet::BasicPoint2d &erv_position_in_map, const double &erv_current_speed, lanelet::ConstLanelet &intersecting_lanelet)
Helper function to calculate the estimated seconds until an ERV will pass the ego vehicle....
void generateReducedSpeedLaneFollowingeManeuverPlan(carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp, lanelet::ConstLanelet current_lanelet, double downtrack_progress, double current_lanelet_ending_downtrack, double speed_progress, double target_speed, rclcpp::Time time_progress, bool is_maintaining_non_reduced_speed)
Function to generate a maneuver plan when the ego vehicle must remain in its lane due to being in the...
FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testStateMachineTransitions)
void publishHazardLightStatus()
This is a callback function for publishing turn ON/OFF (true/false) hazard light command to the ssc d...
carma_planning_msgs::msg::Maneuver composeLaneChangeManeuverMessage(double start_dist, double end_dist, double start_speed, double target_speed, lanelet::Id starting_lane_id, lanelet::Id ending_lane_id, rclcpp::Time &start_time) const
Function to compose a lane change maneuver message based on the provided maneuver parameters.
FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testBSMProcessing)
boost::optional< lanelet::BasicPoint2d > getErvPositionInMap(const double &current_latitude, const double &current_longitude)
Helper function to obtain an ERV's position in the map frame from its current latitude and longitude.
FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testApproachingErvStatusMessage)
FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testWarningBroadcast)
FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, filter_points_ahead)
void incomingBsmCallback(carma_v2x_msgs::msg::BSM::UniquePtr msg)
Incoming BSM subscription callback, which determines whether a BSM should be processed,...
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_planning_msgs::msg::RouteState > route_state_sub_
double getLaneletSpeedLimit(const lanelet::ConstLanelet &lanelet)
Helper function to extract the speed limit (m/s) from a provided lanelet.
std::vector< lanelet::BasicPoint2d > filter_points_ahead(const lanelet::BasicPoint2d &reference_point, const std::vector< lanelet::BasicPoint2d > &original_points) const
Helper function that return points ahead of the given reference point accounting for the list of poin...
boost::optional< ErvInformation > getErvInformationFromBsm(carma_v2x_msgs::msg::BSM::UniquePtr msg)
Through internal logic and calls to separate helper functions, this function processes a received BSM...
void routeCallback(carma_planning_msgs::msg::Route::UniquePtr msg)
Route subscription callback, with is used to update this plugin's future_route_lanelet_ids_ object.
FRIEND_TEST(Testapproaching_emergency_vehicle_plugin, testRouteConflict)
void twistCallback(geometry_msgs::msg::TwistStamped::UniquePtr msg)
Subscription callback for the twist subscriber, which will store latest current velocity of the ego v...
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::GuidanceState > guidance_state_sub_
void georeferenceCallback(const std_msgs::msg::String::UniquePtr msg)
Subscription callback for the georeference.
carma_msgs::msg::UIInstructions generateApproachingErvStatusMessage()
Function to generate a carma_msgs::msg::UIInstructions message that describes whether there is curren...
Class defining the state transition table behavior for the ApproachingEmergencyVehiclePlugin.
StrategicPlugin base class which can be extended by user provided plugins which wish to implement the...
std::shared_ptr< const WorldModel > WorldModelConstPtr
Definition: WorldModel.hpp:452
Stuct containing the algorithm configuration values for approaching_emergency_vehicle_plugin.
Convenience struct for storing relevant data for an Emergency Response Vehicle (ERV).
Convenience struct for storing the parameters of an upcoming lane change to ensure that the same para...