Skip to content

Commit

Permalink
Merge pull request #290 from mmurooka/stabilizer-force-diff-frame
Browse files Browse the repository at this point in the history
  • Loading branch information
gergondet authored Sep 9, 2022
2 parents be0b077 + 72f45b2 commit 92c0f4e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/mc_tasks/lipm_stabilizer/StabilizerTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,15 +1142,19 @@ void StabilizerTask::updateFootForceDifferenceControl()
return;
}

sva::PTransformd T_0_L(leftFootTask->surfacePose().rotation());
sva::PTransformd T_0_R(rightFootTask->surfacePose().rotation());

// In what follows, vertical foot forces are expressed in their respective
// foot sole frames, but foot force difference control expects them to be
// written in the world frame, so the following lines are wrong (they miss a
// frame transform). Thanks to @Saeed-Mansouri for pointing out this bug
// <https://github.com/stephane-caron/lipm_walking_controller/discussions/72>.
double LFz_d = leftFootTask->targetWrench().force().z();
double RFz_d = rightFootTask->targetWrench().force().z();
double LFz = leftFootTask->measuredWrench().force().z();
double RFz = rightFootTask->measuredWrench().force().z();
// T_0_{L/R}.transMul transforms a ForceVecd variable from surface frame to world frame
double LFz_d = T_0_L.transMul(leftFootTask->targetWrench()).force().z();
double RFz_d = T_0_R.transMul(rightFootTask->targetWrench()).force().z();
double LFz = T_0_L.transMul(leftFootTask->measuredWrench()).force().z();
double RFz = T_0_R.transMul(rightFootTask->measuredWrench()).force().z();
dfzForceError_ = (LFz_d - RFz_d) - (LFz - RFz);

double LTz_d = leftFootTask->targetPose().translation().z();
Expand All @@ -1164,8 +1168,9 @@ void StabilizerTask::updateFootForceDifferenceControl()
double dz_vdc = c_.vdcFrequency * vdcHeightError_;
sva::MotionVecd velF = {{0., 0., 0.}, {0., 0., dz_ctrl}};
sva::MotionVecd velT = {{0., 0., 0.}, {0., 0., dz_vdc}};
leftFootTask->refVelB(0.5 * (velT - velF));
rightFootTask->refVelB(0.5 * (velT + velF));
// T_0_{L/R} transforms a MotionVecd variable from world frame to surface frame
leftFootTask->refVelB(0.5 * (T_0_L * (velT - velF)));
rightFootTask->refVelB(0.5 * (T_0_R * (velT + velF)));
}

template Eigen::Vector3d StabilizerTask::computeCoMOffset<&StabilizerTask::ExternalWrench::target>(
Expand Down

0 comments on commit 92c0f4e

Please # to comment.