|
Formula Student Autonomous Systems
The code for the main driverless system
|
class that defines the path smoothing algorithm More...
#include <smoothing.hpp>

Public Member Functions | |
| PathSmoothing ()=default | |
| Construct a new default Path Smoothing object. | |
| PathSmoothing (PathSmoothingConfig config) | |
| Construct a new Path Smoothing object with a given configuration. | |
| std::vector< PathPoint > | smooth_path (const std::vector< PathPoint > &path, bool is_path_closed) const |
| Smooths a path by fitting a B-spline through the input points. | |
| std::vector< PathPoint > | optimize_path (const std::vector< PathPoint > &path, const std::vector< PathPoint > &yellow_cones, const std::vector< PathPoint > &blue_cones) const |
| Optimizes a racing line path by fitting splines through track boundaries and applying quadratic programming optimization. | |
Private Member Functions | |
| std::vector< PathPoint > | filter_path (const std::vector< PathPoint > &path) const |
| Filters path points using a minimum spacing constraint. | |
| std::vector< PathPoint > | osqp_optimization (const std::vector< PathPoint > ¢er, const std::vector< PathPoint > &left, const std::vector< PathPoint > &right) const |
| Optimizes a path using quadratic programming (OSQP) to balance smoothness, curvature, and safety constraints. | |
| void | add_curvature_terms (int num_path_points, const std::function< int(int)> &circular_index, const std::function< void(int, int, double)> &add_coefficient) const |
| Adds curvature penalty terms to the quadratic objective function. | |
| void | add_slack_penalty_terms (int num_path_points, const std::function< void(int, int, double)> &add_coefficient) const |
| Adds penalty terms for slack variables to the quadratic objective function. | |
| void | add_slack_penalty_terms (std::map< std::pair< int, int >, double > &quadratic_terms, int num_path_points, const std::function< void(int, int, double)> &add_coefficient) const |
| Adds penalty terms for slack variables to the quadratic objective function. | |
| void | add_boundary_constraints (std::vector< OSQPFloat > &constraint_values, std::vector< OSQPInt > &constraint_row_indices, std::vector< OSQPInt > &constraint_col_indices, std::vector< OSQPFloat > &constraint_lower_bounds, std::vector< OSQPFloat > &constraint_upper_bounds, int &constraint_count, const std::vector< PathPoint > &left, const std::vector< PathPoint > &right, int num_path_points, double safety_margin) const |
| Adds track boundary constraints to ensure the optimized path stays within the track. | |
| void | add_slack_nonnegativity_constraints (std::vector< OSQPFloat > &constraint_values, std::vector< OSQPInt > &constraint_row_indices, std::vector< OSQPInt > &constraint_col_indices, std::vector< OSQPFloat > &constraint_lower_bounds, std::vector< OSQPFloat > &constraint_upper_bounds, int &constraint_count, int num_path_points) const |
| Adds non-negativity constraints for slack variables. | |
| void | convert_to_csc_format (const std::vector< OSQPFloat > &values, const std::vector< OSQPInt > &row_indices, const std::vector< OSQPInt > &col_indices, int total_variables, std::vector< OSQPFloat > &csc_x, std::vector< OSQPInt > &csc_i, std::vector< OSQPInt > &csc_p) const |
| Converts sparse matrix data from coordinate format to Compressed Sparse Column (CSC) format. | |
Private Attributes | |
| PathSmoothingConfig | config_ |
| configuration of the smoothing algorithm | |
class that defines the path smoothing algorithm
Definition at line 22 of file smoothing.hpp.
|
default |
Construct a new default Path Smoothing object.
|
inlineexplicit |
Construct a new Path Smoothing object with a given configuration.
Definition at line 34 of file smoothing.hpp.
|
private |
Adds track boundary constraints to ensure the optimized path stays within the track.
| constraint_values | Non-zero values in the constraint matrix |
| constraint_row_indices | Row indices for constraint matrix entries |
| constraint_col_indices | Column indices for constraint matrix entries |
| constraint_lower_bounds | Lower bounds for each constraint |
| constraint_upper_bounds | Upper bounds for each constraint |
| constraint_count | Running count of constraints added |
| left | Left track boundary points |
| right | Right track boundary points |
| num_path_points | Number of points in the path |
| safety_margin | Safety distance from track boundaries |
Definition at line 89 of file smoothing.cpp.

|
private |
Adds curvature penalty terms to the quadratic objective function.
| num_path_points | Number of points in the path |
| circular_index | Lambda function for circular array indexing |
| add_coefficient | Lambda function to add coefficients to the objective matrix |
Definition at line 42 of file smoothing.cpp.

|
private |
Adds non-negativity constraints for slack variables.
| constraint_values | Non-zero values in the constraint matrix |
| constraint_row_indices | Row indices for constraint matrix entries |
| constraint_col_indices | Column indices for constraint matrix entries |
| constraint_lower_bounds | Lower bounds for each constraint |
| constraint_upper_bounds | Upper bounds for each constraint |
| constraint_count | Running count of constraints added |
| num_path_points | Number of points in the path |
Definition at line 142 of file smoothing.cpp.

|
private |
Adds penalty terms for slack variables to the quadratic objective function.
| num_path_points | Number of points in the path |
| add_coefficient | Lambda function to add coefficients to the objective matrix |
Definition at line 78 of file smoothing.cpp.

|
private |
Adds penalty terms for slack variables to the quadratic objective function.
| quadratic_terms | Map storing quadratic coefficient terms |
| num_path_points | Number of points in the path |
| add_coefficient | Lambda function to add coefficients to the objective matrix |
|
private |
Converts sparse matrix data from coordinate format to Compressed Sparse Column (CSC) format.
CSC format is required by the OSQP solver for efficient matrix operations.
| values | Non-zero values in coordinate format |
| row_indices | Row indices in coordinate format |
| col_indices | Column indices in coordinate format |
| total_variables | Number of columns in the matrix |
| csc_x | Output: non-zero values in CSC format |
| csc_i | Output: row indices in CSC format |
| csc_p | Output: column pointers in CSC format |
Definition at line 161 of file smoothing.cpp.

|
private |
Filters path points using a minimum spacing constraint.
| path | Input path. |
Definition at line 31 of file smoothing.cpp.

| std::vector< PathPoint > PathSmoothing::optimize_path | ( | const std::vector< PathPoint > & | path, |
| const std::vector< PathPoint > & | yellow_cones, | ||
| const std::vector< PathPoint > & | blue_cones | ||
| ) | const |
Optimizes a racing line path by fitting splines through track boundaries and applying quadratic programming optimization.
| path | The initial center path to be optimized |
| yellow_cones | Track boundary markers on the right boundary |
| blue_cones | Track boundary markers on the left boundary |
Definition at line 14 of file smoothing.cpp.


|
private |
Optimizes a path using quadratic programming (OSQP) to balance smoothness, curvature, and safety constraints.
The function takes a center line and left/right boundaries, then computes an optimized path that minimizes curvature and jerk while staying within the track boundaries with a safety margin.
| center | Sequence of points representing the initial center line path |
| left | Sequence of points representing the left track boundary |
| right | Sequence of points representing the right track boundary |
Definition at line 194 of file smoothing.cpp.


| std::vector< PathPoint > PathSmoothing::smooth_path | ( | const std::vector< PathPoint > & | path, |
| bool | is_path_closed | ||
| ) | const |
Smooths a path by fitting a B-spline through the input points.
| path | The input path to be smoothed |
| is_path_closed | Whether the path is closed |
Definition at line 3 of file smoothing.cpp.


|
private |
configuration of the smoothing algorithm
Definition at line 65 of file smoothing.hpp.