Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
default_aero_model.cpp
Go to the documentation of this file.
2
3Eigen::Vector3d DefaultAeroModel::aero_forces(const Eigen::Vector3d& velocity) const {
4 const double vx = velocity[0];
5 const double vy = velocity[1];
6
7 const double air_density = 1.225; // [kg/m^3] TODO (maybe): make this a parameter
8 const double frontal_area = this->car_parameters_->aero_parameters.frontal_area; // [m^2]
9 const double drag_coefficient = this->car_parameters_->aero_parameters.drag_coefficient;
10 const double side_force_coefficient =
11 this->car_parameters_->aero_parameters.aero_side_force_coefficient;
12 const double lift_coefficient = this->car_parameters_->aero_parameters.lift_coefficient;
13
14 // Drag force (opposes vx)
15 const double Fx = -0.5 * air_density * frontal_area * drag_coefficient * vx * std::abs(vx);
16
17 // Side force (opposes vy)
18 const double Fy = -0.5 * air_density * frontal_area * side_force_coefficient * vy * std::abs(vy);
19
20 // Downforce/Lift
21 const double Fz = -0.5 * air_density * frontal_area * lift_coefficient * vx * vx;
22
23 return Eigen::Vector3d(Fx, Fy, Fz);
24}
std::shared_ptr< common_lib::car_parameters::CarParameters > car_parameters_
Eigen::Vector3d aero_forces(const Eigen::Vector3d &velocity) const override
Calculate the aero forces.