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.
|
Class that implements the Approaching Emergency Vehicle Plugin (ERV) strategic plugin. This class is primarily responsible for handling ROS topic subscriptions, publications, and service callbacks for processing incoming BSMs from ERV's, generating manuever plans that account for a nearby ERV, and publishing warning message(s) to an approaching ERV when the ego vehicle is in its path. More...
#include <approaching_emergency_vehicle_plugin_node.hpp>
Public Member Functions | |
ApproachingEmergencyVehiclePlugin (const rclcpp::NodeOptions &) | |
ApproachingEmergencyVehiclePlugin constructor. More... | |
rcl_interfaces::msg::SetParametersResult | parameter_update_callback (const std::vector< rclcpp::Parameter > ¶meters) |
Callback for dynamic parameter updates. More... | |
void | incomingBsmCallback (carma_v2x_msgs::msg::BSM::UniquePtr msg) |
Incoming BSM subscription callback, which determines whether a BSM should be processed, and extracts ERV information from the BSM through a call to getErvInformationFromBsm(). This function is responsible for updating this plugin's tracked_erv_ object and setting has_tracked_erv_ to true when a new ERV becomes tracked. More... | |
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. More... | |
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. More... | |
void | georeferenceCallback (const std_msgs::msg::String::UniquePtr msg) |
Subscription callback for the georeference. More... | |
void | incomingEmergencyVehicleAckCallback (const carma_v2x_msgs::msg::EmergencyVehicleAck::UniquePtr msg) |
Subscription callback for incoming EmergencyVehicleAck messages. If the message is from the currently tracked ERV and is intended for the ego vehicle, then the plugin will reset num_warnings_broadcasted_ to zero and will reset the should_broadcast_warnings_ flag to false. More... | |
void | twistCallback (geometry_msgs::msg::TwistStamped::UniquePtr msg) |
Subscription callback for the twist subscriber, which will store latest current velocity of the ego vehicle. More... | |
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 accordingly. More... | |
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 trajectory planning request. More... | |
bool | get_availability () override |
Get the availability status of this plugin based on the current operating environment. Method must be overriden by extending classes. More... | |
std::string | get_version_id () override |
Returns the version id of this plugin. More... | |
carma_ros2_utils::CallbackReturn | on_configure_plugin () |
This method is used to load parameters and will be called on the configure state transition. More... | |
carma_ros2_utils::CallbackReturn | on_activate_plugin () |
This method is used to create a timer and will be called on the activate transition. More... | |
Public Member Functions inherited from carma_guidance_plugins::StrategicPlugin | |
StrategicPlugin (const rclcpp::NodeOptions &) | |
StrategicPlugin constructor. More... | |
virtual | ~StrategicPlugin ()=default |
Virtual destructor for safe deletion. More... | |
virtual void | plan_maneuvers_callback (std::shared_ptr< rmw_request_id_t > srv_header, carma_planning_msgs::srv::PlanManeuvers::Request::SharedPtr req, carma_planning_msgs::srv::PlanManeuvers::Response::SharedPtr resp)=0 |
Extending class provided callback which should return a planned trajectory based on the provided trajectory planning request. More... | |
std::string | get_capability () override |
Get the capability string representing this plugins capabilities Method must be overriden by extending classes. Expectation is that abstract plugin type parent classes will provide a default implementation. More... | |
uint8_t | get_type () override final |
Returns the type of this plugin according to the carma_planning_msgs::Plugin type enum. Extending classes for the specific type should override this method. More... | |
carma_ros2_utils::CallbackReturn | handle_on_configure (const rclcpp_lifecycle::State &) override final |
carma_ros2_utils::CallbackReturn | handle_on_activate (const rclcpp_lifecycle::State &) override final |
carma_ros2_utils::CallbackReturn | handle_on_deactivate (const rclcpp_lifecycle::State &) override final |
carma_ros2_utils::CallbackReturn | handle_on_cleanup (const rclcpp_lifecycle::State &) override final |
carma_ros2_utils::CallbackReturn | handle_on_shutdown (const rclcpp_lifecycle::State &) override final |
carma_ros2_utils::CallbackReturn | handle_on_error (const rclcpp_lifecycle::State &, const std::string &exception_string) override final |
Public Member Functions inherited from carma_guidance_plugins::PluginBaseNode | |
PluginBaseNode (const rclcpp::NodeOptions &) | |
PluginBaseNode constructor. More... | |
virtual | ~PluginBaseNode ()=default |
Virtual destructor for safe deletion. More... | |
virtual std::shared_ptr< carma_wm::WMListener > | get_world_model_listener () final |
Method to return the default world model listener provided as a convience by this base class If this method or get_world_model() are not called then the world model remains uninitialized and will not create unnecessary subscriptions. More... | |
virtual carma_wm::WorldModelConstPtr | get_world_model () final |
Method to return the default world model provided as a convience by this base class If this method or get_world_model_listener() are not called then the world model remains uninitialized and will not create unnecessary subscriptions. More... | |
virtual bool | get_activation_status () final |
Returns the activation status of this plugin. The plugins API callbacks will only be triggered when this method returns true. More... | |
virtual uint8_t | get_type () |
Returns the type of this plugin according to the carma_planning_msgs::Plugin type enum. Extending classes for the specific type should override this method. More... | |
std::string | get_plugin_name_and_ns () const |
Return the name of this plugin with namespace. NOTE: If only the name of the plugin is required, use get_plugin_name() More... | |
std::string | get_plugin_name () const |
Return the name of this plugin. More... | |
virtual bool | get_availability ()=0 |
Get the availability status of this plugin based on the current operating environment. Method must be overriden by extending classes. More... | |
virtual std::string | get_capability ()=0 |
Get the capability string representing this plugins capabilities Method must be overriden by extending classes. Expectation is that abstract plugin type parent classes will provide a default implementation. More... | |
virtual std::string | get_version_id ()=0 |
Returns the version id of this plugin. More... | |
virtual carma_ros2_utils::CallbackReturn | on_configure_plugin ()=0 |
Method which is triggered when this plugin is moved from the UNCONFIGURED to INACTIVE states. This method should be used to load parameters and is required to be implemented. More... | |
virtual carma_ros2_utils::CallbackReturn | on_activate_plugin () |
Method which is triggered when this plugin is moved from the INACTIVE to ACTIVE states. This method should be used to prepare for future callbacks for plugin's capabilites. More... | |
virtual carma_ros2_utils::CallbackReturn | on_deactivate_plugin () |
Method which is triggered when this plugin is moved from the ACTIVE to INACTIVE states. This method should be used to disable any functionality which should cease execution when plugin is inactive. More... | |
virtual carma_ros2_utils::CallbackReturn | on_cleanup_plugin () |
Method which is triggered when this plugin is moved from the INACTIVE to UNCONFIGURED states. This method should be used to fully reset the plugin such that a future call to on_configure_plugin would leave the plugin in a fresh state as though just launched. More... | |
virtual carma_ros2_utils::CallbackReturn | on_shutdown_plugin () |
Method which is triggered when this plugin is moved from any state to FINALIZED This method should be used to generate any shutdown logs or final cleanup. More... | |
virtual carma_ros2_utils::CallbackReturn | on_error_plugin (const std::string &exception_string) |
Method which is triggered when an unhandled exception occurs in this plugin This method should be used to cleanup such that the plugin could be moved to UNCONFIGURED state if possible. More... | |
carma_ros2_utils::CallbackReturn | handle_on_configure (const rclcpp_lifecycle::State &) override |
carma_ros2_utils::CallbackReturn | handle_on_activate (const rclcpp_lifecycle::State &) override |
carma_ros2_utils::CallbackReturn | handle_on_deactivate (const rclcpp_lifecycle::State &) override |
carma_ros2_utils::CallbackReturn | handle_on_cleanup (const rclcpp_lifecycle::State &) override |
carma_ros2_utils::CallbackReturn | handle_on_shutdown (const rclcpp_lifecycle::State &) override |
carma_ros2_utils::CallbackReturn | handle_on_error (const rclcpp_lifecycle::State &, const std::string &exception_string) override |
FRIEND_TEST (carma_guidance_plugins_test, connections_test) | |
Public Attributes | |
carma_wm::WorldModelConstPtr | wm_ |
Private Member Functions | |
boost::optional< lanelet::BasicPoint2d > | getErvPositionInMap (const double ¤t_latitude, const double ¤t_longitude) |
Helper function to obtain an ERV's position in the map frame from its current latitude and longitude. More... | |
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 destination points. More... | |
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 vehicle's future shortest path. Accesses the ego vehicle's future shortest path using wm_ object. More... | |
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. This is an estimate since it assumes both the ERV and the ego vehicle will continue travelling at their current speed. More... | |
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 to obtain all necessary information for an ERV to be tracked. This "necessary information" includes all fields contained within an ErvInformation struct. More... | |
void | checkForErvTimeout () |
This is a callback function for the erv_timeout_timer_ timer, and is called to determine whether a timeout has occurred for the currently tracked ERV by comparing the duration since the latest ERV BSM was received with config_.timeout_duration. If a timeout has occurred, an ERV_UPDATE_TIMEOUT event will be triggered for this plugin's transition_table_ object, and the has_tracked_erv_ boolean flag will be set to false. More... | |
void | broadcastWarningToErv () |
This is a callback function for the warning_broadcast_timer_, and is called to broadcast an EmergencyVehicleResponse warning message to the currently tracked ERV when the ego vehicle is in the ERV's path, but is unable to change lanes because the ERV is estimated to pass the ego vehicle in under config_.passing_threshold. It increases the num_warnings_broadcasted_ counter, and resets it to 0 when it has reached config_.max_warning_broadcasts. Additionally, when config_.max_warning_broadcasts is reached, this method sets should_broadcast_warnings_ to false. More... | |
void | publishApproachingErvStatus () |
This is a callback function for the approaching_emergency_vehicle_status_timer_. It makes a call to generateApproachingErvStatusMessage() and publishes the generated message to approaching_erv_status_pub_. More... | |
void | publishHazardLightStatus () |
This is a callback function for publishing turn ON/OFF (true/false) hazard light command to the ssc driver. More... | |
carma_msgs::msg::UIInstructions | generateApproachingErvStatusMessage () |
Function to generate a carma_msgs::msg::UIInstructions message that describes whether there is currently an approaching ERV that is being tracked by this plugin. The generated message will follow the format described for this plugin's APPROACHING_ERV_STATUS_PARAMS string object. More... | |
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. More... | |
double | getLaneletSpeedLimit (const lanelet::ConstLanelet &lanelet) |
Helper function to extract the speed limit (m/s) from a provided lanelet. More... | |
rclcpp::Duration | getManeuverDuration (const carma_planning_msgs::msg::Maneuver &maneuver, double epsilon) const |
Helper function to obtain the (seconds) of a provided maneuver. More... | |
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. More... | |
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. More... | |
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. More... | |
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 'resp' object. If there is signficant distance between the provided downtrack_progress and stop_maneuver_beginning_downtrack, a lane follow maneuver will be added first to fill this distance. Otherwise, the stop and wait maneuver will at the downtrack provided by downtrack_progress. More... | |
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 SLOWING_DOWN_FOR_ERV state. The target speed of lane follow maneuvers in the generated plan will have a reduced value. More... | |
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 MOVING_OVER_FOR_APPROACHING_ERV state. If both the ego vehicle and the ERV are in the rightmost lane, a left lane change will be contained in the plan; otherwise a right lane change will be planned. More... | |
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 point's direction (idx 0 is the beginning). Used for getting route destination points ahead of the ERV. More... | |
FRIEND_TEST (Testapproaching_emergency_vehicle_plugin, testStateMachineTransitions) | |
FRIEND_TEST (Testapproaching_emergency_vehicle_plugin, testBSMProcessing) | |
FRIEND_TEST (Testapproaching_emergency_vehicle_plugin, testRouteConflict) | |
FRIEND_TEST (Testapproaching_emergency_vehicle_plugin, testManeuverPlanWhenSlowingDownForErv) | |
FRIEND_TEST (Testapproaching_emergency_vehicle_plugin, testManeuverPlanWhenMovingOverForErv) | |
FRIEND_TEST (Testapproaching_emergency_vehicle_plugin, testWarningBroadcast) | |
FRIEND_TEST (Testapproaching_emergency_vehicle_plugin, testApproachingErvStatusMessage) | |
FRIEND_TEST (Testapproaching_emergency_vehicle_plugin, filter_points_ahead) | |
Private Attributes | |
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::BSM > | incoming_bsm_sub_ |
carma_ros2_utils::SubPtr< std_msgs::msg::String > | georeference_sub_ |
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::RouteState > | route_state_sub_ |
carma_ros2_utils::SubPtr< geometry_msgs::msg::TwistStamped > | twist_sub_ |
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::EmergencyVehicleAck > | incoming_emergency_vehicle_ack_sub_ |
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::GuidanceState > | guidance_state_sub_ |
carma_ros2_utils::SubPtr< carma_planning_msgs::msg::Route > | route_sub_ |
carma_ros2_utils::PubPtr< carma_v2x_msgs::msg::EmergencyVehicleResponse > | outgoing_emergency_vehicle_response_pub_ |
carma_ros2_utils::PubPtr< carma_msgs::msg::UIInstructions > | approaching_erv_status_pub_ |
carma_ros2_utils::PubPtr< std_msgs::msg::Bool > | hazard_light_cmd_pub_ |
Config | config_ |
ApproachingEmergencyVehicleTransitionTable | transition_table_ |
ErvInformation | tracked_erv_ |
bool | has_tracked_erv_ = false |
int | ego_lane_index_ |
carma_planning_msgs::msg::ManeuverPlan | latest_maneuver_plan_ |
const std::string | APPROACHING_ERV_STATUS_PARAMS = "HAS_APPROACHING_ERV:%1%,TIME_UNTIL_PASSING:%2$.1f,EGO_VEHICLE_ACTION:%3%" |
rclcpp::TimerBase::SharedPtr | erv_timeout_timer_ |
bool | has_broadcasted_warning_messages_ = false |
bool | should_broadcast_warnings_ = false |
int | num_warnings_broadcasted_ = 0 |
rclcpp::TimerBase::SharedPtr | warning_broadcast_timer_ |
rclcpp::TimerBase::SharedPtr | approaching_emergency_vehicle_status_timer_ |
rclcpp::TimerBase::SharedPtr | hazard_light_timer_ |
UpcomingLaneChangeParameters | upcoming_lc_params_ |
bool | has_planned_upcoming_lc_ = false |
bool | hazard_light_cmd_ = false |
const double | MAINTAIN_SPEED_THRESHOLD = 8.0 |
bool | is_maintaining_non_reduced_speed_ = false |
double | non_reduced_speed_to_maintain_ = 4.4704 |
bool | is_guidance_engaged_ = false |
std::unordered_map< std::string, bool > | is_same_direction_ |
std::unordered_map< std::string, rclcpp::Time > | latest_erv_update_times_ |
boost::optional< std::string > | map_projector_ |
carma_planning_msgs::msg::RouteState | latest_route_state_ |
double | current_speed_ |
bool | has_received_route_state_ = false |
std::vector< int > | future_route_lanelet_ids_ |
std::string | logger_name = "approaching_emergency_vehicle_plugin" |
std::string | strategic_plugin_name_ = "approaching_emergency_vehicle_plugin" |
std::shared_ptr< carma_wm::CARMAWorldModel > | erv_world_model_ |
double | epsilon_ = 0.0001 |
Class that implements the Approaching Emergency Vehicle Plugin (ERV) strategic plugin. This class is primarily responsible for handling ROS topic subscriptions, publications, and service callbacks for processing incoming BSMs from ERV's, generating manuever plans that account for a nearby ERV, and publishing warning message(s) to an approaching ERV when the ego vehicle is in its path.
Definition at line 110 of file approaching_emergency_vehicle_plugin_node.hpp.
|
explicit |
ApproachingEmergencyVehiclePlugin constructor.
Definition at line 41 of file approaching_emergency_vehicle_plugin_node.cpp.
References approaching_emergency_vehicle_plugin::Config::approaching_erv_status_publication_frequency, approaching_emergency_vehicle_plugin::Config::approaching_threshold, approaching_emergency_vehicle_plugin::Config::bsm_processing_frequency, approaching_emergency_vehicle_plugin::Config::buffer_distance_before_stopping, config_, approaching_emergency_vehicle_plugin::Config::default_speed_limit, erv_world_model_, approaching_emergency_vehicle_plugin::Config::finished_passing_threshold, approaching_emergency_vehicle_plugin::Config::lane_change_plugin, approaching_emergency_vehicle_plugin::Config::lane_following_plugin, approaching_emergency_vehicle_plugin::Config::max_warning_broadcasts, approaching_emergency_vehicle_plugin::Config::min_lane_following_duration_before_lane_change, approaching_emergency_vehicle_plugin::Config::minimal_plan_duration, approaching_emergency_vehicle_plugin::Config::minimum_reduced_speed_limit, approaching_emergency_vehicle_plugin::Config::passing_threshold, approaching_emergency_vehicle_plugin::Config::reduced_speed_buffer, approaching_emergency_vehicle_plugin::Config::route_end_point_buffer, approaching_emergency_vehicle_plugin::Config::speed_limit_reduction_during_passing, approaching_emergency_vehicle_plugin::Config::stopping_accel_limit_multiplier, approaching_emergency_vehicle_plugin::Config::timeout_check_frequency, approaching_emergency_vehicle_plugin::Config::timeout_duration, approaching_emergency_vehicle_plugin::Config::vehicle_acceleration_limit, approaching_emergency_vehicle_plugin::Config::vehicle_id, approaching_emergency_vehicle_plugin::Config::vehicle_length, and approaching_emergency_vehicle_plugin::Config::warning_broadcast_frequency.
|
private |
Function to add a stop and wait maneuver to the end of the maneuver plan contained in the provided 'resp' object. If there is signficant distance between the provided downtrack_progress and stop_maneuver_beginning_downtrack, a lane follow maneuver will be added first to fill this distance. Otherwise, the stop and wait maneuver will at the downtrack provided by downtrack_progress.
resp | The service response for the Plan Maneuvers service, which will be updated by this function. |
downtrack_progress | The current downtrack that the first maneuver generated by this function will begin at. |
stop_maneuver_beginning_downtrack | The downtrack that the stop and wait maneuver must begin by. |
end_of_route_downtrack | The ending downtrack of the ego vehicle's route. |
stopping_entry_speed | The estimated speed (m/s) that the vehicle will begin the stop and wait maneuver at. If a lane follow is created before the stop and wait maneuver, the lane follow maneuver will include a start_speed and target_speed equal to this speed. |
current_lanelet_ending_downtrack | The ending downtrack of the current lanelet that the first maneuver generated by this function will use. |
stopping_deceleration | The stopping deceleration rate for the planned stop and wait maneuver. |
current_lanelet | The current lanelet that the first maneuver generated by this function will use. |
time_progress | The time that the first maneuver generated by this function will begin at. |
Definition at line 1150 of file approaching_emergency_vehicle_plugin_node.cpp.
References approaching_emergency_vehicle_plugin::Config::buffer_distance_before_stopping, composeLaneFollowingManeuverMessage(), composeStopAndWaitManeuverMessage(), config_, epsilon_, getManeuverDuration(), logger_name, and wm_.
Referenced by generateMoveOverManeuverPlan(), and generateReducedSpeedLaneFollowingeManeuverPlan().
|
private |
This is a callback function for the warning_broadcast_timer_, and is called to broadcast an EmergencyVehicleResponse warning message to the currently tracked ERV when the ego vehicle is in the ERV's path, but is unable to change lanes because the ERV is estimated to pass the ego vehicle in under config_.passing_threshold. It increases the num_warnings_broadcasted_ counter, and resets it to 0 when it has reached config_.max_warning_broadcasts. Additionally, when config_.max_warning_broadcasts is reached, this method sets should_broadcast_warnings_ to false.
Definition at line 249 of file approaching_emergency_vehicle_plugin_node.cpp.
References config_, has_tracked_erv_, logger_name, approaching_emergency_vehicle_plugin::Config::max_warning_broadcasts, num_warnings_broadcasted_, outgoing_emergency_vehicle_response_pub_, should_broadcast_warnings_, tracked_erv_, approaching_emergency_vehicle_plugin::Config::vehicle_id, and approaching_emergency_vehicle_plugin::ErvInformation::vehicle_id.
Referenced by on_activate_plugin().
|
private |
This is a callback function for the erv_timeout_timer_ timer, and is called to determine whether a timeout has occurred for the currently tracked ERV by comparing the duration since the latest ERV BSM was received with config_.timeout_duration. If a timeout has occurred, an ERV_UPDATE_TIMEOUT event will be triggered for this plugin's transition_table_ object, and the has_tracked_erv_ boolean flag will be set to false.
Definition at line 235 of file approaching_emergency_vehicle_plugin_node.cpp.
References config_, approaching_emergency_vehicle_plugin::ERV_UPDATE_TIMEOUT, approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::event(), has_planned_upcoming_lc_, has_tracked_erv_, approaching_emergency_vehicle_plugin::ErvInformation::latest_update_time, logger_name, approaching_emergency_vehicle_plugin::Config::timeout_duration, tracked_erv_, transition_table_, and approaching_emergency_vehicle_plugin::ErvInformation::vehicle_id.
Referenced by on_activate_plugin().
|
private |
Function to compose a lane change maneuver message based on the provided maneuver parameters.
start_dist | The starting downtrack for the maneuver. |
end_dist | The ending downtrack for the maneuver. |
start_speed | The start speed (m/s) for the maneuver. |
target_speed | The target speed (m/s) for the maneuver. |
starting_lane_id | The ID of the starting lanelet for this lane change maneuver. |
ending_lane_id | The ID of the ending lanelet for this lane change maneuver. |
start_time | The estimated time that the ego vehicle will start this maneuver. |
Definition at line 1080 of file approaching_emergency_vehicle_plugin_node.cpp.
References config_, epsilon_, getManeuverDuration(), has_planned_upcoming_lc_, approaching_emergency_vehicle_plugin::Config::lane_change_plugin, logger_name, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::maneuver_id, strategic_plugin_name_, carma_cooperative_perception::to_string(), and upcoming_lc_params_.
Referenced by generateMoveOverManeuverPlan().
|
private |
Function to compose a lane following maneuver message based on the provided maneuver parameters.
start_dist | The starting downtrack for the maneuver. |
end_dist | The ending downtrack for the maneuver. |
start_speed | The start speed (m/s) for the maneuver. |
target_speed | The target speed (m/s) for the maneuver. |
lanelet_id | The ID of the lanelet that this maneuver is for. |
start_time | The estimated time that the ego vehicle will start this maneuver. |
Definition at line 1053 of file approaching_emergency_vehicle_plugin_node.cpp.
References config_, epsilon_, getManeuverDuration(), approaching_emergency_vehicle_plugin::Config::lane_following_plugin, logger_name, strategic_plugin_name_, and carma_cooperative_perception::to_string().
Referenced by addStopAndWaitToEndOfPlan(), generateMoveOverManeuverPlan(), and generateReducedSpeedLaneFollowingeManeuverPlan().
|
private |
Function to compose a stop and wait maneuver message based on the provided maneuver parameters.
start_dist | The starting downtrack for the maneuver. |
end_dist | The ending downtrack for the maneuver. |
start_speed | The start speed (m/s) for the maneuver. |
starting_lane_id | The ID of the starting lanelet for this stop and wait maneuver. |
ending_lane_id | The ID of the ending lanelet for this stop and wait maneuver. |
stopping_deceleration | The stopping deceleration rate for the planned stop and wait maneuver. |
start_time | The estimated time that the ego vehicle will start this maneuver. |
Definition at line 1116 of file approaching_emergency_vehicle_plugin_node.cpp.
References config_, epsilon_, getManeuverDuration(), logger_name, approaching_emergency_vehicle_plugin::Config::route_end_point_buffer, approaching_emergency_vehicle_plugin::Config::stop_and_wait_plugin, strategic_plugin_name_, and carma_cooperative_perception::to_string().
Referenced by addStopAndWaitToEndOfPlan().
|
private |
Helper function that return points ahead of the given reference point accounting for the list of point's direction (idx 0 is the beginning). Used for getting route destination points ahead of the ERV.
reference_point | Reference point to check against the list of points |
original_points | List of points. |
Definition at line 737 of file approaching_emergency_vehicle_plugin_node.cpp.
References process_bag::i, logger_name, process_traj_logs::x, and process_traj_logs::y.
Referenced by generateErvRoute().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Function to generate a carma_msgs::msg::UIInstructions message that describes whether there is currently an approaching ERV that is being tracked by this plugin. The generated message will follow the format described for this plugin's APPROACHING_ERV_STATUS_PARAMS string object.
Note: APPROACHING_ERV_STATUS_PARAMS format: "HAS_APPROACHING_ERV:%1%,TIME_UNTIL_PASSING:%2$.1f,EGO_VEHICLE_ACTION:%3%" |-----—0-------------------—1-------------------—2-----------—| Index 0: (Boolean) Value indicating whether the ego vehicle is tracking an approaching ERV Index 1: (Double; rounded to first decimal place) If an approaching ERV exists, this indicates the estimated seconds until the ERV passes the ego vehicle. Index 2: (String) If an approaching ERV exists, this describes the current action of the ego vehicle in response to the approaching ERV. NOTE: The values of indexes 1 and 2 can be ignored if index 0 indicates that no approaching ERV is being tracked.
Definition at line 280 of file approaching_emergency_vehicle_plugin_node.cpp.
References APPROACHING_ERV_STATUS_PARAMS, approaching_emergency_vehicle_plugin::Config::approaching_threshold, config_, current_speed_, ego_lane_index_, approaching_emergency_vehicle_plugin::anonymous_namespace{approaching_emergency_vehicle_plugin_node.cpp}::getManeuverEndSpeed(), approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::getState(), has_tracked_erv_, is_maintaining_non_reduced_speed_, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::is_right_lane_change, approaching_emergency_vehicle_plugin::ErvInformation::lane_index, latest_maneuver_plan_, approaching_emergency_vehicle_plugin::METERS_PER_SEC_TO_MILES_PER_HOUR, approaching_emergency_vehicle_plugin::MOVING_OVER_FOR_APPROACHING_ERV, approaching_emergency_vehicle_plugin::NO_APPROACHING_ERV, non_reduced_speed_to_maintain_, approaching_emergency_vehicle_plugin::Config::reduced_speed_buffer, approaching_emergency_vehicle_plugin::ErvInformation::seconds_until_passing, approaching_emergency_vehicle_plugin::SLOWING_DOWN_FOR_ERV, carma_cooperative_perception::to_string(), tracked_erv_, transition_table_, and upcoming_lc_params_.
Referenced by publishApproachingErvStatus().
|
private |
Helper function to generate an ERV's route based on its current position and its future route destination points.
current_latitude | The current latitude of the ERV. |
current_longitude | The current longitude of the ERV. |
erv_destination_points | The ERV's future destination points. |
Definition at line 633 of file approaching_emergency_vehicle_plugin_node.cpp.
References filter_points_ahead(), process_bag::i, logger_name, map_projector_, process_traj_logs::point, and wm_.
Referenced by getErvInformationFromBsm().
|
private |
Function to generate a maneuver plan when the ego vehicle must change lanes due to being in the MOVING_OVER_FOR_APPROACHING_ERV state. If both the ego vehicle and the ERV are in the rightmost lane, a left lane change will be contained in the plan; otherwise a right lane change will be planned.
resp | The service response for the Plan Maneuvers service, which will be updated by this function. |
current_lanelet | The current lanelet that the first maneuver generated by this function will use. |
downtrack_progress | The current downtrack that the first maneuver generated by this function will begin at. |
current_lanelet_ending_downtrack | The ending downtrack of the current lanelet that the first maneuver generated by this function will use. |
speed_progress | The current speed that the first maneuver generated by this function will begin at. |
target_speed | The target speed of the initial lane follow maneuver generated by this function. |
time_progress | The time that the first maneuver generated by this function will begin at. |
ego_lane_index | 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) |
erv_lane_index | The ERV's current lane index (NOTE: For 'lane index', 0 is rightmost lane, 1 is second rightmost, etc.; Only the current travel direction is considered) |
Definition at line 1295 of file approaching_emergency_vehicle_plugin_node.cpp.
References addStopAndWaitToEndOfPlan(), composeLaneChangeManeuverMessage(), composeLaneFollowingManeuverMessage(), config_, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::end_dist, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::end_speed, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::ending_lanelet, epsilon_, getLaneletSpeedLimit(), getManeuverDuration(), approaching_emergency_vehicle_plugin::anonymous_namespace{approaching_emergency_vehicle_plugin_node.cpp}::getManeuverEndSpeed(), has_planned_upcoming_lc_, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::is_right_lane_change, logger_name, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::maneuver_id, approaching_emergency_vehicle_plugin::Config::min_lane_following_duration_before_lane_change, approaching_emergency_vehicle_plugin::Config::minimal_plan_duration, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::start_dist, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::start_speed, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::starting_lanelet, approaching_emergency_vehicle_plugin::Config::stopping_accel_limit_multiplier, upcoming_lc_params_, approaching_emergency_vehicle_plugin::Config::vehicle_acceleration_limit, and wm_.
Referenced by plan_maneuvers_callback().
|
private |
Function to generate a maneuver plan when the ego vehicle must remain in its lane due to being in the SLOWING_DOWN_FOR_ERV state. The target speed of lane follow maneuvers in the generated plan will have a reduced value.
resp | The service response for the Plan Maneuvers service, which will be updated by this function. |
current_lanelet | The current lanelet that the first maneuver generated by this function will use. |
downtrack_progress | The current downtrack that the first maneuver generated by this function will begin at. |
current_lanelet_ending_downtrack | The ending downtrack of the current lanelet that the first maneuver generated by this function will use. |
speed_progress | The current speed that the first maneuver generated by this function will begin at. |
target_speed | The target speed of the initial lane follow maneuver generated by this function. |
time_progress | The time that the first maneuver generated by this function will begin at. |
is_maintaining_non_reduced_speed | Flag to indicate whether the ego vehicle should maintain its current speed since it is in the same lane as the approaching ERV, and the time until the ERV will pass the ego vehicle is so slow that if the ego vehicle slows down, it could cause a safety hazard. |
Definition at line 1201 of file approaching_emergency_vehicle_plugin_node.cpp.
References addStopAndWaitToEndOfPlan(), composeLaneFollowingManeuverMessage(), config_, epsilon_, getLaneletSpeedLimit(), getManeuverDuration(), approaching_emergency_vehicle_plugin::anonymous_namespace{approaching_emergency_vehicle_plugin_node.cpp}::getManeuverEndSpeed(), has_planned_upcoming_lc_, logger_name, approaching_emergency_vehicle_plugin::Config::minimal_plan_duration, approaching_emergency_vehicle_plugin::Config::minimum_reduced_speed_limit, non_reduced_speed_to_maintain_, approaching_emergency_vehicle_plugin::Config::speed_limit_reduction_during_passing, approaching_emergency_vehicle_plugin::Config::stopping_accel_limit_multiplier, approaching_emergency_vehicle_plugin::Config::vehicle_acceleration_limit, and wm_.
Referenced by plan_maneuvers_callback().
void approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::georeferenceCallback | ( | const std_msgs::msg::String::UniquePtr | msg | ) |
Subscription callback for the georeference.
msg | The latest georeference message. |
Definition at line 614 of file approaching_emergency_vehicle_plugin_node.cpp.
References map_projector_.
Referenced by on_configure_plugin().
|
overridevirtual |
Get the availability status of this plugin based on the current operating environment. Method must be overriden by extending classes.
Implements carma_guidance_plugins::PluginBaseNode.
Definition at line 1635 of file approaching_emergency_vehicle_plugin_node.cpp.
|
overridevirtual |
Returns the version id of this plugin.
Implements carma_guidance_plugins::PluginBaseNode.
Definition at line 1639 of file approaching_emergency_vehicle_plugin_node.cpp.
|
private |
Through internal logic and calls to separate helper functions, this function processes a received BSM to obtain all necessary information for an ERV to be tracked. This "necessary information" includes all fields contained within an ErvInformation struct.
msg | The BSM message to be processed. It may or may not be from an active ERV. |
Definition at line 401 of file approaching_emergency_vehicle_plugin_node.cpp.
References approaching_emergency_vehicle_plugin::ErvInformation::current_latitude, approaching_emergency_vehicle_plugin::ErvInformation::current_longitude, approaching_emergency_vehicle_plugin::ErvInformation::current_position_in_map, approaching_emergency_vehicle_plugin::ErvInformation::current_speed, current_speed_, generateErvRoute(), getErvPositionInMap(), getRouteIntersectingLanelet(), getSecondsUntilPassing(), has_tracked_erv_, process_bag::i, approaching_emergency_vehicle_plugin::ErvInformation::intersecting_lanelet, is_same_direction_, approaching_emergency_vehicle_plugin::ErvInformation::lane_index, latest_erv_update_times_, logger_name, approaching_emergency_vehicle_plugin::ErvInformation::previous_lane_index, approaching_emergency_vehicle_plugin::ErvInformation::seconds_until_passing, tracked_erv_, approaching_emergency_vehicle_plugin::ErvInformation::vehicle_id, and wm_.
Referenced by incomingBsmCallback().
|
private |
Helper function to obtain an ERV's position in the map frame from its current latitude and longitude.
current_latitude | The current latitude of the ERV. |
current_longitude | The current longitude of the ERV. |
Definition at line 371 of file approaching_emergency_vehicle_plugin_node.cpp.
References map_projector_.
Referenced by getErvInformationFromBsm().
|
private |
Helper function to convert a map x,y coordinate pair to a lanelet on the ego vehicle's route.
x_position | A map x-coordinate. |
y_position | A map y-coordinate. |
Definition at line 1484 of file approaching_emergency_vehicle_plugin_node.cpp.
References logger_name, and wm_.
Referenced by plan_maneuvers_callback().
|
private |
Helper function to extract the speed limit (m/s) from a provided lanelet.
lanelet | A lanelet in the loaded vector map used by the CARMA System. |
Definition at line 1015 of file approaching_emergency_vehicle_plugin_node.cpp.
References config_, approaching_emergency_vehicle_plugin::Config::default_speed_limit, and wm_.
Referenced by generateMoveOverManeuverPlan(), generateReducedSpeedLaneFollowingeManeuverPlan(), and plan_maneuvers_callback().
|
private |
Helper function to obtain the (seconds) of a provided maneuver.
maneuver | The maneuver from which that duration is desired. |
epsilon | A double used for comparisons to zero. |
Definition at line 1032 of file approaching_emergency_vehicle_plugin_node.cpp.
References GET_MANEUVER_PROPERTY, approaching_emergency_vehicle_plugin::anonymous_namespace{approaching_emergency_vehicle_plugin_node.cpp}::getManeuverEndSpeed(), and logger_name.
Referenced by addStopAndWaitToEndOfPlan(), composeLaneChangeManeuverMessage(), composeLaneFollowingManeuverMessage(), composeStopAndWaitManeuverMessage(), generateMoveOverManeuverPlan(), and generateReducedSpeedLaneFollowingeManeuverPlan().
|
private |
Helper function to obtain the earliest lanelet that exists on both an ERV's future route and the ego vehicle's future shortest path. Accesses the ego vehicle's future shortest path using wm_ object.
erv_future_route | The ERV's future route |
Definition at line 944 of file approaching_emergency_vehicle_plugin_node.cpp.
References future_route_lanelet_ids_, latest_route_state_, logger_name, and wm_.
Referenced by getErvInformationFromBsm().
|
private |
Helper function to calculate the estimated seconds until an ERV will pass the ego vehicle. This is an estimate since it assumes both the ERV and the ego vehicle will continue travelling at their current speed.
erv_future_route | The ERV's future route |
erv_position_in_map | The ERV's current position in the map frame |
erv_current_speed | The ERV's current speed (m/s) |
intersecting_lanelet | The earliest lanelet that exists on both the ERV's future route and the ego vehicle's future shortest path. |
Definition at line 883 of file approaching_emergency_vehicle_plugin_node.cpp.
References config_, current_speed_, epsilon_, approaching_emergency_vehicle_plugin::ERV_PASSED, erv_world_model_, approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::event(), approaching_emergency_vehicle_plugin::Config::finished_passing_threshold, approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::getState(), has_planned_upcoming_lc_, has_tracked_erv_, latest_route_state_, logger_name, approaching_emergency_vehicle_plugin::SLOWING_DOWN_FOR_ERV, transition_table_, approaching_emergency_vehicle_plugin::Config::vehicle_length, and wm_.
Referenced by getErvInformationFromBsm().
void approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::guidanceStateCallback | ( | const carma_planning_msgs::msg::GuidanceState::UniquePtr | msg | ) |
Subscription callback to process the latest guidance state and update the is_guidance_engaged_ flag accordingly.
Definition at line 994 of file approaching_emergency_vehicle_plugin_node.cpp.
References lightbar_manager::ENGAGED, and is_guidance_engaged_.
Referenced by on_configure_plugin().
void approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::incomingBsmCallback | ( | carma_v2x_msgs::msg::BSM::UniquePtr | msg | ) |
Incoming BSM subscription callback, which determines whether a BSM should be processed, and extracts ERV information from the BSM through a call to getErvInformationFromBsm(). This function is responsible for updating this plugin's tracked_erv_ object and setting has_tracked_erv_ to true when a new ERV becomes tracked.
msg | The incoming BSM message. |
Definition at line 809 of file approaching_emergency_vehicle_plugin_node.cpp.
References approaching_emergency_vehicle_plugin::Config::bsm_processing_frequency, config_, approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::event(), getErvInformationFromBsm(), has_planned_upcoming_lc_, has_tracked_erv_, process_bag::i, is_guidance_engaged_, latest_erv_update_times_, approaching_emergency_vehicle_plugin::ErvInformation::latest_update_time, logger_name, approaching_emergency_vehicle_plugin::NO_APPROACHING_ERV, tracked_erv_, transition_table_, and approaching_emergency_vehicle_plugin::ErvInformation::vehicle_id.
Referenced by on_configure_plugin().
void approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::incomingEmergencyVehicleAckCallback | ( | const carma_v2x_msgs::msg::EmergencyVehicleAck::UniquePtr | msg | ) |
Subscription callback for incoming EmergencyVehicleAck messages. If the message is from the currently tracked ERV and is intended for the ego vehicle, then the plugin will reset num_warnings_broadcasted_ to zero and will reset the should_broadcast_warnings_ flag to false.
Definition at line 620 of file approaching_emergency_vehicle_plugin_node.cpp.
References config_, has_tracked_erv_, logger_name, num_warnings_broadcasted_, should_broadcast_warnings_, tracked_erv_, approaching_emergency_vehicle_plugin::Config::vehicle_id, and approaching_emergency_vehicle_plugin::ErvInformation::vehicle_id.
Referenced by on_configure_plugin().
|
virtual |
This method is used to create a timer and will be called on the activate transition.
Reimplemented from carma_guidance_plugins::PluginBaseNode.
Definition at line 189 of file approaching_emergency_vehicle_plugin_node.cpp.
References approaching_emergency_vehicle_status_timer_, approaching_emergency_vehicle_plugin::Config::approaching_erv_status_publication_frequency, broadcastWarningToErv(), checkForErvTimeout(), config_, erv_timeout_timer_, hazard_light_timer_, publishApproachingErvStatus(), publishHazardLightStatus(), approaching_emergency_vehicle_plugin::Config::timeout_check_frequency, approaching_emergency_vehicle_plugin::Config::warning_broadcast_frequency, and warning_broadcast_timer_.
|
virtual |
This method is used to load parameters and will be called on the configure state transition.
Implements carma_guidance_plugins::PluginBaseNode.
Definition at line 117 of file approaching_emergency_vehicle_plugin_node.cpp.
References approaching_erv_status_pub_, approaching_emergency_vehicle_plugin::Config::approaching_erv_status_publication_frequency, approaching_emergency_vehicle_plugin::Config::approaching_threshold, approaching_emergency_vehicle_plugin::Config::bsm_processing_frequency, approaching_emergency_vehicle_plugin::Config::buffer_distance_before_stopping, config_, approaching_emergency_vehicle_plugin::Config::default_speed_limit, approaching_emergency_vehicle_plugin::Config::finished_passing_threshold, georeference_sub_, georeferenceCallback(), carma_guidance_plugins::PluginBaseNode::get_world_model(), guidance_state_sub_, guidanceStateCallback(), hazard_light_cmd_pub_, incoming_bsm_sub_, incoming_emergency_vehicle_ack_sub_, incomingBsmCallback(), incomingEmergencyVehicleAckCallback(), approaching_emergency_vehicle_plugin::Config::lane_change_plugin, approaching_emergency_vehicle_plugin::Config::lane_following_plugin, logger_name, approaching_emergency_vehicle_plugin::Config::max_warning_broadcasts, approaching_emergency_vehicle_plugin::Config::min_lane_following_duration_before_lane_change, approaching_emergency_vehicle_plugin::Config::minimal_plan_duration, approaching_emergency_vehicle_plugin::Config::minimum_reduced_speed_limit, outgoing_emergency_vehicle_response_pub_, parameter_update_callback(), approaching_emergency_vehicle_plugin::Config::passing_threshold, approaching_emergency_vehicle_plugin::Config::reduced_speed_buffer, approaching_emergency_vehicle_plugin::Config::route_end_point_buffer, route_state_sub_, route_sub_, routeCallback(), routeStateCallback(), approaching_emergency_vehicle_plugin::Config::speed_limit_reduction_during_passing, approaching_emergency_vehicle_plugin::Config::stopping_accel_limit_multiplier, approaching_emergency_vehicle_plugin::Config::timeout_check_frequency, approaching_emergency_vehicle_plugin::Config::timeout_duration, twist_sub_, twistCallback(), approaching_emergency_vehicle_plugin::Config::vehicle_acceleration_limit, approaching_emergency_vehicle_plugin::Config::vehicle_id, approaching_emergency_vehicle_plugin::Config::vehicle_length, approaching_emergency_vehicle_plugin::Config::warning_broadcast_frequency, and wm_.
rcl_interfaces::msg::SetParametersResult approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::parameter_update_callback | ( | const std::vector< rclcpp::Parameter > & | parameters | ) |
Callback for dynamic parameter updates.
Definition at line 75 of file approaching_emergency_vehicle_plugin_node.cpp.
References approaching_emergency_vehicle_plugin::Config::approaching_erv_status_publication_frequency, approaching_emergency_vehicle_plugin::Config::approaching_threshold, approaching_emergency_vehicle_plugin::Config::bsm_processing_frequency, approaching_emergency_vehicle_plugin::Config::buffer_distance_before_stopping, config_, approaching_emergency_vehicle_plugin::Config::default_speed_limit, approaching_emergency_vehicle_plugin::Config::finished_passing_threshold, approaching_emergency_vehicle_plugin::Config::lane_change_plugin, approaching_emergency_vehicle_plugin::Config::lane_following_plugin, approaching_emergency_vehicle_plugin::Config::max_warning_broadcasts, approaching_emergency_vehicle_plugin::Config::min_lane_following_duration_before_lane_change, approaching_emergency_vehicle_plugin::Config::minimal_plan_duration, approaching_emergency_vehicle_plugin::Config::minimum_reduced_speed_limit, approaching_emergency_vehicle_plugin::Config::passing_threshold, approaching_emergency_vehicle_plugin::Config::reduced_speed_buffer, approaching_emergency_vehicle_plugin::Config::route_end_point_buffer, approaching_emergency_vehicle_plugin::Config::speed_limit_reduction_during_passing, approaching_emergency_vehicle_plugin::Config::stop_and_wait_plugin, approaching_emergency_vehicle_plugin::Config::stopping_accel_limit_multiplier, approaching_emergency_vehicle_plugin::Config::timeout_check_frequency, approaching_emergency_vehicle_plugin::Config::timeout_duration, approaching_emergency_vehicle_plugin::Config::vehicle_acceleration_limit, approaching_emergency_vehicle_plugin::Config::vehicle_id, approaching_emergency_vehicle_plugin::Config::vehicle_length, and approaching_emergency_vehicle_plugin::Config::warning_broadcast_frequency.
Referenced by on_configure_plugin().
|
overridevirtual |
Extending class provided callback which should return a planned trajectory based on the provided trajectory planning request.
srv_header | RCL header for services calls. Can usually be ignored by implementers. |
req | The service request containing the previously planned maneuvers and vehicle state |
resp | The response containing the additional maneuvers generated by this plugin |
Implements carma_guidance_plugins::StrategicPlugin.
Definition at line 1508 of file approaching_emergency_vehicle_plugin_node.cpp.
References approaching_emergency_vehicle_plugin::APPROACHING_ERV_IN_PATH, approaching_emergency_vehicle_plugin::APPROACHING_ERV_NOT_IN_PATH, approaching_emergency_vehicle_plugin::Config::approaching_threshold, config_, ego_lane_index_, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::end_dist, approaching_emergency_vehicle_plugin::ERV_PASSING_IN_PATH, approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::event(), generateMoveOverManeuverPlan(), generateReducedSpeedLaneFollowingeManeuverPlan(), getLaneletOnEgoRouteFromMapPosition(), getLaneletSpeedLimit(), approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::getState(), has_broadcasted_warning_messages_, has_planned_upcoming_lc_, has_tracked_erv_, is_maintaining_non_reduced_speed_, approaching_emergency_vehicle_plugin::ErvInformation::lane_index, latest_maneuver_plan_, logger_name, MAINTAIN_SPEED_THRESHOLD, approaching_emergency_vehicle_plugin::MOVING_OVER_FOR_APPROACHING_ERV, approaching_emergency_vehicle_plugin::NO_APPROACHING_ERV, non_reduced_speed_to_maintain_, approaching_emergency_vehicle_plugin::Config::passing_threshold, approaching_emergency_vehicle_plugin::ErvInformation::seconds_until_passing, should_broadcast_warnings_, approaching_emergency_vehicle_plugin::SLOWING_DOWN_FOR_ERV, approaching_emergency_vehicle_plugin::UpcomingLaneChangeParameters::start_dist, tracked_erv_, transition_table_, upcoming_lc_params_, and wm_.
|
private |
This is a callback function for the approaching_emergency_vehicle_status_timer_. It makes a call to generateApproachingErvStatusMessage() and publishes the generated message to approaching_erv_status_pub_.
Definition at line 274 of file approaching_emergency_vehicle_plugin_node.cpp.
References approaching_erv_status_pub_, and generateApproachingErvStatusMessage().
Referenced by on_activate_plugin().
|
private |
This is a callback function for publishing turn ON/OFF (true/false) hazard light command to the ssc driver.
Definition at line 218 of file approaching_emergency_vehicle_plugin_node.cpp.
References ego_lane_index_, approaching_emergency_vehicle_plugin::ApproachingEmergencyVehicleTransitionTable::getState(), has_tracked_erv_, hazard_light_cmd_, hazard_light_cmd_pub_, approaching_emergency_vehicle_plugin::ErvInformation::lane_index, approaching_emergency_vehicle_plugin::SLOWING_DOWN_FOR_ERV, tracked_erv_, and transition_table_.
Referenced by on_activate_plugin().
void approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::routeCallback | ( | carma_planning_msgs::msg::Route::UniquePtr | msg | ) |
Route subscription callback, with is used to update this plugin's future_route_lanelet_ids_ object.
msg | The latest Route message. |
Definition at line 1003 of file approaching_emergency_vehicle_plugin_node.cpp.
References future_route_lanelet_ids_, process_bag::i, and logger_name.
Referenced by on_configure_plugin().
void approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::routeStateCallback | ( | carma_planning_msgs::msg::RouteState::UniquePtr | msg | ) |
Route State subscription callback, with is used to update this plugin's latest_route_state_ object.
msg | The latest Route State message. |
Definition at line 985 of file approaching_emergency_vehicle_plugin_node.cpp.
References latest_route_state_.
Referenced by on_configure_plugin().
void approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::twistCallback | ( | geometry_msgs::msg::TwistStamped::UniquePtr | msg | ) |
Subscription callback for the twist subscriber, which will store latest current velocity of the ego vehicle.
msg | Latest twist message |
Definition at line 990 of file approaching_emergency_vehicle_plugin_node.cpp.
References current_speed_.
Referenced by on_configure_plugin().
|
private |
Definition at line 409 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_activate_plugin().
|
private |
Formatted string for conveying the status of this plugin and the ego vehicle's current action in response to an approaching ERV.
Definition at line 390 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by generateApproachingErvStatusMessage().
|
private |
Definition at line 132 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_configure_plugin(), and publishApproachingErvStatus().
|
private |
Definition at line 364 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by ApproachingEmergencyVehiclePlugin(), addStopAndWaitToEndOfPlan(), broadcastWarningToErv(), checkForErvTimeout(), composeLaneChangeManeuverMessage(), composeLaneFollowingManeuverMessage(), composeStopAndWaitManeuverMessage(), generateApproachingErvStatusMessage(), generateMoveOverManeuverPlan(), generateReducedSpeedLaneFollowingeManeuverPlan(), getLaneletSpeedLimit(), getSecondsUntilPassing(), incomingBsmCallback(), incomingEmergencyVehicleAckCallback(), on_activate_plugin(), on_configure_plugin(), parameter_update_callback(), and plan_maneuvers_callback().
|
private |
Definition at line 456 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by generateApproachingErvStatusMessage(), getErvInformationFromBsm(), getSecondsUntilPassing(), and twistCallback().
|
private |
Definition at line 378 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by generateApproachingErvStatusMessage(), plan_maneuvers_callback(), and publishHazardLightStatus().
|
private |
Definition at line 473 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by addStopAndWaitToEndOfPlan(), composeLaneChangeManeuverMessage(), composeLaneFollowingManeuverMessage(), composeStopAndWaitManeuverMessage(), generateMoveOverManeuverPlan(), generateReducedSpeedLaneFollowingeManeuverPlan(), and getSecondsUntilPassing().
|
private |
Definition at line 393 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_activate_plugin().
|
private |
Definition at line 470 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by ApproachingEmergencyVehiclePlugin(), and getSecondsUntilPassing().
|
private |
Definition at line 461 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by getRouteIntersectingLanelet(), and routeCallback().
|
private |
Definition at line 117 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_configure_plugin().
|
private |
Definition at line 125 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_configure_plugin().
|
private |
Definition at line 396 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by plan_maneuvers_callback().
|
private |
Definition at line 420 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by checkForErvTimeout(), composeLaneChangeManeuverMessage(), generateMoveOverManeuverPlan(), generateReducedSpeedLaneFollowingeManeuverPlan(), getSecondsUntilPassing(), incomingBsmCallback(), and plan_maneuvers_callback().
|
private |
Definition at line 459 of file approaching_emergency_vehicle_plugin_node.hpp.
|
private |
Definition at line 375 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by broadcastWarningToErv(), checkForErvTimeout(), generateApproachingErvStatusMessage(), getErvInformationFromBsm(), getSecondsUntilPassing(), incomingBsmCallback(), incomingEmergencyVehicleAckCallback(), plan_maneuvers_callback(), and publishHazardLightStatus().
|
private |
Definition at line 423 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by publishHazardLightStatus().
|
private |
Definition at line 134 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_configure_plugin(), and publishHazardLightStatus().
|
private |
Definition at line 412 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_activate_plugin().
|
private |
Definition at line 115 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_configure_plugin().
|
private |
Definition at line 123 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_configure_plugin().
|
private |
Definition at line 441 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by guidanceStateCallback(), and incomingBsmCallback().
|
private |
Definition at line 433 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by generateApproachingErvStatusMessage(), and plan_maneuvers_callback().
|
private |
Definition at line 444 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by getErvInformationFromBsm().
|
private |
Definition at line 447 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by getErvInformationFromBsm(), and incomingBsmCallback().
|
private |
Definition at line 381 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by generateApproachingErvStatusMessage(), and plan_maneuvers_callback().
|
private |
Definition at line 453 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by getRouteIntersectingLanelet(), getSecondsUntilPassing(), and routeStateCallback().
|
private |
Definition at line 464 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by addStopAndWaitToEndOfPlan(), broadcastWarningToErv(), checkForErvTimeout(), composeLaneChangeManeuverMessage(), composeLaneFollowingManeuverMessage(), composeStopAndWaitManeuverMessage(), filter_points_ahead(), generateErvRoute(), generateMoveOverManeuverPlan(), generateReducedSpeedLaneFollowingeManeuverPlan(), getErvInformationFromBsm(), getLaneletOnEgoRouteFromMapPosition(), getManeuverDuration(), getRouteIntersectingLanelet(), getSecondsUntilPassing(), incomingBsmCallback(), incomingEmergencyVehicleAckCallback(), on_configure_plugin(), plan_maneuvers_callback(), and routeCallback().
|
private |
Definition at line 429 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by plan_maneuvers_callback().
|
private |
Definition at line 450 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by generateErvRoute(), georeferenceCallback(), and getErvPositionInMap().
|
private |
Definition at line 438 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by generateApproachingErvStatusMessage(), generateReducedSpeedLaneFollowingeManeuverPlan(), and plan_maneuvers_callback().
|
private |
Definition at line 403 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by broadcastWarningToErv(), and incomingEmergencyVehicleAckCallback().
|
private |
Definition at line 130 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by broadcastWarningToErv(), and on_configure_plugin().
|
private |
Definition at line 119 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_configure_plugin().
|
private |
Definition at line 127 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_configure_plugin().
|
private |
Definition at line 400 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by broadcastWarningToErv(), incomingEmergencyVehicleAckCallback(), and plan_maneuvers_callback().
|
private |
Definition at line 467 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by composeLaneChangeManeuverMessage(), composeLaneFollowingManeuverMessage(), and composeStopAndWaitManeuverMessage().
|
private |
Definition at line 370 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by broadcastWarningToErv(), checkForErvTimeout(), generateApproachingErvStatusMessage(), getErvInformationFromBsm(), incomingBsmCallback(), incomingEmergencyVehicleAckCallback(), plan_maneuvers_callback(), and publishHazardLightStatus().
|
private |
Definition at line 367 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by checkForErvTimeout(), generateApproachingErvStatusMessage(), getSecondsUntilPassing(), incomingBsmCallback(), plan_maneuvers_callback(), and publishHazardLightStatus().
|
private |
Definition at line 121 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_configure_plugin().
|
private |
Definition at line 416 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by composeLaneChangeManeuverMessage(), generateApproachingErvStatusMessage(), generateMoveOverManeuverPlan(), and plan_maneuvers_callback().
|
private |
Definition at line 406 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by on_activate_plugin().
carma_wm::WorldModelConstPtr approaching_emergency_vehicle_plugin::ApproachingEmergencyVehiclePlugin::wm_ |
Definition at line 564 of file approaching_emergency_vehicle_plugin_node.hpp.
Referenced by addStopAndWaitToEndOfPlan(), generateErvRoute(), generateMoveOverManeuverPlan(), generateReducedSpeedLaneFollowingeManeuverPlan(), getErvInformationFromBsm(), getLaneletOnEgoRouteFromMapPosition(), getLaneletSpeedLimit(), getRouteIntersectingLanelet(), getSecondsUntilPassing(), on_configure_plugin(), and plan_maneuvers_callback().