19#include <yield_plugin/yield_plugin_cuda.cuh>
23 namespace std_ph = std::placeholders;
84 RCLCPP_INFO_STREAM(get_logger(),
"YieldPlugin Params: " <<
config_);
86 if (cuda_is_available()) {
87 RCLCPP_INFO(get_logger(),
"YieldPlugin collision detection: GPU path (bbox on-route filter + CUDA kernel)");
90 auto _t0 = std::chrono::steady_clock::now();
91 const std::vector<yield_plugin::CudaPoint> ego = {{0.f,0.f,0.f},{1.f,0.f,1.f}};
92 const std::vector<yield_plugin::CudaPoint> obs = {{1e4f,1e4f,0.f},{1e4f,1e4f,1.f}};
93 cuda_check_all_collisions(ego, obs, {0}, {2}, 2.0f);
94 const double _warm_ms = std::chrono::duration<double, std::milli>(
95 std::chrono::steady_clock::now() - _t0).count();
96 RCLCPP_INFO_STREAM(get_logger(),
97 "CUDA warmup complete (" << _warm_ms <<
" ms) — first call latency paid at startup");
99 RCLCPP_WARN(get_logger(),
"YieldPlugin built with CUDA but no compatible driver found; using CPU collision detection fallback");
100 RCLCPP_WARN(get_logger(),
"YieldPlugin collision detection: CPU path (bbox on-route filter + std::async get_collision_time)");
108 worker_->update_route_llt_cache();
112 mob_resp_pub_ = create_publisher<carma_v2x_msgs::msg::MobilityResponse>(
"outgoing_mobility_response", 1);
113 lc_status_pub_ = create_publisher<carma_planning_msgs::msg::LaneChangeStatus>(
"cooperative_lane_change_status", 10);
118 georeference_sub_ = create_subscription<std_msgs::msg::String>(
"georeference", 10,
119 [
this](
const std_msgs::msg::String::SharedPtr msg) {
120 worker_->set_georeference_string(msg->data);
124 external_objects_sub_ = create_subscription<carma_perception_msgs::msg::ExternalObjectList>(
"external_object_predictions", 20,
125 [
this](
const carma_perception_msgs::msg::ExternalObjectList::SharedPtr msg) {
126 worker_->set_external_objects(msg->objects);
129 return CallbackReturn::SUCCESS;
133 std::shared_ptr<rmw_request_id_t> srv_header,
134 carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr req,
135 carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr resp)
137 worker_->plan_trajectory_callback(req, resp);
152#include "rclcpp_components/register_node_macro.hpp"
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...
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 ...
ROS node for the YieldPlugin.
YieldPluginNode(const rclcpp::NodeOptions &)
Node constructor.
rclcpp_lifecycle::LifecyclePublisher< carma_planning_msgs::msg::LaneChangeStatus >::SharedPtr lc_status_pub_
rclcpp::Subscription< carma_v2x_msgs::msg::MobilityRequest >::SharedPtr mob_request_sub_
YieldPluginConfig config_
void plan_trajectory_callback(std::shared_ptr< rmw_request_id_t > srv_header, 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...
rclcpp::Subscription< carma_v2x_msgs::msg::BSM >::SharedPtr bsm_sub_
std::shared_ptr< YieldPlugin > worker_
rclcpp::Subscription< carma_perception_msgs::msg::ExternalObjectList >::SharedPtr external_objects_sub_
std::string get_version_id() override final
Returns the version id of this plugin.
bool get_availability() override
Get the availability status of this plugin based on the current operating environment....
carma_ros2_utils::CallbackReturn on_configure_plugin()
Method which is triggered when this plugin is moved from the UNCONFIGURED to INACTIVE states....
rclcpp_lifecycle::LifecyclePublisher< carma_v2x_msgs::msg::MobilityResponse >::SharedPtr mob_resp_pub_
rclcpp::Subscription< std_msgs::msg::String >::SharedPtr georeference_sub_
void mobilityrequest_cb(const carma_v2x_msgs::msg::MobilityRequest::UniquePtr msg)
callback for mobility request
void bsm_cb(const carma_v2x_msgs::msg::BSM::UniquePtr msg)
callback for bsm message
Stuct containing the algorithm configuration values for the YieldPluginConfig.
bool always_accept_mobility_request
double max_stop_speed_in_ms
double collision_check_radius_in_m
bool enable_adjustable_gap
double speed_moving_average_window_size
int consecutive_clearance_count_for_passed_obstacles_threshold
double acceleration_adjustment_factor
double yield_max_deceleration_in_ms2
double time_horizon_until_collision_to_commit_to_stop_in_s
double intervehicle_collision_distance_in_m
double obstacle_zero_speed_threshold_in_ms
double on_route_vehicle_collision_horizon_in_s
bool enable_cooperative_behavior
double min_obj_avoidance_plan_time_in_s
double minimum_safety_gap_in_meters
int acceptable_passed_timesteps
double safety_collision_time_gap_in_s