Class FrenetOptimalTrajectory

Class Documentation

class FrenetOptimalTrajectory

Public Functions

FrenetOptimalTrajectory()

Constructor for the FrenetOptimalTrajectory class.

void initialize(const float &max_road_width, const float &delta_road_width, const float &path_point_distance, const float &max_path_lenght, const float &min_path_lenght, const float &delta_path_lenght, const float &robot_radius, const float &k_jerk, const float &k_lenght, const float &k_distance, const float &min_look_ahead, const float &look_ahead_gain, const float &speed_decay_factor, const float &min_speed_reduction_gain, const float &decay_last_d_factor, const float &weight_last_d)

Constructor for the FrenetOptimalTrajectory class. Initializes parameters for calculating the optimal trajectory in Frenet coordinates.

Parameters:
  • max_road_width – Maximum width of the road for lateral movement.

  • delta_road_width – Lateral step size for road width sampling.

  • path_point_distance – Time step for trajectory generation.

  • max_path_lenght – Maximum prediction time.

  • min_path_lenght – Minimum prediction time.

  • delta_path_lenght – Longitudinal speed step size for sampling.

  • robot_radius – Radius of the robot for collision checking.

  • k_jerk – Weight factor for jerk cost.

  • k_lenght – Weight factor for time cost.

  • k_distance – Weight factor for distance cost.

  • min_look_ahead – Minimum look-ahead distance.

  • look_ahead_gain – Proportional gain to speed for look-ahead.

  • speed_decay_factor – Speed decay factor for path not found.

  • min_speed_reduction_gain – Minimum speed reduction gain for path not found.

  • decay_last_d_factor – Weight factor for the last lateral displacement.

  • weight_last_d – Weight factor for the last lateral displacement.

std::tuple<FrenetPath, float, float> plan(CubicSpline2d &csp, float s_start, float c_speed, float current_d, const std::vector<std::tuple<float, float>> &ob)

Plans the optimal Frenet path for overtaking.

Parameters:
  • csp – CubicSpline instance representing the reference path.

  • s_start – Initial longitudinal position on the path.

  • c_speed – Current speed of the vehicle.

  • current_d – Initial lateral displacement from the reference path.

  • ob – List of obstacles as tuples (x, y) in global coordinates.

Returns:

Tuple containing the optimal Frenet path and x and y position of target point.

std::tuple<FrenetPath, float, float> plan_detector(CubicSpline2d &csp, float s_start, float c_speed, float current_d, const std::vector<float> &right_border, const std::vector<float> &left_border, const std::vector<float> &s_spline, const std::vector<std::tuple<float, float, float>> &ob)

Plans the optimal Frenet path for overtaking considering the road borders and the detected obstacles.

Parameters:
  • csp – CubicSpline instance representing the reference path.

  • s_start – Initial longitudinal position on the path.

  • c_speed – Current speed of the vehicle.

  • current_d – Initial lateral displacement from the reference path.

  • right_border – Right border of the road.

  • left_border – Left border of the road.

  • s_spline – Longitudinal positions of the reference path.

  • ob – List of obstacles as tuples (x, y, radius) in global coordinates.

inline float get_speed_reduction_gain() const

Returns the speed reduction gain for the path not found.

Returns:

Speed reduction gain.