The python code in this project is used to generate C and C++ libraries that provide discretized car dynamics. In the current state, one can simulate a tenth-scale chassis with drive-train and tire friction dynamics.
Given the current velocities of a car body, vertical loads on the wheels and the controls (throttle and steering angles), this software can calculate the movement of the car in the form of force and torque to be applied to the car within the next millisecond.
The CMakeLists.txt is set up so that the code is automatically re-generated using acados when the Python files are changed.
mkdir -p build/
cd build/
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j6
The build output to be linked in a C project consists of the
libacados_sim_solver_car.so
library.
Refer to the acados API documentation on how to use it.
The build output to be linked in a C++ project consists of the
libcar_physics_pacejka.so
library (see CMakeLists.txt) and the
libacados_sim_solver_car.so
library.
A simple C++ interface CarSimulation.h/.cpp
is build into
the library libcar_physics_pacejka.so
which handles the interaction
with the acados solver in the other library.
States: $v_x, vy, r, \omega, \omega{f \triangle}, \omega_{r \triangle}$
Linear velocities, angular velocity, motor velocity, differential velocities
Controls: $DC, \delta{fl},\delta{fr},\delta{rl},\delta{rr}$
Duty cycle, steering angles
Spatial states: $v_x, v_y, r$
Drive-train states: $\omega, \omega{f \triangle}, \omega{r \triangle}$
$\omega{f \triangle}, \omega{r \triangle}$ are the relative velocities
in-between front wheels and in-between rear wheels respectively.