-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extracting feedback-gain matrices from d_ocp_qp_ipm_ws #76
Comments
Update: I noticed that the above extraction of TVLQR-feedback works also for the first-stage, if I set the settings flag ric_alg=1 via |
Hi, that's a good hint! When I'll look into adding a proper getter to get the feedback matrix, such that this works regardless of the algorithm used (and if the algorithm is changed again in the future), following what I wrote in the other issue. Get back on that soon! |
Hi @giaf, |
Ok, these days here we had a group retreat and now I'm going on holidays for a few days, so it will need a bit more time. Btw, what is this peace of code doing? I'm not familiar with eigen
Is Anyway, I will study the references you sent me, to be sure to implement exactly what is needed. |
Thanks a lot @giaf, there is no urgency here. |
Hi Markus, I added the getters, an example of the usage is here There are getters for the matrices
(where the inverse is only for mathematical notation and it should be replaced by a solution of a triangular system). There are getters also for the vectors
(where the inverse is only for mathematical notation and it should be replaced by a solution of a triangular system). |
Thanks for the quick implementation @giaf ! |
@giaf I was able to test the new getters and am glad to confirm that they match exactly what I needed! A quick clarification:
Is this what you had in mind? In any case, it matches the quantity that I had cited above! |
Yes sorry, this is what I meant! |
Great! Do you think it would make sense to fast-forward hpipm release 0.1.1 to include these changes? |
It doesn't make sense now, since I'm also in the middle of some work on QCQP. That stuff has rather high priority, so I would expect to finalize it in the next few weeks. At that point, I would advance the version to 0.1.2. For now the best option for you would be to refer to the current commit 806c845 |
Okay, that sounds good to me! I wil get notified about the new release automatically anyway. All the best, and thanks again! |
@markusgft I recently did some more work on this, now there are also routines to directly get the feedback gains K and k. All these routines now also work for the constrained case, and their API is slightly changed now, in case you want to upgrade. |
Hi @giaf, thanks for the heads up!
Do you think it makes sense for you to adapt the computation of K[0] on hpipm side? Thanks in advance! |
Hi @markusgft thanks for the feedback! |
Hi @giaf, sure!
I hope that helps! |
Ok then this is the reason for If you keep |
Thank you @giaf for the clarification. |
Dear @giaf ,
in closed-loop single shooting SQP algorithms, like iLQR, we usually use the time-varying LQR feedback from the riccati recursion to forward simulate the system dynamics (generate a roll-out) in the next SQP iteration.
Here is an example how I reconstructed the LQR-feedback gains from the ocp_qp_ipm workspace after successful OCP solution (code), based on the ct-v2 tag of hpipm:
For all stages except for the first one, i.e. i=2,...,N
For the first time-step, i=0, it was not so straightforward, in fact we had to reconstruct the feedback gain for the first stage methodically:
In above code, A_ and B_ refer to LTV-system matrices at respective stages, and P_ is obviously the second-order cost cross-term from an LQ OCP problem. TVLQR_K_ is the desired feedback matrix, and the ocp workspace is denoted "workspace_".
Now to the question: the issue is, that with the newest HPIPM release, I can still successfully reconstruct the TVLQR-feedback for stages 2...N, but it seems that the content of workspace_.L[0] has changed ? I fail in reconstructing appropriate TVLQR-feedback for the first time step.
Sorry for the lengthy introduction -- but would you mind commenting on as to what extent the meaning of the first entry of L, i.e. L[0], has changed in the workspace?
Thanks a lot in advance and all the best!
The text was updated successfully, but these errors were encountered: