tudoroancea / ihm2

Display of my skills in optimal control for autonomous race cars
MIT License
3 stars 0 forks source link

how to properly handle the track options for the controller #6

Closed tudoroancea closed 10 months ago

tudoroancea commented 1 year ago

Basically, each ocp solver will be generated for one track and only one track. When we switch tracks, we have to switch controllers.

tudoroancea commented 10 months ago

We can actually make the casadi interpolant class parametric (see this constructor). We can therefore only provide the grid points at generation time with

kappa_ref = interpolant("kappa_ref", "linear", [s_ref])

and define the dynamics using kappa_ref(s, kappa_ref_values) (instead of kappa_ref(s)) where kappa_ref_values is an SX/MX variable contained in the parameters of the AcadosModel. These parameters then only have to be set at runtime using the function ihm2_fkin6_acados_update_params().

Only caveat: the grid itself can also be a parameter but the size is determined at generation time. We therefore had (for the moment) to sample a fixed number of points on the center line of each track (5000 per lap to have at most 10cm resolution for the longest FS tracks of 500m).