Closed paLeziart closed 6 months ago
Thanks a bunch @paLeziart for this contribution! I've kick-started the mpc_qpbenchmark test set with your contribution, to which I'll add the ones I have lying around for HRP-4 and Upkie. Feel free to share your thoughts on this test set and how we could improve it.
I'll add the ones I have lying around for HRP-4 and Upkie.
Closing this issue now that it is done.
Problem
I propose to add the following problem to the GitHub free-for-all test set. The problem can be built as follows by using the
CentroidalQuadruped
class:Parameter range
means the prediction horizon spans a single gait period, and that gait period is 16 * dt = 0.32 s. The gait period can be made longer by making the phase longer, like for T = 0.48s:
The prediction horizon can also include more than a single gait period:
Internal parameter range
There are a bunch of parameters in the
init
of the class whose values are those used for Solo-12. I disabled the regularization cost for the contact forces to know the optimal solution in simple standing cases (see below), but it can be set up to 5e-5 if you want.Motivation
This problem is interesting as centroidal model predictive problems are a well-known approach in the community of legged robots when the mass of the legs is not too important with respect to the one of the base.
Solution and optimal cost
Four feet in contact while staying in place
Parameters:
As the base starts horizontal and centered in the middle of the 4 contact points, if the contact force is vertical and perfectly distributed on the four contacts to compensate the gravity, the base will stay perfectly still without tilting.
Note that in practice the QP solves for x = [X-Xref F] for all time steps stacked together, so in term of result returned by the solver, for a prediction horizon with 3 steps it is
x = [X1-X1ref X2-X2ref X3-X3ref F0 F1 F2]
Two feet in contact while staying in place
Parameters:
As the base starts horizontal and centered in the middle of the 4 contact points, if the contact force is vertical and perfectly distributed on the two contacts to compensate the gravity, the base will stay perfectly still without tilting.
These optimal solutions are only valid when the contact force regularization coefficients are 0, otherwise there is a small trade-off between state tracking and applied forces.
Source code
https://gitlab.laas.fr/paleziart/quadruped-qp-problems
Testing
You can launch
centroidalMPC.py
to solve an example problem with OSQP and display a bunch of plots about state tracking and contact forces.References
1. Léziart, P. A. (2022). Locomotion control of a lightweight quadruped robot (Doctoral dissertation, UPS Toulouse).
See pages 91-95 for a description of the linear centroidal model predictive controller.