-
Notifications
You must be signed in to change notification settings - Fork 38
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
CentroidalMPC incompatible with Casadi 3.6.7 #896
Comments
Probably related to:
|
But that seems already to be a vector, probably there is something wrong going on. |
You are right 🤔 |
I tried a simple test on Python to understand to reproduce the issue, but this works fine: import casadi
import numpy as np
opti = casadi.Opti()
x = opti.variable()
y = opti.variable()
xy = casadi.vertcat(x+1000.0, y+1000.0)
opti.minimize( (y-x**2)**2 )
opti.subject_to( casadi.mtimes(casadi.DM.eye(2),xy) >= casadi.DM.zeros(2,1) )
opti.subject_to( x+y>=1 )
opti.solver('ipopt')
sol = opti.solve()
print(sol.value(x))
print(sol.value(y)) |
I'm able to reproduce the issue on my PC. I'm trying to understand why this is happening |
The problem is this line: bipedal-locomotion-framework/src/ReducedModelControllers/src/CentroidalMPC.cpp Lines 939 to 943 in 3f19707
|
this->opti.subject_to(
0 <= casadi::MX::mtimes(casadi::MX::reshape(contact.orientation(Sl(), i),
3,
3),
corner.force(Sl(), i)(2))); should be this->opti.subject_to(
0 <= casadi::MX::mtimes(casadi::MX::reshape(contact.orientation(Sl(), i),
3,
3),
corner.force(Sl(), i))(2)); I'm wondering how it has worked so far @mebbaid @evelyd @LoreMoretti |
I tried to run the test without and with the fix on my setup
after the fix
With the fix, the number of constraints increases. So I think before the fix the constraints were just discarded |
So the limit on the normal force was not restricted to be positive always, but somehow it finds positive normal forces. In my case there is also an additional constraint on the force here https://github.com/mebbaid/bipedal-locomotion-framework/blob/0fdd9c605f6f7dd3d9d67fb631c5a813c9ff3509/src/ReducedModelControllers/src/CentroidalMPC.cpp#L1287-L1292 which may explain it, since we already have a positive force coming from this term computation https://github.com/mebbaid/bipedal-locomotion-framework/blob/0fdd9c605f6f7dd3d9d67fb631c5a813c9ff3509/src/ReducedModelControllers/src/CentroidalMPC.cpp#L1282-L1284 But in the nominal case I am not sure why we do not need to limit the normal force from below |
On possibility is that even if the constraint is discarded, this cost term https://github.com/mebbaid/bipedal-locomotion-framework/blob/0fdd9c605f6f7dd3d9d67fb631c5a813c9ff3509/src/ReducedModelControllers/src/CentroidalMPC.cpp#L1356-L1361 somehow ensures that it is always non-negative ? |
Casadi 3.6.7 was released yesterday and landed on conda-forge with conda-forge/casadi-feedstock#125. Unfortunately, it introduces some breaking changes and our software does not work anymore (CentroidalMPC) https://github.com/ami-iit/bipedal-locomotion-framework/actions/runs/11123408780/job/30906799659?pr=895#step:11:128
The text was updated successfully, but these errors were encountered: