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
146 stars 37 forks source link

Add the possibility to call the TimeVaryingDCMPlanner even if the contact list does not start from zero #222

Open GiulioRomualdi opened 3 years ago

GiulioRomualdi commented 3 years ago

I was debugging the TimeVaryingDCMPlanner with @paolo-viceconte and we noticed that the planner was not able to handle contacts that didn't start from zero. Indeed the following lines of code assume that the contact list start from zero

https://github.com/dic-iit/bipedal-locomotion-framework/blob/06fecff66977b009c0c1e9dd8f6f17023e52ba2c/src/Planners/src/TimeVaryingDCMPlanner.cpp#L378

https://github.com/dic-iit/bipedal-locomotion-framework/blob/67afe42a454aa19103b8aaf545bdf7e1a8cfee8d/src/Planners/src/TimeVaryingDCMPlanner.cpp#L476

https://github.com/dic-iit/bipedal-locomotion-framework/blob/67afe42a454aa19103b8aaf545bdf7e1a8cfee8d/src/Planners/src/TimeVaryingDCMPlanner.cpp#L423

A possible solution is to reset the time to zero of the contact when setContactList is called

cc @traversaro and @S-Dafarra

GiulioRomualdi commented 3 years ago

Another possible solution is to substitute

 if(k * this->optiSettings.plannerSamplingTime > contactPhaseListIt->endTime) 

with

 if(k * this->optiSettings.plannerSamplingTime + contactPhaseList.cbegin()->initTime > contactPhaseListIt->endTime) 

However I would prefer the solution proposed in https://github.com/dic-iit/bipedal-locomotion-framework/issues/222#issue-820985689