Can you please tell how did you obtain the exact discrete model from continuous one? I can imagine you expanded around theta + sampling time * theta_dot, which is omega, but the confusion arises from the presence of omega(k) in the denominator, for both x(k+1) and y(k+1)...
Hi, shouldn't change the computations of the next initial state in the function shift.m to use RK method too? variable f that we have passed to the function is the same for two methods f = Function('f',{states,controls},{rhs});
@@MohamedWMehrez Thank you! I am currently also writing a MPC code. However, I still currently have big problems and can not find my error. Could you help me with this? It is the same procedure but it is a different use case
No change is needed to the shift function. We simply changed f which we pass to the shift function and works the same way as f from Euler discretization.
This can be done by adding (the difference between the estimate of the state at time k-N and the corresponding optimization variable for the state at that time) to the cost variable.
Dear Mr. Mehrez, could you please explain why we don't adapt the discretization in the shift function as well? In the shift function we compute the initial state also by a euler discretization, so why don't we use RK4 again?
Can you please tell how did you obtain the exact discrete model from continuous one? I can imagine you expanded around theta + sampling time * theta_dot, which is omega, but the confusion arises from the presence of omega(k) in the denominator, for both x(k+1) and y(k+1)...
By direct integration of the system model. That's not always possible for the dynamical systems in general.
Hi, shouldn't change the computations of the next initial state in the function shift.m to use RK method too? variable f that we have passed to the function is the same for two methods f = Function('f',{states,controls},{rhs});
I don't understand this either?
Yeah, you should. I am trying to find sometime to fix this on github.
Hi,
is it possible to get the whole code?
Would like to see how you implemented the OCP in Matlab.
Hi, Matlab code is linked in the video description. All the best!
@@MohamedWMehrez
Thank you!
I am currently also writing a MPC code. However, I still currently have big problems and can not find my error.
Could you help me with this?
It is the same procedure but it is a different use case
Hi,
did you also change the shift function with Runge Kutta 4th order? Does it even make any difference?
No change is needed to the shift function. We simply changed f which we pass to the shift function and works the same way as f from Euler discretization.
how we can add the arrival cost in this program with EK filter ?
This can be done by adding (the difference between the estimate of the state at time k-N and the corresponding optimization variable for the state at that time) to the cost variable.
Dear Mr. Mehrez, could you please explain why we don't adapt the discretization in the shift function as well? In the shift function we compute the initial state also by a euler discretization, so why don't we use RK4 again?
👍