@@ -63,9 +63,11 @@ public class SingleFootEstimator implements SCS2YoGraphicHolder
6363
6464 private final YoFrameVector3D copVelocityInWorld ;
6565 private final AlphaFilteredYoFrameVector3D footToRootJointPosition ;
66+ private final AlphaFilteredYoFrameVector3D footToRootJointVelocity ;
6667 private final YoFramePoint3D footPositionInWorld ;
6768 /** Debug variable */
6869 private final YoFramePoint3D rootJointPositionPerFoot ;
70+ private final YoFrameVector3D rootJointVelocityPerFoot ;
6971
7072 private final YoFramePoint3D copIKPositionInWorld ;
7173 private final YoFramePoint3D copIMUPositionInWorld ;
@@ -131,7 +133,9 @@ public SingleFootEstimator(FloatingJointBasics rootJoint,
131133
132134 DoubleProvider alphaFoot = () -> AlphaFilterTools .computeAlphaGivenBreakFrequencyProperly (footToRootJointPositionBreakFrequency .getValue (), estimatorDT );
133135 footToRootJointPosition = new AlphaFilteredYoFrameVector3D (namePrefix + "FootToRootJointPosition" , "" , registry , alphaFoot , worldFrame );
136+ footToRootJointVelocity = new AlphaFilteredYoFrameVector3D (namePrefix + "FootToRootJointVelocity" , "" , registry , alphaFoot , worldFrame );
134137 rootJointPositionPerFoot = new YoFramePoint3D (namePrefix + "BasedRootJointPosition" , worldFrame , registry );
138+ rootJointVelocityPerFoot = new YoFrameVector3D (namePrefix + "BasedRootJointVelocity" , worldFrame , registry );
135139 footPositionInWorld = new YoFramePoint3D (namePrefix + "FootPositionInWorld" , worldFrame , registry );
136140 footPolygon = new FrameConvexPolygon2D (FrameVertex2DSupplier .asFrameVertex2DSupplier (contactableFoot .getContactPoints2D ()));
137141 footCenterCoPLineSegment = new FrameLineSegment2D (soleFrame );
@@ -182,6 +186,7 @@ public YoGraphicDefinition getSCS2YoGraphics()
182186 public void initialize ()
183187 {
184188 footToRootJointPosition .reset ();
189+ footToRootJointVelocity .reset ();
185190 copFilteredInFootFrame .reset ();
186191 copFilteredInFootFrame .update (0.0 , 0.0 );
187192 copFusedPositionInWorld .setMatchingFrame (copFilteredInFootFrame , 0.0 );
@@ -236,6 +241,7 @@ public void computeStateSettingCoPZ(boolean trustCoPAsNonSlippingContactPoint, b
236241 correctFootPositionUsingCoP ();
237242
238243 rootJointPositionPerFoot .add (footPositionInWorld , footToRootJointPosition );
244+ rootJointVelocityPerFoot .sub (footFusedLinearVelocityInWorld , footToRootJointVelocity );
239245 }
240246
241247 public void computeState (boolean trustCoPAsNonSlippingContactPoint , boolean useControllerDesiredCoP )
@@ -245,6 +251,7 @@ public void computeState(boolean trustCoPAsNonSlippingContactPoint, boolean useC
245251 correctFootPositionUsingCoP ();
246252
247253 rootJointPositionPerFoot .add (footPositionInWorld , footToRootJointPosition );
254+ rootJointVelocityPerFoot .sub (footFusedLinearVelocityInWorld , footToRootJointVelocity );
248255 }
249256
250257 public void computeStateSettingFootZ (double zPosition )
@@ -255,6 +262,7 @@ public void computeStateSettingFootZ(double zPosition)
255262 copFusedPositionInWorld .set (footPositionInWorld );
256263
257264 rootJointPositionPerFoot .add (footPositionInWorld , footToRootJointPosition );
265+ rootJointVelocityPerFoot .sub (footFusedLinearVelocityInWorld , footToRootJointVelocity );
258266 }
259267
260268 /**
@@ -298,6 +306,11 @@ public FramePoint3DReadOnly getRootJointPositionFromKinematics()
298306 return rootJointPositionPerFoot ;
299307 }
300308
309+ public FrameVector3DReadOnly getRootJointVelocityFromKinematics ()
310+ {
311+ return rootJointVelocityPerFoot ;
312+ }
313+
301314 public FrameVector3DReadOnly getCopVelocityInWorld ()
302315 {
303316 return copVelocityInWorld ;
@@ -426,6 +439,11 @@ private void computeFootTwistInWorldFusingBaseStateAndFootIMU(TwistReadOnly root
426439 tempRootBodyTwist .changeFrame (foot .getBodyFixedFrame ());
427440
428441 foot .getBodyFixedFrame ().getTwistRelativeToOther (rootJointFrame , footTwistInWorld );
442+
443+ tempFrameVector .setIncludingFrame (footTwistInWorld .getLinearPart ());
444+ tempFrameVector .changeFrame (worldFrame );
445+ footToRootJointVelocity .update (tempFrameVector );
446+
429447 footTwistInWorld .add (tempRootBodyTwist );
430448 footTwistInWorld .setBodyFrame (soleFrame );
431449 footTwistInWorld .changeFrame (worldFrame );
0 commit comments