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
858 stars 174 forks source link

Contact 6D computes spatial acceleration, whereas contact 3D Classical acceleration: is one of them wrong ? #1211

Closed maximebrunet closed 10 months ago

maximebrunet commented 10 months ago

Hello,

Thank you and congratulations for your nice work ! :)

I'm currently trying to implement a Contact5D, and I came across this difference when reading Contact3D and Contact6D implementations.

So, I'm wondering why is there a difference in the computed acceleration ? Are they identical under some assumptions (like contact with a fixed object) ?

Thank you for your help.

P.S.: I'm not certain this is a "bug", but I didn't know where I should post this kind of questions. Please let me know if there is a better place for next time.

linglluo commented 10 months ago

Hello, I also found this issue, and I think there is also an issue in the equation for solving da0_local_dx in contact-3d, has anyone else found this problem?

` pinocchio::getJointAccelerationDerivatives( state_->get_pinocchio().get(), d->pinocchio, joint, pinocchio::LOCAL, d->v_partial_dq, d->a_partial_dq, d->a_partial_dv, d->a_partial_da);

const std::sizet nv = state->get_nv(); pinocchio::skew(d->v.linear(), d->vv_skew); pinocchio::skew(d->v.angular(), d->vw_skew); d->fXjdv_dq.noalias() = d->fXj d->v_partial_dq; d->fXjda_dq.noalias() = d->fXj d->a_partial_dq; d->fXjda_dv.noalias() = d->fXj d->a_partial_dv; d->da0_local_dx.leftCols(nv) = d->fXjda_dq.template topRows<3>(); d->da0_local_dx.leftCols(nv).noalias() += d->vw_skew d->fXjdv_dq.template topRows<3>(); d->da0_local_dx.leftCols(nv).noalias() -= d->vv_skew d->fXjdv_dq.template bottomRows<3>(); d->da0_local_dx.rightCols(nv) = d->fXjda_dv.template topRows<3>(); d->da0_local_dx.rightCols(nv).noalias() += d->vw_skew d->fJf.template topRows<3>(); d->da0_local_dx.rightCols(nv).noalias() -= d->vv_skew * d->fJf.template bottomRows<3>();`