ami-iit / bipedal-locomotion-framework

Suite of libraries for achieving bipedal locomotion on humanoid robots
https://ami-iit.github.io/bipedal-locomotion-framework/
BSD 3-Clause "New" or "Revised" License
155 stars 38 forks source link

Add the integral term in the angular momentum task in tsid #466

Open GiulioRomualdi opened 3 years ago

GiulioRomualdi commented 3 years ago

Following @gabrielenava's suggestions in Stability Analysis and Design of Momentum-based Controllers for Humanoid Robots I noticed that adding an integral term in the angular momentum tasks allows improving the convergence performances of angular momentum to the desired value.

The integral will be computed numerically on the error by the update function however it is important that update is called only once by TSID otherwise the outcome of the integrator will be wrong.

What do you think @S-Dafarra @isorrentino @traversaro?

S-Dafarra commented 3 years ago

What did you have in mind?

traversaro commented 3 years ago

If the fix is not difficult, probably it is easier to discuss with the code?

GiulioRomualdi commented 3 years ago

There are two possible options:

  1. Add a method computeIntegral in the AngularMomentumTask. In this case, the user is in charge to call it. I'm not a big fan of this
  2. compute the integral in the update of the task. The update must be called only by the TSID. In this case the code will become (modulo hardcoded values)
    
    diff --git a/src/TSID/src/AngularMomentumTask.cpp b/src/TSID/src/AngularMomentumTask.cpp
    index dd459bc6..4ed96c21 100644
    --- a/src/TSID/src/AngularMomentumTask.cpp
    +++ b/src/TSID/src/AngularMomentumTask.cpp
    @@ -70,6 +70,8 @@ bool AngularMomentumTask::setVariablesHandler(const System::VariablesHandler& va
         iDynTree::toEigen(this->subA(contactWrench.variable)).rightCols<3>().setIdentity();
     }

@@ -162,10 +164,17 @@ bool AngularMomentumTask::update()

 m_isValid = false;
GiulioRomualdi commented 3 years ago

Furthermore, regarding the sampling period. Should we pass it through the parametersHandler?

traversaro commented 3 years ago

I am probably missing/not remembering something. Where are we running the PID of the star trick? Can't we have something similar for this?

DanielePucci commented 3 years ago

Concerning the addition of the integral term, I endorse its use in the on-line control loop. I just want to highlight that if we use pure integrations of the angular momentum instead of state-dependent approximations - see Remark 2 of Stability Analysis and Design of Momentum-based Controllers for Humanoid Robots - we may encounter the following issues:

GiulioRomualdi commented 3 years ago

Hi @DanielePucci, in the paper you linked the angular term called angular momentum integral is not equal to the integral of the angular momentum right? I was wandering on how to extend that work in a TSID framework instead of applying it in a pure momentum based controller. But I think we can discuss this as soon as I come back

DanielePucci commented 3 years ago

Sure Giulio, we can discuss F2F whenever you like, anyways I did not want to block the introduction of the angular momentum integral, but just raise some points that may occur, so feel free to proceed with the classical time-based integrations!

Other forms of non-linear integral I used back in time (see simulation results) can be found in Time sub-optimal nonlinear PI and PID controllers applied to longitudinal headway car control