@@ -371,6 +371,9 @@ bool WalkingModule::configure(yarp::os::ResourceFinder &rf)
371
371
return false ;
372
372
}
373
373
374
+ m_vectorsCollectionServer.populateMetadata (" angular_momentum::measured" , {" x" , " y" , " z" });
375
+ m_vectorsCollectionServer.populateMetadata (" angular_momentum::desired" , {" x" , " y" , " z" });
376
+
374
377
m_vectorsCollectionServer.populateMetadata (" dcm::position::measured" , {" x" , " y" });
375
378
m_vectorsCollectionServer.populateMetadata (" dcm::position::desired" , {" x" , " y" });
376
379
m_vectorsCollectionServer.populateMetadata (" dcm::velocity::desired" , {" x" , " y" });
@@ -502,6 +505,7 @@ bool WalkingModule::close()
502
505
bool WalkingModule::solveBLFIK (const iDynTree::Position &desiredCoMPosition,
503
506
const iDynTree::Vector3 &desiredCoMVelocity,
504
507
const iDynTree::Rotation &desiredNeckOrientation,
508
+ const iDynTree::SpatialMomentum ¢roidalMomentumDesired,
505
509
iDynTree::VectorDynSize &output)
506
510
{
507
511
const std::string phase = m_isStancePhase.front () ? " stance" : " walking" ;
@@ -516,6 +520,8 @@ bool WalkingModule::solveBLFIK(const iDynTree::Position &desiredCoMPosition,
516
520
ok = ok && m_BLFIKSolver->setRetargetingJointSetPoint (m_retargetingClient->jointPositions (),
517
521
m_retargetingClient->jointVelocities ());
518
522
523
+ ok = ok && m_BLFIKSolver->setAngularMomentumSetPoint (centroidalMomentumDesired.getAngularVec3 ());
524
+
519
525
if (m_useRootLinkForHeight)
520
526
{
521
527
ok = ok && m_BLFIKSolver->setRootSetPoint (desiredCoMPosition, desiredCoMVelocity);
@@ -902,6 +908,10 @@ bool WalkingModule::updateModule()
902
908
yawRotation = yawRotation.inverse ();
903
909
modifiedInertial = yawRotation * m_inertial_R_worldFrame;
904
910
911
+ // compute the desired torso velocity
912
+ auto torsoVelocity = m_BLFIKSolver->getDesiredTorsoVelocity ();
913
+ auto centroidalMomentumDesired = m_FKSolver->getKinDyn ()->getCentroidalRobotLockedInertia () * torsoVelocity;
914
+
905
915
if (m_useQPIK)
906
916
{
907
917
// integrate dq because velocity control mode seems not available
@@ -919,6 +929,7 @@ bool WalkingModule::updateModule()
919
929
if (!solveBLFIK (desiredCoMPosition,
920
930
desiredCoMVelocity,
921
931
yawRotation,
932
+ centroidalMomentumDesired,
922
933
m_dqDesired))
923
934
{
924
935
yError () << " [WalkingModule::updateModule] Unable to solve the QP problem with "
@@ -1023,6 +1034,8 @@ bool WalkingModule::updateModule()
1023
1034
CoMVelocityDesired[1 ] = m_stableDCMModel->getCoMVelocity ().data ()[1 ];
1024
1035
CoMVelocityDesired[2 ] = m_retargetingClient->comHeightVelocity ();
1025
1036
1037
+ m_vectorsCollectionServer.prepareData ();
1038
+ m_vectorsCollectionServer.clearData ();
1026
1039
m_vectorsCollectionServer.populateData (" com::velocity::desired" , CoMVelocityDesired);
1027
1040
1028
1041
// Left foot position
@@ -1083,6 +1096,9 @@ bool WalkingModule::updateModule()
1083
1096
const double isLeftFootFixed = m_isLeftFixedFrame.front () ? 1.0 : 0.0 ;
1084
1097
m_vectorsCollectionServer.populateData (" stance_foot::is_left" , std::array<double , 1 >{isLeftFootFixed});
1085
1098
1099
+ m_vectorsCollectionServer.populateData (" angular_momentum::measured" , m_FKSolver->getKinDyn ()->getCentroidalTotalMomentum ().getAngularVec3 ());
1100
+ m_vectorsCollectionServer.populateData (" angular_momentum::desired" , centroidalMomentumDesired.getAngularVec3 ());
1101
+
1086
1102
m_vectorsCollectionServer.sendData ();
1087
1103
}
1088
1104
0 commit comments