I’m using AcadosOcpSolver to solve a non-linear MPC problem and after the ocp is solved I gain a optimal trajectory of future states and inputs. But when I use current state and the optimal input to integrate with AcadosSimSolver, the integrator outputs a different result from the optimal trajectory produced by AcadosOcpSolver.
Both solvers use ‘ERK’, and the optimal inputs that AcadosOcpSolver produces seem to make sense. But the system dynamic is a little complex so it’s hard to examine if the optimal states make sense.
Can anyone tell me if this is because I generated a wrong model? Or there are some extra tricks when using AcadosSimSolver?
Hi,
indeed the results should be the same.
However, in multiple shooting there are shooting node gaps, which correspond to the tolerance (tol_eq more specifically) on the dynamics (i.e. the res_eq in the solver statistics).
If those gaps are not fully closed, the trajectory in simulation and the one within the solver are expected to differ increasingly in time.
Hi,
I just want to know how do you set the states in both prediction model and simulation model? Should I keep the states in both two model consistent? Like the dimension of states should be same?
Hi,
You might set the initial state in the solver and use the same state and the optimal input in the simulation module. In the next time step, use the solution of the simulator as the initial state in the solver module. That might be how you can verify of your model!
Hope this would help!
Best,
Ruochen Li