-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add OSQP as an alternative solver in the contacts computation #10
Conversation
FYI in one month qpOASES will be removed by the robotology-superbuild: robotology/robotology-superbuild#239 (comment) . |
Thanks @traversaro for the reminder. The migration to OSQP should be easy once the change here is complete: the QP Simulink block will be called instead of the the programmatic call to |
1b234de
to
7b3767d
Compare
- Add option to select OSQP instead of quadprog - In `prepare_optimization_matrix()`, replaced single boundary `b` by double boundary `AxUb` and `AxLb`, and created the OSQP problem object. - Implemented in `compute_unilateral_linear_contact()` the setup(), update() and solve() steps for the OSQP solver. - Setting the environment variable `OSQP_MATLAB_PATH` is now required for finding the OSQP library (https://github.com/oxfordcontrol/osqp-matlab).
- We were setting `Px` to the full H (lower triangular part elements = 0) instead of the vector of only the upper triangular elements. - We were setting `Ax` to the upper triangular part of A, while the full A is required.
7b3767d
to
cf2adc7
Compare
@traversaro , as OSQP can be directly from MATLAB code, we went for OSQP right away. I've updated the PR description. |
How to validate this PR.The simulation should work as usual. |
I have tried and everything worked fine! I had only minor comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything worked fine! From my point of view, this PR can be merge once the comments have been addressed C.C. @Giulero
I would anyway add osqp as an external dependency in the main ReadMe to avoid future problems (as well as the fact that now you need to add the variable OSQP_MATLAB_PATH to your bashrc)
I guess the README needs to be updated to describe how OSQP is supposed to be installed. |
Sorry, I had not saw the @CarlottaSartore comment in #10 (review) . |
Thanks @nunoguedelha! Everything went smooth :) |
Damn, I just realized there is something wrong with the behavior. When the right foot heel touches the ground, the foot doesn't rotate. This only happens when I use both steps Looking into it now. |
…of stepImpl because update() is bugged. - There is an issue with the OSQP library update() step, or the documentation is missing something. Opened issue #12 for further analysis.
Unlike what I believed (by following the OSQP HowTo), probably the
There is an issue either with OSQP library C code (the bindings MATLAB code looks fine after some checks and tests), either with the documentation which is missing something. Opened issue #12 . Will document better later. Pushed a workaround using always |
The initial idea was to replace quadprog with qpOASES, but since it will soon be deprecated from the superbuild (refer to this comment, we went for OSQP, which actually can be directly called from MATLAB code, i.e. from the class method
Contacts.compute_unilateral_linear_contact
.The changes are:
prepare_optimization_matrix()
, replaced single boundaryb
bydouble boundary
AxUb
andAxLb
, and created the OSQP problem object.compute_unilateral_linear_contact()
the setup(), update()and solve() steps for the OSQP solver.
OSQP_MATLAB_PATH
is now required forfinding the OSQP library (https://github.com/oxfordcontrol/osqp-matlab).
References
https://osqp.org/docs/index.html
https://osqp.org/docs/get_started/matlab.html
https://osqp.org/docs/interfaces/matlab.html#matlab-interface