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.
|
Classes | |
struct | DetailedTrajConfig |
struct | GeneralTrajConfig |
struct | PointSpeedPair |
Functions | |
std::vector< double > | apply_speed_limits (const std::vector< double > speeds, const std::vector< double > speed_limits) |
Applies the provided speed limits to the provided speeds such that each element is capped at its corresponding speed limit if needed. More... | |
Eigen::Isometry2d | compute_heading_frame (const lanelet::BasicPoint2d &p1, const lanelet::BasicPoint2d &p2) |
Returns a 2D coordinate frame which is located at p1 and oriented so p2 lies on the +X axis. More... | |
std::vector< PointSpeedPair > | constrain_to_time_boundary (const std::vector< PointSpeedPair > &points, double time_span) |
Reduces the input points to only those points that fit within the provided time boundary. More... | |
std::pair< double, size_t > | min_with_exclusions (const std::vector< double > &values, const std::unordered_set< size_t > &excluded) |
Returns the min, and its idx, from the vector of values, excluding given set of values. More... | |
std::vector< double > | optimize_speed (const std::vector< double > &downtracks, const std::vector< double > &curv_speeds, double accel_limit) |
Applies the longitudinal acceleration limit to each point's speed. More... | |
std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > | trajectory_from_points_times_orientations (const std::vector< lanelet::BasicPoint2d > &points, const std::vector< double > ×, const std::vector< double > &yaws, rclcpp::Time startTime, const std::string &desired_controller_plugin) |
Method combines input points, times, orientations, and an absolute start time to form a valid carma platform trajectory. More... | |
std::vector< PointSpeedPair > | attach_past_points (const std::vector< PointSpeedPair > &points_set, std::vector< PointSpeedPair > future_points, const int nearest_pt_index, double back_distance) |
Attaches back_distance length of points behind the future points. More... | |
std::unique_ptr< basic_autonomy::smoothing::SplineI > | compute_fit (const std::vector< lanelet::BasicPoint2d > &basic_points) |
Computes a spline based on the provided points. More... | |
double | compute_curvature_at (const basic_autonomy::smoothing::SplineI &fit_curve, double step_along_the_curve) |
Given the curvature fit, computes the curvature at the given step along the curve. More... | |
std::vector< PointSpeedPair > | create_geometry_profile (const std::vector< carma_planning_msgs::msg::Maneuver > &maneuvers, double max_starting_downtrack, const carma_wm::WorldModelConstPtr &wm, carma_planning_msgs::msg::VehicleState &ending_state_before_buffer, const carma_planning_msgs::msg::VehicleState &state, const GeneralTrajConfig &general_config, const DetailedTrajConfig &detailed_config) |
Creates geometry profile to return a point speed pair struct for LANE FOLLOW and LANE CHANGE maneuver types. More... | |
std::vector< PointSpeedPair > | create_lanefollow_geometry (const carma_planning_msgs::msg::Maneuver &maneuver, double max_starting_downtrack, const carma_wm::WorldModelConstPtr &wm, const GeneralTrajConfig &general_config, const DetailedTrajConfig &detailed_config, std::unordered_set< lanelet::Id > &visited_lanelets) |
Converts a set of requested LANE_FOLLOWING maneuvers to point speed limit pairs. More... | |
std::vector< PointSpeedPair > | add_lanefollow_buffer (const carma_wm::WorldModelConstPtr &wm, std::vector< PointSpeedPair > &points_and_target_speeds, const std::vector< carma_planning_msgs::msg::Maneuver > &maneuvers, carma_planning_msgs::msg::VehicleState &ending_state_before_buffer, const DetailedTrajConfig &detailed_config) |
Adds extra centerline points beyond required message length to lane follow maneuver points so that there's always enough points to calculate trajectory (BUFFER POINTS SHOULD BE REMOVED BEFORE RETURNING FINAL TRAJECTORY) More... | |
std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > | compose_lanefollow_trajectory_from_path (const std::vector< PointSpeedPair > &points, const carma_planning_msgs::msg::VehicleState &state, const rclcpp::Time &state_time, const carma_wm::WorldModelConstPtr &wm, const carma_planning_msgs::msg::VehicleState &ending_state_before_buffer, carma_debug_ros2_msgs::msg::TrajectoryCurvatureSpeeds &debug_msg, const DetailedTrajConfig &detailed_config) |
Method converts a list of lanelet centerline points and current vehicle state into a usable list of trajectory points for trajectory planning for a Lane following maneuver. More... | |
std::vector< PointSpeedPair > | get_lanechange_points_from_maneuver (const carma_planning_msgs::msg::Maneuver &maneuver, double max_starting_downtrack, const carma_wm::WorldModelConstPtr &wm, carma_planning_msgs::msg::VehicleState &ending_state_before_buffer, const carma_planning_msgs::msg::VehicleState &state, const GeneralTrajConfig &general_config, const DetailedTrajConfig &detailed_config) |
Converts a set of requested LANE_CHANGE maneuvers to point speed limit pairs. More... | |
std::vector< lanelet::BasicPoint2d > | create_lanechange_geometry (lanelet::Id starting_lane_id, lanelet::Id ending_lane_id, double starting_downtrack, double ending_downtrack, const carma_wm::WorldModelConstPtr &wm, int downsample_ratio, double buffer_ending_downtrack) |
Creates a vector of lane change points using parameters defined. More... | |
std::vector< std::vector< lanelet::BasicPoint2d > > | resample_linestring_pair_to_same_size (std::vector< lanelet::BasicPoint2d > &line_1, std::vector< lanelet::BasicPoint2d > &line_2) |
Resamples a pair of basicpoint2d lines to get lines of same number of points. More... | |
std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > | compose_lanechange_trajectory_from_path (const std::vector< PointSpeedPair > &points, const carma_planning_msgs::msg::VehicleState &state, const rclcpp::Time &state_time, const carma_wm::WorldModelConstPtr &wm, const carma_planning_msgs::msg::VehicleState &ending_state_before_buffer, const DetailedTrajConfig &detailed_config) |
Method converts a list of lanelet centerline points and current vehicle state into a usable list of trajectory points for trajectory planning for a Lane following maneuver. More... | |
std::vector< lanelet::BasicPoint2d > | create_route_geom (double starting_downtrack, int starting_lane_id, double ending_downtrack, const carma_wm::WorldModelConstPtr &wm) |
Creates a Lanelet2 Linestring from a vector or points along the geometry. More... | |
lanelet::BasicLineString2d | create_lanechange_path (const lanelet::ConstLanelet &start_lanelet, const lanelet::ConstLanelet &end_lanelet) |
Given a start and end point, create a vector of points fit through a spline between the points (using a Spline library) More... | |
DetailedTrajConfig | compose_detailed_trajectory_config (double trajectory_time_length, double curve_resample_step_size, double minimum_speed, double max_accel, double lateral_accel_limit, int speed_moving_average_window_size, int curvature_moving_average_window_size, double back_distance, double buffer_ending_downtrack, std::string desired_controller_plugin="default") |
GeneralTrajConfig | compose_general_trajectory_config (const std::string &trajectory_type, int default_downsample_ratio, int turn_downsample_ratio) |
autoware_auto_msgs::msg::Trajectory | process_trajectory_plan (const carma_planning_msgs::msg::TrajectoryPlan &tp, double vehicle_response_lag) |
Given a carma type of trajectory_plan, generate autoware type of trajectory accounting for speed_lag and stopping case Generated trajectory is meant to be used in autoware.auto's pure_pursuit library using set_trajectory() function. More... | |
std::vector< double > | apply_response_lag (const std::vector< double > &speeds, const std::vector< double > downtracks, double response_lag) |
Applies a specified response lag in seconds to the trajectory shifting the whole thing by the specified lag time. More... | |
carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr | modify_trajectory_to_yield_to_obstacles (const std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > &node_handler, const carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr &req, const carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr &resp, const carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanTrajectory > &yield_client, int yield_plugin_service_call_timeout) |
Applies a yield trajectory to the original trajectory set in response. More... | |
bool | is_valid_yield_plan (const std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > &node_handler, const carma_planning_msgs::msg::TrajectoryPlan &yield_plan) |
Helper function to verify if the input yield trajectory plan is valid. More... | |
int | get_nearest_point_index (const std::vector< lanelet::BasicPoint2d > &points, const carma_planning_msgs::msg::VehicleState &state) |
Returns the nearest point (in terms of cartesian 2d distance) to the provided vehicle pose in the provided l. More... | |
int | get_nearest_point_index (const std::vector< PointSpeedPair > &points, const carma_planning_msgs::msg::VehicleState &state) |
Returns the nearest point (in terms of cartesian 2d distance) to the provided vehicle pose in the provided list. More... | |
int | get_nearest_index_by_downtrack (const std::vector< lanelet::BasicPoint2d > &points, const carma_wm::WorldModelConstPtr &wm, double target_downtrack) |
Returns the nearest "less than" point to the provided vehicle pose in the provided list by utilizing the downtrack measured along the route NOTE: This function compares the downtrack, provided by routeTrackPos, of each points in the list to get the closest one to the given point's downtrack. Therefore, it is rather costlier method than comparing cartesian distance between the points and getting the closest. This way, however, the function correctly returns the end point's index if the given state, despite being valid, is farther than the given points and can technically be near any of them. More... | |
void | split_point_speed_pairs (const std::vector< PointSpeedPair > &points, std::vector< lanelet::BasicPoint2d > *basic_points, std::vector< double > *speeds) |
Helper method to split a list of PointSpeedPair into separate point and speed lists. More... | |
int | get_nearest_index_by_downtrack (const std::vector< PointSpeedPair > &points, const carma_wm::WorldModelConstPtr &wm, const carma_planning_msgs::msg::VehicleState &state) |
Overload: Returns the nearest point to the provided vehicle pose in the provided list by utilizing the downtrack measured along the route NOTE: This function compares the downtrack, provided by routeTrackPos, of each points in the list to get the closest one to the given point's downtrack. Therefore, it is rather costlier method than comparing cartesian distance between the points and getting the closest. This way, however, the function correctly returns the end point's index if the given state, despite being valid, is farther than the given points and can technically be near any of them. More... | |
int | get_nearest_index_by_downtrack (const std::vector< lanelet::BasicPoint2d > &points, const carma_wm::WorldModelConstPtr &wm, const carma_planning_msgs::msg::VehicleState &state) |
Overload: Returns the nearest point to the provided vehicle pose in the provided list by utilizing the downtrack measured along the route NOTE: This function compares the downtrack, provided by routeTrackPos, of each points in the list to get the closest one to the given point's downtrack. Therefore, it is rather costlier method than comparing cartesian distance between the points and getting the closest. This way, however, the function correctly returns the end point if the given state, despite being valid, is farther than the given points and can technically be near any of them. More... | |
Variables | |
static const std::string | BASIC_AUTONOMY_LOGGER = "basic_autonomy" |
const double | epsilon_ = 0.0000001 |
std::vector< PointSpeedPair > basic_autonomy::waypoint_generation::add_lanefollow_buffer | ( | const carma_wm::WorldModelConstPtr & | wm, |
std::vector< PointSpeedPair > & | points_and_target_speeds, | ||
const std::vector< carma_planning_msgs::msg::Maneuver > & | maneuvers, | ||
carma_planning_msgs::msg::VehicleState & | ending_state_before_buffer, | ||
const DetailedTrajConfig & | detailed_config | ||
) |
Adds extra centerline points beyond required message length to lane follow maneuver points so that there's always enough points to calculate trajectory (BUFFER POINTS SHOULD BE REMOVED BEFORE RETURNING FINAL TRAJECTORY)
wm | Pointer to intialized world model for semantic map access |
points_and_target_speeds | set of lane follow maneuver points to which buffer is added |
maneuvers | The list of lane follow maneuvers which were converted to geometry points and associated speed |
ending_state_before_buffer | reference to Vehicle state, which is state before applying extra points for curvature calculation that are removed later |
detailed_config | Basic autonomy struct defined to load detailed config parameters from tactical plugins |
Definition at line 225 of file basic_autonomy.cpp.
References BASIC_AUTONOMY_LOGGER, basic_autonomy::waypoint_generation::DetailedTrajConfig::buffer_ending_downtrack, epsilon_, process_bag::i, basic_autonomy::waypoint_generation::PointSpeedPair::point, and basic_autonomy::waypoint_generation::PointSpeedPair::speed.
Referenced by create_geometry_profile(), and light_controlled_intersection_tactical_plugin::LightControlledIntersectionTacticalPlugin::createGeometryProfile().
std::vector< double > basic_autonomy::waypoint_generation::apply_response_lag | ( | const std::vector< double > & | speeds, |
const std::vector< double > | downtracks, | ||
double | response_lag | ||
) |
Applies a specified response lag in seconds to the trajectory shifting the whole thing by the specified lag time.
speeds | Velocity profile to shift. The first point should be the current vehicle speed |
downtrack | Distance points for each velocity point. Should have the same size as speeds and start from 0 |
response_lag | The lag in seconds before which the vehicle will not meaningfully accelerate |
Definition at line 1297 of file basic_autonomy.cpp.
Referenced by process_trajectory_plan().
std::vector< double > basic_autonomy::waypoint_generation::apply_speed_limits | ( | const std::vector< double > | speeds, |
const std::vector< double > | speed_limits | ||
) |
Applies the provided speed limits to the provided speeds such that each element is capped at its corresponding speed limit if needed.
speeds | The speeds to limit |
speed_limits | The speed limits to apply. Must have the same size as speeds |
Definition at line 616 of file basic_autonomy.cpp.
References BASIC_AUTONOMY_LOGGER, and process_bag::i.
Referenced by compose_lanefollow_trajectory_from_path(), and stop_controlled_intersection_tactical_plugin::StopControlledIntersectionTacticalPlugin::compose_trajectory_from_centerline().
std::vector< PointSpeedPair > basic_autonomy::waypoint_generation::attach_past_points | ( | const std::vector< PointSpeedPair > & | points_set, |
std::vector< PointSpeedPair > | future_points, | ||
const int | nearest_pt_index, | ||
double | back_distance | ||
) |
Attaches back_distance length of points behind the future points.
points_set | all point speed pairs |
future_points | future points before which to attach the points |
nearest_pt_index | idx of the first future_point in points_set |
back_distance | the back distance to be added, in meters |
Definition at line 793 of file basic_autonomy.cpp.
References process_bag::i, and process_traj_logs::point.
Referenced by compose_lanefollow_trajectory_from_path(), and stop_controlled_intersection_tactical_plugin::StopControlledIntersectionTacticalPlugin::compose_trajectory_from_centerline().
DetailedTrajConfig basic_autonomy::waypoint_generation::compose_detailed_trajectory_config | ( | double | trajectory_time_length, |
double | curve_resample_step_size, | ||
double | minimum_speed, | ||
double | max_accel, | ||
double | lateral_accel_limit, | ||
int | speed_moving_average_window_size, | ||
int | curvature_moving_average_window_size, | ||
double | back_distance, | ||
double | buffer_ending_downtrack, | ||
std::string | desired_controller_plugin = "default" |
||
) |
Definition at line 1082 of file basic_autonomy.cpp.
References basic_autonomy::waypoint_generation::DetailedTrajConfig::back_distance, basic_autonomy::waypoint_generation::DetailedTrajConfig::buffer_ending_downtrack, basic_autonomy::waypoint_generation::DetailedTrajConfig::curvature_moving_average_window_size, basic_autonomy::waypoint_generation::DetailedTrajConfig::curve_resample_step_size, basic_autonomy::waypoint_generation::DetailedTrajConfig::desired_controller_plugin, basic_autonomy::waypoint_generation::DetailedTrajConfig::lateral_accel_limit, basic_autonomy::waypoint_generation::DetailedTrajConfig::max_accel, basic_autonomy::waypoint_generation::DetailedTrajConfig::minimum_speed, basic_autonomy::waypoint_generation::DetailedTrajConfig::speed_moving_average_window_size, and basic_autonomy::waypoint_generation::DetailedTrajConfig::trajectory_time_length.
Referenced by cooperative_lanechange::CooperativeLaneChangePlugin::plan_lanechange(), inlanecruising_plugin::InLaneCruisingPlugin::plan_trajectory_callback(), platooning_tactical_plugin::PlatooningTacticalPlugin::plan_trajectory_cb(), and light_controlled_intersection_tactical_plugin::LightControlledIntersectionTacticalPlugin::planTrajectoryCB().
GeneralTrajConfig basic_autonomy::waypoint_generation::compose_general_trajectory_config | ( | const std::string & | trajectory_type, |
int | default_downsample_ratio, | ||
int | turn_downsample_ratio | ||
) |
Definition at line 1109 of file basic_autonomy.cpp.
References basic_autonomy::waypoint_generation::GeneralTrajConfig::default_downsample_ratio, basic_autonomy::waypoint_generation::GeneralTrajConfig::trajectory_type, and basic_autonomy::waypoint_generation::GeneralTrajConfig::turn_downsample_ratio.
Referenced by cooperative_lanechange::CooperativeLaneChangePlugin::plan_lanechange(), inlanecruising_plugin::InLaneCruisingPlugin::plan_trajectory_callback(), platooning_tactical_plugin::PlatooningTacticalPlugin::plan_trajectory_cb(), and light_controlled_intersection_tactical_plugin::LightControlledIntersectionTacticalPlugin::planTrajectoryCB().
std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > basic_autonomy::waypoint_generation::compose_lanechange_trajectory_from_path | ( | const std::vector< PointSpeedPair > & | points, |
const carma_planning_msgs::msg::VehicleState & | state, | ||
const rclcpp::Time & | state_time, | ||
const carma_wm::WorldModelConstPtr & | wm, | ||
const carma_planning_msgs::msg::VehicleState & | ending_state_before_buffer, | ||
const DetailedTrajConfig & | detailed_config | ||
) |
Method converts a list of lanelet centerline points and current vehicle state into a usable list of trajectory points for trajectory planning for a Lane following maneuver.
points | The set of points that define the current lane the vehicle is in and are defined based on the request planning maneuvers. These points must be in the same lane as the vehicle and must extend in front of it though it is fine if they also extend behind it. |
state | The current state of the vehicle |
state_time | The abosolute time which the provided vehicle state corresponds to |
wm | The carma world model object which the vehicle is operating in. |
ending_state_before_buffer | The vehicle state before a buffer was added to the points. Used to revert the trajectory to required distance before returning. |
Definition at line 1124 of file basic_autonomy.cpp.
References BASIC_AUTONOMY_LOGGER, carma_wm::geometry::compute_arc_lengths(), compute_fit(), carma_wm::geometry::compute_tangent_orientations(), basic_autonomy::waypoint_generation::DetailedTrajConfig::curve_resample_step_size, basic_autonomy::waypoint_generation::DetailedTrajConfig::desired_controller_plugin, get_nearest_index_by_downtrack(), basic_autonomy::smoothing::moving_average_filter(), basic_autonomy::waypoint_generation::DetailedTrajConfig::speed_moving_average_window_size, split_point_speed_pairs(), and trajectory_from_points_times_orientations().
Referenced by cooperative_lanechange::CooperativeLaneChangePlugin::plan_lanechange().
std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > basic_autonomy::waypoint_generation::compose_lanefollow_trajectory_from_path | ( | const std::vector< PointSpeedPair > & | points, |
const carma_planning_msgs::msg::VehicleState & | state, | ||
const rclcpp::Time & | state_time, | ||
const carma_wm::WorldModelConstPtr & | wm, | ||
const carma_planning_msgs::msg::VehicleState & | ending_state_before_buffer, | ||
carma_debug_ros2_msgs::msg::TrajectoryCurvatureSpeeds & | debug_msg, | ||
const DetailedTrajConfig & | detailed_config | ||
) |
Method converts a list of lanelet centerline points and current vehicle state into a usable list of trajectory points for trajectory planning for a Lane following maneuver.
points | The set of points that define the current lane the vehicle is in and are defined based on the request planning maneuvers. These points must be in the same lane as the vehicle and must extend in front of it though it is fine if they also extend behind it. |
state | The current state of the vehicle |
state_time | The abosolute time which the provided vehicle state corresponds to |
Definition at line 865 of file basic_autonomy.cpp.
References apply_speed_limits(), attach_past_points(), basic_autonomy::waypoint_generation::DetailedTrajConfig::back_distance, BASIC_AUTONOMY_LOGGER, basic_autonomy::log::basicPointToStream(), process_traj_logs::c, carma_wm::geometry::compute_arc_lengths(), compute_curvature_at(), compute_fit(), carma_wm::geometry::compute_tangent_orientations(), constrain_to_time_boundary(), basic_autonomy::waypoint_generation::DetailedTrajConfig::curvature_moving_average_window_size, basic_autonomy::waypoint_generation::DetailedTrajConfig::curve_resample_step_size, basic_autonomy::waypoint_generation::DetailedTrajConfig::desired_controller_plugin, get_nearest_index_by_downtrack(), get_nearest_point_index(), basic_autonomy::waypoint_generation::DetailedTrajConfig::lateral_accel_limit, basic_autonomy::waypoint_generation::DetailedTrajConfig::max_accel, basic_autonomy::waypoint_generation::DetailedTrajConfig::minimum_speed, basic_autonomy::smoothing::moving_average_filter(), optimize_speed(), basic_autonomy::log::pointSpeedPairToStream(), basic_autonomy::log::printDebugPerLine(), basic_autonomy::log::printDoublesPerLineWithPrefix(), basic_autonomy::waypoint_generation::DetailedTrajConfig::speed_moving_average_window_size, split_point_speed_pairs(), trajectory_from_points_times_orientations(), basic_autonomy::waypoint_generation::DetailedTrajConfig::trajectory_time_length, process_traj_logs::x, and process_traj_logs::y.
Referenced by inlanecruising_plugin::InLaneCruisingPlugin::plan_trajectory_callback(), platooning_tactical_plugin::PlatooningTacticalPlugin::plan_trajectory_cb(), and light_controlled_intersection_tactical_plugin::LightControlledIntersectionTacticalPlugin::planTrajectoryCB().
double basic_autonomy::waypoint_generation::compute_curvature_at | ( | const basic_autonomy::smoothing::SplineI & | fit_curve, |
double | step_along_the_curve | ||
) |
Given the curvature fit, computes the curvature at the given step along the curve.
step_along_the_curve | Value in double from 0.0 (curvature start) to 1.0 (curvature end) representing where to calculate the curvature |
fit_curve | curvature fit |
Definition at line 855 of file basic_autonomy.cpp.
References basic_autonomy::smoothing::SplineI::first_deriv(), and basic_autonomy::smoothing::SplineI::second_deriv().
Referenced by compose_lanefollow_trajectory_from_path(), and stop_controlled_intersection_tactical_plugin::StopControlledIntersectionTacticalPlugin::compose_trajectory_from_centerline().
std::unique_ptr< basic_autonomy::smoothing::SplineI > basic_autonomy::waypoint_generation::compute_fit | ( | const std::vector< lanelet::BasicPoint2d > & | basic_points | ) |
Computes a spline based on the provided points.
basic_points | The points to use for fitting the spline |
Definition at line 818 of file basic_autonomy.cpp.
References BASIC_AUTONOMY_LOGGER.
Referenced by compose_lanechange_trajectory_from_path(), compose_lanefollow_trajectory_from_path(), stop_controlled_intersection_tactical_plugin::StopControlledIntersectionTacticalPlugin::compose_trajectory_from_centerline(), and resample_linestring_pair_to_same_size().
Eigen::Isometry2d basic_autonomy::waypoint_generation::compute_heading_frame | ( | const lanelet::BasicPoint2d & | p1, |
const lanelet::BasicPoint2d & | p2 | ||
) |
Returns a 2D coordinate frame which is located at p1 and oriented so p2 lies on the +X axis.
p1 | The origin point for the frame in the parent frame |
p2 | A point in the parent frame that will define the +X axis relative to p1 |
Definition at line 635 of file basic_autonomy.cpp.
References carma_wm::geometry::build2dEigenTransform().
std::vector< PointSpeedPair > basic_autonomy::waypoint_generation::constrain_to_time_boundary | ( | const std::vector< PointSpeedPair > & | points, |
double | time_span | ||
) |
Reduces the input points to only those points that fit within the provided time boundary.
points | The input point speed pairs to reduce |
time_span | The time span in seconds which the output points will fit within |
Definition at line 643 of file basic_autonomy.cpp.
References BASIC_AUTONOMY_LOGGER, carma_wm::geometry::compute_arc_lengths(), and split_point_speed_pairs().
Referenced by compose_lanefollow_trajectory_from_path(), and stop_controlled_intersection_tactical_plugin::StopControlledIntersectionTacticalPlugin::compose_trajectory_from_centerline().
std::vector< PointSpeedPair > basic_autonomy::waypoint_generation::create_geometry_profile | ( | const std::vector< carma_planning_msgs::msg::Maneuver > & | maneuvers, |
double | max_starting_downtrack, | ||
const carma_wm::WorldModelConstPtr & | wm, | ||
carma_planning_msgs::msg::VehicleState & | ending_state_before_buffer, | ||
const carma_planning_msgs::msg::VehicleState & | state, | ||
const GeneralTrajConfig & | general_config, | ||
const DetailedTrajConfig & | detailed_config | ||
) |
Creates geometry profile to return a point speed pair struct for LANE FOLLOW and LANE CHANGE maneuver types.
maneuvers | The list of maneuvers to convert to geometry points and calculate associated speed |
max_starting_downtrack | The maximum downtrack that is allowed for the first maneuver. This should be set to the vehicle position or earlier. If the first maneuver exceeds this then it's downtrack will be shifted to this value. |
wm | Pointer to intialized world model for semantic map access |
ending_state_before_buffer | reference to Vehicle state, which is state before applying extra points for curvature calculation that are removed later |
state | The vehicle state at the time the function is called |
general_config | Basic autonomy struct defined to load general config parameters from tactical plugins |
detailed_config | Basic autonomy struct defined to load detailed config parameters from tactical plugins |
Definition at line 24 of file basic_autonomy.cpp.
References add_lanefollow_buffer(), BASIC_AUTONOMY_LOGGER, create_lanefollow_geometry(), get_lanechange_points_from_maneuver(), and GET_MANEUVER_PROPERTY.
Referenced by cooperative_lanechange::CooperativeLaneChangePlugin::plan_lanechange(), inlanecruising_plugin::InLaneCruisingPlugin::plan_trajectory_callback(), and platooning_tactical_plugin::PlatooningTacticalPlugin::plan_trajectory_cb().
std::vector< lanelet::BasicPoint2d > basic_autonomy::waypoint_generation::create_lanechange_geometry | ( | lanelet::Id | starting_lane_id, |
lanelet::Id | ending_lane_id, | ||
double | starting_downtrack, | ||
double | ending_downtrack, | ||
const carma_wm::WorldModelConstPtr & | wm, | ||
int | downsample_ratio, | ||
double | buffer_ending_downtrack | ||
) |
Creates a vector of lane change points using parameters defined.
starting_lane_id | lanelet id for where lane change plan should start |
ending_lane_id | lanelet id for where lane change plan should end |
starting_downtrack | The downtrack distance from which the lane change maneuver starts |
ending_downtrack | The downtrack distance at which the lane change maneuver end |
wm | Pointer to intialized world model for semantic map access |
downsample_ratio | TODO: add description |
buffer_ending_downtrack | The additional downtrack beyond requested end dist used to fit points along spline |
Definition at line 319 of file basic_autonomy.cpp.
References BASIC_AUTONOMY_LOGGER, get_nearest_index_by_downtrack(), get_nearest_point_index(), process_bag::i, resample_linestring_pair_to_same_size(), and carma_cooperative_perception::to_string().
Referenced by get_lanechange_points_from_maneuver().
lanelet::BasicLineString2d basic_autonomy::waypoint_generation::create_lanechange_path | ( | const lanelet::ConstLanelet & | start_lanelet, |
const lanelet::ConstLanelet & | end_lanelet | ||
) |
Given a start and end point, create a vector of points fit through a spline between the points (using a Spline library)
start_lanelet | The lanelet from which lane change starts |
end_lanelet | The lanelet in which lane change ends |
std::vector< PointSpeedPair > basic_autonomy::waypoint_generation::create_lanefollow_geometry | ( | const carma_planning_msgs::msg::Maneuver & | maneuver, |
double | max_starting_downtrack, | ||
const carma_wm::WorldModelConstPtr & | wm, | ||
const GeneralTrajConfig & | general_config, | ||
const DetailedTrajConfig & | detailed_config, | ||
std::unordered_set< lanelet::Id > & | visited_lanelets | ||
) |
Converts a set of requested LANE_FOLLOWING maneuvers to point speed limit pairs.
maneuvers | The list of maneuvers to convert geometry points and calculate associated speed |
max_starting_downtrack | The maximum downtrack that is allowed for the first maneuver. This should be set to the vehicle position or earlier. If the first maneuver exceeds this then it's downtrack will be shifted to this value. |
wm | Pointer to intialized world model for semantic map access |
general_config | Basic autonomy struct defined to load general config parameters from tactical plugins |
detailed_config | Basic autonomy struct defined to load detailed config parameters from tactical plugins |
Definition at line 68 of file basic_autonomy.cpp.
References BASIC_AUTONOMY_LOGGER, carma_wm::geometry::concatenate_line_strings(), basic_autonomy::waypoint_generation::GeneralTrajConfig::default_downsample_ratio, process_bag::i, basic_autonomy::waypoint_generation::PointSpeedPair::point, basic_autonomy::waypoint_generation::PointSpeedPair::speed, and basic_autonomy::waypoint_generation::GeneralTrajConfig::turn_downsample_ratio.
Referenced by create_geometry_profile(), and light_controlled_intersection_tactical_plugin::LightControlledIntersectionTacticalPlugin::createGeometryProfile().
std::vector< lanelet::BasicPoint2d > basic_autonomy::waypoint_generation::create_route_geom | ( | double | starting_downtrack, |
int | starting_lane_id, | ||
double | ending_downtrack, | ||
const carma_wm::WorldModelConstPtr & | wm | ||
) |
Creates a Lanelet2 Linestring from a vector or points along the geometry.
starting_downtrack | downtrack along route where maneuver starts |
ending_downtrack | downtrack along route where maneuver starts |
wm | Pointer to intialized world model for semantic map access |
std::vector< PointSpeedPair > basic_autonomy::waypoint_generation::get_lanechange_points_from_maneuver | ( | const carma_planning_msgs::msg::Maneuver & | maneuver, |
double | max_starting_downtrack, | ||
const carma_wm::WorldModelConstPtr & | wm, | ||
carma_planning_msgs::msg::VehicleState & | ending_state_before_buffer, | ||
const carma_planning_msgs::msg::VehicleState & | state, | ||
const GeneralTrajConfig & | general_config, | ||
const DetailedTrajConfig & | detailed_config | ||
) |
Converts a set of requested LANE_CHANGE maneuvers to point speed limit pairs.
maneuvers | The list of maneuvers to convert |
max_starting_downtrack | The maximum downtrack that is allowed for the first maneuver. This should be set to the vehicle position or earlier. If the first maneuver exceeds this then it's downtrack will be shifted to this value. |
wm | Pointer to intialized world model for semantic map access |
ending_state_before_buffer | reference to Vehicle state, which is state before applying extra points for curvature calculation that are removed later |
state | The vehicle state at the time the function is called |
general_config | Basic autonomy struct defined to load general config parameters from tactical plugins |
detailed_config | Basic autonomy struct defined to load detailed config parameters from tactical plugins |
Definition at line 544 of file basic_autonomy.cpp.
References BASIC_AUTONOMY_LOGGER, basic_autonomy::waypoint_generation::DetailedTrajConfig::buffer_ending_downtrack, create_lanechange_geometry(), basic_autonomy::waypoint_generation::GeneralTrajConfig::default_downsample_ratio, get_nearest_index_by_downtrack(), basic_autonomy::waypoint_generation::DetailedTrajConfig::minimum_speed, basic_autonomy::waypoint_generation::PointSpeedPair::point, and basic_autonomy::waypoint_generation::PointSpeedPair::speed.
Referenced by create_geometry_profile().
int basic_autonomy::waypoint_generation::get_nearest_index_by_downtrack | ( | const std::vector< lanelet::BasicPoint2d > & | points, |
const carma_wm::WorldModelConstPtr & | wm, | ||
const carma_planning_msgs::msg::VehicleState & | state | ||
) |
Overload: Returns the nearest point to the provided vehicle pose in the provided list by utilizing the downtrack measured along the route NOTE: This function compares the downtrack, provided by routeTrackPos, of each points in the list to get the closest one to the given point's downtrack. Therefore, it is rather costlier method than comparing cartesian distance between the points and getting the closest. This way, however, the function correctly returns the end point if the given state, despite being valid, is farther than the given points and can technically be near any of them.
points | The points to evaluate |
state | The current vehicle state |
wm | The carma world model |
Definition at line 117 of file helper_functions.cpp.
References get_nearest_index_by_downtrack().
int basic_autonomy::waypoint_generation::get_nearest_index_by_downtrack | ( | const std::vector< lanelet::BasicPoint2d > & | points, |
const carma_wm::WorldModelConstPtr & | wm, | ||
double | target_downtrack | ||
) |
Returns the nearest "less than" point to the provided vehicle pose in the provided list by utilizing the downtrack measured along the route NOTE: This function compares the downtrack, provided by routeTrackPos, of each points in the list to get the closest one to the given point's downtrack. Therefore, it is rather costlier method than comparing cartesian distance between the points and getting the closest. This way, however, the function correctly returns the end point's index if the given state, despite being valid, is farther than the given points and can technically be near any of them.
points | BasicLineString2d points |
target_downtrack | target downtrack along the route to get index near to |
Definition at line 66 of file helper_functions.cpp.
References BASIC_AUTONOMY_LOGGER, and process_traj_logs::point.
Referenced by compose_lanechange_trajectory_from_path(), compose_lanefollow_trajectory_from_path(), stop_controlled_intersection_tactical_plugin::StopControlledIntersectionTacticalPlugin::compose_trajectory_from_centerline(), create_lanechange_geometry(), get_lanechange_points_from_maneuver(), and get_nearest_index_by_downtrack().
int basic_autonomy::waypoint_generation::get_nearest_index_by_downtrack | ( | const std::vector< PointSpeedPair > & | points, |
const carma_wm::WorldModelConstPtr & | wm, | ||
const carma_planning_msgs::msg::VehicleState & | state | ||
) |
Overload: Returns the nearest point to the provided vehicle pose in the provided list by utilizing the downtrack measured along the route NOTE: This function compares the downtrack, provided by routeTrackPos, of each points in the list to get the closest one to the given point's downtrack. Therefore, it is rather costlier method than comparing cartesian distance between the points and getting the closest. This way, however, the function correctly returns the end point's index if the given state, despite being valid, is farther than the given points and can technically be near any of them.
points | The points and speed pairs to evaluate |
state | The current vehicle state |
wm | The carma world model |
Definition at line 106 of file helper_functions.cpp.
References get_nearest_index_by_downtrack(), and split_point_speed_pairs().
int basic_autonomy::waypoint_generation::get_nearest_point_index | ( | const std::vector< lanelet::BasicPoint2d > & | points, |
const carma_planning_msgs::msg::VehicleState & | state | ||
) |
Returns the nearest point (in terms of cartesian 2d distance) to the provided vehicle pose in the provided l.
points | The points to evaluate |
state | The current vehicle state |
Definition at line 25 of file helper_functions.cpp.
References process_bag::i.
Referenced by compose_lanefollow_trajectory_from_path(), stop_controlled_intersection_tactical_plugin::StopControlledIntersectionTacticalPlugin::compose_trajectory_from_centerline(), and create_lanechange_geometry().
int basic_autonomy::waypoint_generation::get_nearest_point_index | ( | const std::vector< PointSpeedPair > & | points, |
const carma_planning_msgs::msg::VehicleState & | state | ||
) |
Returns the nearest point (in terms of cartesian 2d distance) to the provided vehicle pose in the provided list.
points | The points to evaluate |
state | The current vehicle state |
Definition at line 45 of file helper_functions.cpp.
References BASIC_AUTONOMY_LOGGER, and process_bag::i.
bool basic_autonomy::waypoint_generation::is_valid_yield_plan | ( | const std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > & | node_handler, |
const carma_planning_msgs::msg::TrajectoryPlan & | yield_plan | ||
) |
Helper function to verify if the input yield trajectory plan is valid.
node_handler | node of which time to compare against the trajectory's time |
yield_plan | input yield trajectory plan |
Definition at line 1316 of file basic_autonomy.cpp.
Referenced by modify_trajectory_to_yield_to_obstacles().
std::pair< double, size_t > basic_autonomy::waypoint_generation::min_with_exclusions | ( | const std::vector< double > & | values, |
const std::unordered_set< size_t > & | excluded | ||
) |
Returns the min, and its idx, from the vector of values, excluding given set of values.
values | vector of values |
excluded | set of excluded values |
Definition at line 679 of file basic_autonomy.cpp.
References process_bag::i.
Referenced by optimize_speed().
carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr basic_autonomy::waypoint_generation::modify_trajectory_to_yield_to_obstacles | ( | const std::shared_ptr< carma_ros2_utils::CarmaLifecycleNode > & | node_handler, |
const carma_planning_msgs::srv::PlanTrajectory::Request::SharedPtr & | req, | ||
const carma_planning_msgs::srv::PlanTrajectory::Response::SharedPtr & | resp, | ||
const carma_ros2_utils::ClientPtr< carma_planning_msgs::srv::PlanTrajectory > & | yield_client, | ||
int | yield_plugin_service_call_timeout | ||
) |
Applies a yield trajectory to the original trajectory set in response.
node_handler | a node interface to use the logger and time |
req | The service request containing the maneuvers to plan trajectories for and current vehicle state |
resp | The original response containing the planned trajectory to be modified |
yield_client | yield_client to call for |
yield_plugin_service_call_timeout | yield client's timeout in milliseconds int |
Definition at line 1339 of file basic_autonomy.cpp.
References is_valid_yield_plan().
Referenced by inlanecruising_plugin::InLaneCruisingPlugin::plan_trajectory_callback(), stop_and_wait_plugin::StopandWait::plan_trajectory_cb(), and light_controlled_intersection_tactical_plugin::LightControlledIntersectionTacticalPlugin::planTrajectoryCB().
std::vector< double > basic_autonomy::waypoint_generation::optimize_speed | ( | const std::vector< double > & | downtracks, |
const std::vector< double > & | curv_speeds, | ||
double | accel_limit | ||
) |
Applies the longitudinal acceleration limit to each point's speed.
downtracks | downtrack distances corresponding to each speed |
curv_speeds | vehicle velocity in m/s. |
accel_limit | vehicle longitudinal acceleration in m/s^2. |
Definition at line 699 of file basic_autonomy.cpp.
References process_bag::i, min_with_exclusions(), and basic_autonomy::log::printDoublesPerLineWithPrefix().
Referenced by compose_lanefollow_trajectory_from_path().
autoware_auto_msgs::msg::Trajectory basic_autonomy::waypoint_generation::process_trajectory_plan | ( | const carma_planning_msgs::msg::TrajectoryPlan & | tp, |
double | vehicle_response_lag | ||
) |
Given a carma type of trajectory_plan, generate autoware type of trajectory accounting for speed_lag and stopping case Generated trajectory is meant to be used in autoware.auto's pure_pursuit library using set_trajectory() function.
tp | trajectory plan from tactical plugins |
Definition at line 1196 of file basic_autonomy.cpp.
References apply_response_lag(), BASIC_AUTONOMY_LOGGER, process_bag::i, process_traj_logs::x, and process_traj_logs::y.
Referenced by trajectory_follower_wrapper::TrajectoryFollowerWrapperNode::autoware_info_timer_callback(), pure_pursuit_wrapper::PurePursuitWrapperNode::generate_command(), and platooning_control::PlatooningControlPlugin::generate_control_signals().
std::vector< std::vector< lanelet::BasicPoint2d > > basic_autonomy::waypoint_generation::resample_linestring_pair_to_same_size | ( | std::vector< lanelet::BasicPoint2d > & | line_1, |
std::vector< lanelet::BasicPoint2d > & | line_2 | ||
) |
Resamples a pair of basicpoint2d lines to get lines of same number of points.
line_1 | a vector of points to be resampled |
line_2 | a vector of points to be resampled |
Definition at line 482 of file basic_autonomy.cpp.
References BASIC_AUTONOMY_LOGGER, carma_wm::geometry::compute_arc_lengths(), compute_fit(), and process_bag::i.
Referenced by create_lanechange_geometry().
void basic_autonomy::waypoint_generation::split_point_speed_pairs | ( | const std::vector< PointSpeedPair > & | points, |
std::vector< lanelet::BasicPoint2d > * | basic_points, | ||
std::vector< double > * | speeds | ||
) |
Helper method to split a list of PointSpeedPair into separate point and speed lists.
points | Point Speed pair to split |
basic_points | points vector to be filled |
speeds | speeds vector to be filled |
Definition at line 92 of file helper_functions.cpp.
Referenced by compose_lanechange_trajectory_from_path(), compose_lanefollow_trajectory_from_path(), stop_controlled_intersection_tactical_plugin::StopControlledIntersectionTacticalPlugin::compose_trajectory_from_centerline(), constrain_to_time_boundary(), and get_nearest_index_by_downtrack().
std::vector< carma_planning_msgs::msg::TrajectoryPlanPoint > basic_autonomy::waypoint_generation::trajectory_from_points_times_orientations | ( | const std::vector< lanelet::BasicPoint2d > & | points, |
const std::vector< double > & | times, | ||
const std::vector< double > & | yaws, | ||
rclcpp::Time | startTime, | ||
const std::string & | desired_controller_plugin | ||
) |
Method combines input points, times, orientations, and an absolute start time to form a valid carma platform trajectory.
NOTE: All input vectors must be the same size. The output vector will take this size.
points | The points in the map frame that the trajectory will follow. Units m |
times | The times which at the vehicle should arrive at the specified points. First point should have a value of 0. Units s |
yaws | The orientation the vehicle should achieve at each point. Units radians |
startTime | The absolute start time which will be used to update the input relative times. Units s |
desired_controller_plugin | The name of the controller plugin for the generated trajectory. |
Definition at line 762 of file basic_autonomy.cpp.
References process_bag::i.
Referenced by compose_lanechange_trajectory_from_path(), compose_lanefollow_trajectory_from_path(), and stop_controlled_intersection_tactical_plugin::StopControlledIntersectionTacticalPlugin::compose_trajectory_from_centerline().
|
static |
Definition at line 62 of file basic_autonomy.hpp.
Referenced by add_lanefollow_buffer(), apply_speed_limits(), compose_lanechange_trajectory_from_path(), compose_lanefollow_trajectory_from_path(), compute_fit(), constrain_to_time_boundary(), create_geometry_profile(), create_lanechange_geometry(), create_lanefollow_geometry(), get_lanechange_points_from_maneuver(), get_nearest_index_by_downtrack(), get_nearest_point_index(), process_trajectory_plan(), and resample_linestring_pair_to_same_size().
const double basic_autonomy::waypoint_generation::epsilon_ = 0.0000001 |
Definition at line 24 of file helper_functions.hpp.
Referenced by add_lanefollow_buffer().