loco-3d / crocoddyl

Crocoddyl is an optimal control library for robot control under contact sequence. Its solver is based on various efficient Differential Dynamic Programming (DDP)-like algorithms
BSD 3-Clause "New" or "Revised" License
845 stars 173 forks source link

Is the friction cone constraint correct? #921

Closed mayataka closed 3 years ago

mayataka commented 3 years ago

Dear all,

I have a question about the friction cone constraint, CostModelContactFrictionConeTpl. This class imposes a penalty based on the contact force d->contact->jMf.actInv(d->contact->f).linear(). However, this force seems represented in the end-effector's frame. I wonder there needs some transformation of the axis to impose the friction cone constraints correctly, e.g., based on the contact force expressed in the world frame as data.oMf[frame_id].rotation() * d->contact->jMf.actInv(d->contact->f).linear().

Thank you.

proyan commented 3 years ago

Hi @mayataka Welcome to crocoddyl! The contact force, as well as the friction cone are defined in the local frame. If you wish to move them to the world frame, you would need to move the friction cone as well. This corresponds to the A matrix in the FrameFrictionCone class. Does this answer your question?

mayataka commented 3 years ago

@proyan Thank you for replying! I understand that the friction cone currently provided is considered in the local frame. With my understanding, the reference frame of the friction cone should be the contact surface, e.g., its axes should be identical to the world frame (LOCAL_WORLD_ALIGNED in Pinoccho's convention) for flat ground. I also understand that if I want to use the friction cone defined in the world frame, I should implement it.

cmastalli commented 3 years ago

@mayataka -- Thank you for being interested in our project.

We indeed perform to such kind of rotation but at the level of the friction cone matrix. We also follow the same pattern for the contact wrench cone. Is this clarifying your doubts?

mayataka commented 3 years ago

@cmastalli Thank you for replying. I clearly understand what is implemented. Thank you very much again for @proyan @cmastalli.