Acados C++ real-time application

Hi :wave:

Recently, I am trying to apply MPC to the robot by acados, and I want to adjust the MPC model in real time. However, adjusting the model seems to require re-generating C code through python, because the robot is originally based on C++. I don’t know if this will affect real-time application or not.

Thanks for the help! :sparkles:

Hi :wave:

typically you can get around this issue by introducing additional parameters p in your model definition, which you can update online!
For example, you could define a model f(x, u, p) = p f_1(x, u) + (1-p) f_2(x, u) and by setting p=1 or p=2 you can switch from model f_1 to f_2 without requiring to recompile your solver.

Best, Katrin

I’m very sorry for replying you so late, and I recently feel a bit slack :confounded: and focus on other things. I can understand what you say, but I couldn’t find how to change the additional parameters p in C++ interface. I’m not very familiar with Acados C++ interface, can you give me some guidance? Thanks!

Best, Chen