Hi, I’m using the python interface of acados to do NMPC.
I’m wondering if it is possible to make use of SQP_RTI directly from python to control my robot.
Right now I’m just simulating my system following this example
I assume that the two phases refer to the preparation phase of RTI (to do before the current state is available) and the second phase is when the solution is “adapted” to the current state. Is it correct?
In my simulations I find that the second phase is the most time consuming, I would expect the opposite, but is it something you would deem normal?
Exactly. The rti_phase value has the following 3 values:
(1) preparation, (2) feedback, (0) both.
About how long the phases should take and if everything that can be is carried out in the preparation phase, I am not sure.
I also don’t know how the ratio for preparation and feedback time typically is. If you can point to some paper, where you got your intuition from, that would be interesting.
I don’t think they explicitly say that the preparation phase should be more time consuming than the feedback phase. Surely the feedback phase consists in a QP and therefore will always require some time, while the preparation phase may not be “necessary” if it were a linear MPC.
I guess what suggested me that idea was figure 3, but that’s just a visualization so I shouldn’t read too much into only that.
I wanted to be sure that I was setting the solver properly because I would have expected the feedback phase to take less, being it “only” a QP, but the more I think about it the more I understand that that’s just what it is.
I would like to implement RTI scheme separating preparation and feedback phase on my robot. I have implemented interface in c++ to call c generated acados solver.
In my case phase 1 takes generally more time than phase 2
I was wondering if you managed to implement this on your robot with python.
Moreover do you use multi threading to run phase 1 while sending controls to the robot and waiting for feedback for phase 2? Can you please let me know what is the correct way in this scenario?
This is good I guess.
The idea is to carry out as much as possible in the preparation phase to have a very fast feedback phase.
By “waiting for feedback for phase 2”, I guess you mean waiting for the new state estimate in order to carry out the feedback phase.
I think Figure 1.7 in this PhD thesis gives a good on how preparation and feedback should be carried out.
The typically more CPU intensive preparation phase is performed with a predicted state, before the current state estimate is even available. This part of the algorithm is naturally parallelizable, because each linearization for i= 0,…,N−1in steps 1-2 can be done independently and therefore in parallel.
Acados has parallelization for this based on OpenMP.
I think it is only supported from the Make build system for now though.