Carma-platform v4.11.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.
yield_plugin Namespace Reference

Classes

struct  GetCollisionResult
 Convenience class for saving collision results. More...
 
struct  PointSpeedPair
 Convenience class for pairing 2d points with speeds. More...
 
class  YieldPlugin
 Class containing primary business logic for the In-Lane Cruising Plugin. More...
 
class  YieldPluginNode
 ROS node for the YieldPlugin. More...
 

Typedefs

using MobilityResponseCB = std::function< void(const carma_v2x_msgs::msg::MobilityResponse &)>
 
using LaneChangeStatusCB = std::function< void(const carma_planning_msgs::msg::LaneChangeStatus &)>
 

Functions

def generate_launch_description ()
 
double get_trajectory_end_time (const carma_planning_msgs::msg::TrajectoryPlan &trajectory)
 
double get_trajectory_start_time (const carma_planning_msgs::msg::TrajectoryPlan &trajectory)
 
double get_trajectory_duration (const carma_planning_msgs::msg::TrajectoryPlan &trajectory)
 
double get_trajectory_duration (const std::vector< carma_perception_msgs::msg::PredictedState > &trajectory)
 
double get_smallest_time_step_of_traj (const carma_planning_msgs::msg::TrajectoryPlan &original_tp)
 
static lanelet::BasicPoint2d interp_trajectory_pt_at_time (double query_time, const std::vector< CudaPoint > &ego_points, int num_ego_points, const carma_planning_msgs::msg::TrajectoryPlan &trajectory_plan)
 
static lanelet::BasicPoint2d interp_predicted_pt_at_time (double query_time, const std::vector< carma_perception_msgs::msg::PredictedState > &predictions, int start_index)
 

Typedef Documentation

◆ LaneChangeStatusCB

using yield_plugin::LaneChangeStatusCB = typedef std::function<void(const carma_planning_msgs::msg::LaneChangeStatus&)>

Definition at line 52 of file yield_plugin.hpp.

◆ MobilityResponseCB

using yield_plugin::MobilityResponseCB = typedef std::function<void(const carma_v2x_msgs::msg::MobilityResponse&)>

Definition at line 51 of file yield_plugin.hpp.

Function Documentation

◆ generate_launch_description()

def yield_plugin.generate_launch_description ( )

Definition at line 29 of file yield_plugin.launch.py.

30
31 # Get parameter file path
32 param_file_path = os.path.join(
33 get_package_share_directory('yield_plugin'), 'config/parameters.yaml')
34
35 # Launch node(s) in a carma container to allow logging to be configured
36 container = ComposableNodeContainer(
37 package='carma_ros2_utils',
38 name='yield_plugin_container',
39 namespace=GetCurrentNamespace(),
40 executable='carma_component_container_mt',
41 composable_node_descriptions=[
42
43 # Launch the core node(s)
44 ComposableNode(
45 package='yield_plugin',
46 plugin='yield_plugin::YieldPluginNode',
47 name='yield_plugin',
48 extra_arguments=[
49 {'use_intra_process_comms': True},
50 ],
51 parameters=[ param_file_path ]
52 ),
53 ]
54 )
55
56 return LaunchDescription([
57 container
58 ])
def generate_launch_description()

◆ get_smallest_time_step_of_traj()

double yield_plugin::get_smallest_time_step_of_traj ( const carma_planning_msgs::msg::TrajectoryPlan &  original_tp)

Definition at line 456 of file yield_plugin.cpp.

457 {
458 double smallest_time_step = std::numeric_limits<double>::infinity();
459 for (size_t i = 0; i < original_tp.trajectory_points.size() - 1; i ++)
460 {
461 smallest_time_step = std::min(smallest_time_step,
462 (rclcpp::Time(original_tp.trajectory_points.at(i + 1).target_time)
463 - rclcpp::Time(original_tp.trajectory_points.at(i).target_time)).seconds());
464 }
465 RCLCPP_DEBUG_STREAM(rclcpp::get_logger("yield_plugin"),"smallest_time_step: " << smallest_time_step);
466
467 return smallest_time_step;
468 }
rclcpp::Logger get_logger()
Return the module-level logger used by all basic_autonomy functions.
Definition: log.cpp:32

References basic_autonomy::get_logger(), and process_bag::i.

Referenced by yield_plugin::YieldPlugin::generate_JMT_trajectory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_trajectory_duration() [1/2]

double yield_plugin::get_trajectory_duration ( const carma_planning_msgs::msg::TrajectoryPlan &  trajectory)

Definition at line 68 of file yield_plugin.cpp.

69 {
70 return fabs(get_trajectory_end_time(trajectory) - get_trajectory_start_time(trajectory));
71 }
double get_trajectory_start_time(const carma_planning_msgs::msg::TrajectoryPlan &trajectory)
double get_trajectory_end_time(const carma_planning_msgs::msg::TrajectoryPlan &trajectory)

References get_trajectory_end_time(), and get_trajectory_start_time().

Referenced by yield_plugin::YieldPlugin::get_collision().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_trajectory_duration() [2/2]

double yield_plugin::get_trajectory_duration ( const std::vector< carma_perception_msgs::msg::PredictedState > &  trajectory)

Definition at line 73 of file yield_plugin.cpp.

74 {
75 return (rclcpp::Time(trajectory.back().header.stamp) - rclcpp::Time(trajectory.front().header.stamp)).seconds();
76 }

◆ get_trajectory_end_time()

double yield_plugin::get_trajectory_end_time ( const carma_planning_msgs::msg::TrajectoryPlan &  trajectory)

Definition at line 58 of file yield_plugin.cpp.

59 {
60 return rclcpp::Time(trajectory.trajectory_points.back().target_time).seconds();
61 }

Referenced by yield_plugin::YieldPlugin::get_earliest_collision_object_and_time(), yield_plugin::YieldPlugin::get_predicted_velocity_at_time(), get_trajectory_duration(), yield_plugin::YieldPlugin::plan_trajectory_callback(), and yield_plugin::YieldPlugin::update_traj_for_cooperative_behavior().

Here is the caller graph for this function:

◆ get_trajectory_start_time()

double yield_plugin::get_trajectory_start_time ( const carma_planning_msgs::msg::TrajectoryPlan &  trajectory)

Definition at line 63 of file yield_plugin.cpp.

64 {
65 return rclcpp::Time(trajectory.trajectory_points.front().target_time).seconds();
66 }

Referenced by yield_plugin::YieldPlugin::get_collision_time(), yield_plugin::YieldPlugin::get_collision_times_concurrently_cuda(), and get_trajectory_duration().

Here is the caller graph for this function:

◆ interp_predicted_pt_at_time()

static lanelet::BasicPoint2d yield_plugin::interp_predicted_pt_at_time ( double  query_time,
const std::vector< carma_perception_msgs::msg::PredictedState > &  predictions,
int  start_index 
)
static

Definition at line 888 of file yield_plugin.cpp.

892 {
893 lanelet::BasicPoint2d result(
894 predictions.front().predicted_position.position.x,
895 predictions.front().predicted_position.position.y);
896 for (int j = start_index; j < static_cast<int>(predictions.size()) - 1; ++j) {
897 const double seg_start_time = rclcpp::Time(predictions[j].header.stamp).seconds();
898 const double seg_end_time = rclcpp::Time(predictions[j + 1].header.stamp).seconds();
899 if (seg_start_time <= query_time && query_time <= seg_end_time) {
900 const double interp_ratio = (seg_end_time > seg_start_time) ? (query_time - seg_start_time) / (seg_end_time - seg_start_time) : 0.0;
901 result.x() = predictions[j].predicted_position.position.x +
902 interp_ratio * (predictions[j+1].predicted_position.position.x - predictions[j].predicted_position.position.x);
903 result.y() = predictions[j].predicted_position.position.y +
904 interp_ratio * (predictions[j+1].predicted_position.position.y - predictions[j].predicted_position.position.y);
905 break;
906 }
907 }
908 return result;
909 }

References process_traj_logs::start_index.

Referenced by yield_plugin::YieldPlugin::get_collision_times_concurrently_cuda().

Here is the caller graph for this function:

◆ interp_trajectory_pt_at_time()

static lanelet::BasicPoint2d yield_plugin::interp_trajectory_pt_at_time ( double  query_time,
const std::vector< CudaPoint > &  ego_points,
int  num_ego_points,
const carma_planning_msgs::msg::TrajectoryPlan &  trajectory_plan 
)
static

Definition at line 868 of file yield_plugin.cpp.

873 {
874 lanelet::BasicPoint2d result(ego_points[0].x, ego_points[0].y);
875 for (int i = 0; i < num_ego_points - 1; ++i) {
876 const double seg_start_time = rclcpp::Time(trajectory_plan.trajectory_points[i].target_time).seconds();
877 const double seg_end_time = rclcpp::Time(trajectory_plan.trajectory_points[i + 1].target_time).seconds();
878 if (seg_start_time <= query_time && query_time <= seg_end_time) {
879 const double interp_ratio = (seg_end_time > seg_start_time) ? (query_time - seg_start_time) / (seg_end_time - seg_start_time) : 0.0;
880 result.x() = trajectory_plan.trajectory_points[i].x + interp_ratio * (trajectory_plan.trajectory_points[i+1].x - trajectory_plan.trajectory_points[i].x);
881 result.y() = trajectory_plan.trajectory_points[i].y + interp_ratio * (trajectory_plan.trajectory_points[i+1].y - trajectory_plan.trajectory_points[i].y);
882 break;
883 }
884 }
885 return result;
886 }

References process_bag::i, osm_transform::x, and osm_transform::y.

Referenced by yield_plugin::YieldPlugin::get_collision_times_concurrently_cuda().

Here is the caller graph for this function: