I have been recently looking at this example in the acados repository.
I am interested in the kapparef_s variable, that thanks to the casadi’s utility function interpolant is possible to define a function (kapparef_s) of the curvature of the reference race-line with respect to the curvilinear variable s.
What I want to implement is something very similar, but with the constraint that the values of kapparef_s should be defined at startup without the need to recompile the model.
I will explain more in detail the problem. My current architecture is defining the dynamics and the ocp in python, then generating the C code and finally using it in my application (therefore, by compiling).
I’m asking if it is possible to define a general kapparef_s function in the python code (probably using casadi?), and then at runtime, in my application, change or fill in the new values of my kapparef_s (so, without the need to recompile the C code), since in my current problem formulation I can’t know the reference race-line a priori and recompilation is too much time consuming.
please check out CasADi’s bspline and blazing_spline functions (which allow you to define parametric references) together with global parameters. Global parameters were added only recently and allow you to define parameters which are global within your optimal control formulation (as opposed to stagewise-varying parameters) and allow for precomputation, i.e. all computations depending only on global parameters are done once when updating the parameter values. This allows for fast evaluation of the splines online.