Skip to content

Commit 778e76f

Browse files
GiulioRomualdiergocub
authored andcommitted
Use the average of the feet velocity as desired centroidal locked velocity
1 parent 5b01ea6 commit 778e76f

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
@@ -909,8 +909,8 @@ bool WalkingModule::updateModule()
909909
modifiedInertial = yawRotation * m_inertial_R_worldFrame;
910910

911911
// compute the desired torso velocity
912-
auto torsoVelocity = m_BLFIKSolver->getDesiredTorsoVelocity();
913-
auto centroidalMomentumDesired = m_FKSolver->getKinDyn()->getCentroidalRobotLockedInertia() * torsoVelocity;
912+
const iDynTree::Twist desiredTorsoVelocity = this->computeAverageTwistFromPlannedFeet();
913+
auto centroidalMomentumDesired = m_FKSolver->getKinDyn()->getCentroidalRobotLockedInertia() * desiredTorsoVelocity;
914914

915915
if (m_useQPIK)
916916
{
@@ -1140,6 +1140,21 @@ iDynTree::Rotation WalkingModule::computeAverageYawRotationFromPlannedFeet() con
11401140
return iDynTree::Rotation::RotZ(meanYaw);
11411141
}
11421142

1143+
iDynTree::Twist WalkingModule::computeAverageTwistFromPlannedFeet() const
1144+
{
1145+
iDynTree::Twist twist;
1146+
iDynTree::Vector3 meanLinearVelocity, meanAngularVelocity;
1147+
iDynTree::toEigen(meanLinearVelocity) = (iDynTree::toEigen(m_leftTwistTrajectory.front().getLinearVec3()) +
1148+
iDynTree::toEigen(m_rightTwistTrajectory.front().getLinearVec3())) / 2.0;
1149+
iDynTree::toEigen(meanAngularVelocity) = (iDynTree::toEigen(m_leftTwistTrajectory.front().getAngularVec3()) +
1150+
iDynTree::toEigen(m_rightTwistTrajectory.front().getAngularVec3())) / 2.0;
1151+
1152+
twist.setLinearVec3(meanLinearVelocity);
1153+
twist.setAngularVec3(meanAngularVelocity);
1154+
1155+
return twist;
1156+
}
1157+
11431158
bool WalkingModule::prepareRobot(bool onTheFly)
11441159
{
11451160
if (m_robotState != WalkingFSM::Configured && m_robotState != WalkingFSM::Stopped)

0 commit comments

Comments
 (0)