Skip to content

Commit 7e91970

Browse files
Use the average of the feet velocity as desired centroidal locked velocity
1 parent b3e3c56 commit 7e91970

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/WalkingModule/include/WalkingControllers/WalkingModule/Module.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ namespace WalkingControllers
200200
*/
201201
iDynTree::Rotation computeAverageYawRotationFromPlannedFeet() const;
202202

203+
iDynTree::Twist computeAverageTwistFromPlannedFeet() const;
204+
203205
/**
204206
* Generate the first trajectory.
205207
* This method has to be called before updateTrajectories() method.

src/WalkingModule/src/Module.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -903,8 +903,8 @@ bool WalkingModule::updateModule()
903903
modifiedInertial = yawRotation * m_inertial_R_worldFrame;
904904

905905
// compute the desired torso velocity
906-
auto torsoVelocity = m_BLFIKSolver->getDesiredTorsoVelocity();
907-
auto centroidalMomentumDesired = m_FKSolver->getKinDyn()->getCentroidalRobotLockedInertia() * torsoVelocity;
906+
const iDynTree::Twist desiredTorsoVelocity = this->computeAverageTwistFromPlannedFeet();
907+
auto centroidalMomentumDesired = m_FKSolver->getKinDyn()->getCentroidalRobotLockedInertia() * desiredTorsoVelocity;
908908

909909
if (m_useQPIK)
910910
{
@@ -1127,6 +1127,21 @@ iDynTree::Rotation WalkingModule::computeAverageYawRotationFromPlannedFeet() con
11271127
return iDynTree::Rotation::RotZ(meanYaw);
11281128
}
11291129

1130+
iDynTree::Twist WalkingModule::computeAverageTwistFromPlannedFeet() const
1131+
{
1132+
iDynTree::Twist twist;
1133+
iDynTree::Vector3 meanLinearVelocity, meanAngularVelocity;
1134+
iDynTree::toEigen(meanLinearVelocity) = (iDynTree::toEigen(m_leftTwistTrajectory.front().getLinearVec3()) +
1135+
iDynTree::toEigen(m_rightTwistTrajectory.front().getLinearVec3())) / 2.0;
1136+
iDynTree::toEigen(meanAngularVelocity) = (iDynTree::toEigen(m_leftTwistTrajectory.front().getAngularVec3()) +
1137+
iDynTree::toEigen(m_rightTwistTrajectory.front().getAngularVec3())) / 2.0;
1138+
1139+
twist.setLinearVec3(meanLinearVelocity);
1140+
twist.setAngularVec3(meanAngularVelocity);
1141+
1142+
return twist;
1143+
}
1144+
11301145
bool WalkingModule::prepareRobot(bool onTheFly)
11311146
{
11321147
if (m_robotState != WalkingFSM::Configured && m_robotState != WalkingFSM::Stopped)

0 commit comments

Comments
 (0)