Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
velocity_planning.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cmath>
4
7
9
24public:
29 VelocityPlanning() = default;
34 explicit VelocityPlanning(VelocityPlanningConfig config) : config_(config) {}
35
41 void set_velocity(std::vector<PathPoint> &final_path);
42
48 void trackdrive_velocity(std::vector<PathPoint> &final_path);
49
56 void stop(std::vector<PathPoint> &final_path, double braking_distance);
57
58private:
64
68 static constexpr double epsilon = 1e-9;
69
79 double find_curvature(const PathPoint &p1, const PathPoint &p2, const PathPoint &p3);
80
87 void point_speed(const std::vector<double> &curvatures, std::vector<double> &velocities);
88
96 void acceleration_limiter(const std::vector<PathPoint> &points, std::vector<double> &velocities,
97 const std::vector<double> &curvatures);
98
106 void braking_limiter(std::vector<PathPoint> &points, std::vector<double> &velocities,
107 const std::vector<double> &curvatures);
108};
Computes velocity profiles for a planned path based on curvature and dynamics constraints.
static constexpr double epsilon
Numerical tolerance for floating-point comparisons.
void acceleration_limiter(const std::vector< PathPoint > &points, std::vector< double > &velocities, const std::vector< double > &curvatures)
Limits velocities based on forward acceleration constraints and friction ellipse.
double find_curvature(const PathPoint &p1, const PathPoint &p2, const PathPoint &p3)
Computes the curvature at a point using the Menger curvature formula.
void point_speed(const std::vector< double > &curvatures, std::vector< double > &velocities)
Computes the maximum velocity at each point based on curvature constraints.
void braking_limiter(std::vector< PathPoint > &points, std::vector< double > &velocities, const std::vector< double > &curvatures)
Limits velocities based on backward braking constraints and friction ellipse.
VelocityPlanningConfig config_
configuration of the velocity planning algorithm
void stop(std::vector< PathPoint > &final_path, double braking_distance)
Applies a braking velocity profile starting after a given braking distance.
void set_velocity(std::vector< PathPoint > &final_path)
Assigns an velocity to each point of the path.
void trackdrive_velocity(std::vector< PathPoint > &final_path)
Computes velocity for trackdrive scenarios.
VelocityPlanning()=default
Construct a new default Velocity Planning object.
VelocityPlanning(VelocityPlanningConfig config)
Construct a new Velocity Planning object with a given configuration.
Configuration parameters for the Velocity Planning class.