Hi, I hope this message finds this community well. I currently have a control problem with MPC, where controlling ‘u’ is the solution I need to obtain through an optimization problem. However, because my predictive model requires a control ‘u’ with temporal information,such as x_{n+1}=f(x_{t_0{\sim}t_{T_1}},u_{t_0{\sim}t_{T_1}}).Therefore, within a loop iteration for an MPC problem with a prediction horizon of T_2, predictions need to be made as follows:
x_{1}=f(x_{t_0{\sim}t_{T_1}},u_{t_0{\sim}t_{T_1}})
x_{2}=f(x_{t_1{\sim}t_{1+T_1}},u_{t_1{\sim}t_{1+T_1}})
x_{3}=f(x_{t_2{\sim}t_{2+T_1}},u_{t_2{\sim}t_{2+T_1}})
Therefore, I require the format of my control input ‘u’ at each prediction stage to be as follows. Assuming T_1=4 and T_2=4, we would need four sets of ‘u’.
u_{t_0{\sim}t_{4}}=[u_0,u_1,u_2,u_3,u_4]
u_{t_1{\sim}t_{5}}=[u_1,u_2,u_3,u_4,u_5]
u_{t_2{\sim}t_{6}}=[u_2,u_3,u_4,u_5,u_6]
u_{t_3{\sim}t_{7}}=[u_3,u_4,u_5,u_6,u_7]
At the beginning, where u_0, u_1, u_2, u_3 serve as the initial conditions for the entire optimization problem. The variables to be optimized are u_4, u_5, u_6, u_7. I am currently using the acados solver, how should I configure my model to meet the requirements for the control inputs. Thanks for reading and glad for your help.
Hi,
I seems related to your other post Using temporal convolutional Neural networks in acados
You can augment your system dynamics by auxiliary states in order to “remember” control inputs from previous stages. This can be implemented with the discrete dynamics module.
Overall, the acados OCP solver is really made for the classic OCP structure, in which each control only acts on the current stage.
Best,
Jonathan
Hi Jonathan,
Thanks for your enlightening answer. But I tried to find an example of using a discrete dynamics module in Acados and I found the answer in another post https://discourse.acados.org/t/discrete-dynamics/201/2. However the answer in this post seems invalid. It would be very nice if you could show me an example of using discrete dynamics in Acados with a Python interface.
Thanks for the amazing work you did!!!
Best regards,
Ryan
Hi Ryan,
You are welcome!
Here is an example with discrete dynamics: acados/examples/acados_python/pendulum_on_cart/ocp/example_ocp_dynamics_formulations.py at afe921cbd368543a7fe243d05e5378fcad9ea7f9 · acados/acados · GitHub
Best,
Jonathan
Thanks for your great work!!
Cheers,
Jonathan