Skip to content

Commit a6d21f2

Browse files
committed
did some cleanup
1 parent cb153e8 commit a6d21f2

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

ihmc-state-estimation/src/main/java/us/ihmc/stateEstimation/humanoid/kinematicsBasedStateEstimation/PelvisLinearStateUpdater.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,16 @@ public PelvisLinearStateUpdater(FullInverseDynamicsStructure inverseDynamicsStru
189189
stateEstimatorParameters.getKinematicsPelvisPositionFilterFreqInHertz());
190190
DoubleProvider copFilterBreakFrequency = new DoubleParameter("CopFilterBreakFrequency", registry, stateEstimatorParameters.getCoPFilterFreqInHertz());
191191
YoBoolean useFootIMUData = new YoBoolean("useFootIMUData", registry);
192+
YoDouble footLinearVelocityMovingThreshold = new YoDouble("footLinearVelocityMovingThreshold", registry);
193+
YoDouble footAngularVelocityMovingThreshold = new YoDouble("footAngularVelocityMovingThreshold", registry);
192194
YoDouble footAlphaLeakIMUOnly = new YoDouble("footIMUOnlyAlphaLeak", registry);
193195
YoDouble footImuAgainstKinematicsForVelocityBreakFrequency = new YoDouble("footIMUAgainstKinematicsForVelocityBreakFrequency", registry);
194196
YoDouble footImuAgainstKinematicsForPositionBreakFrequency = new YoDouble("footIMUAgainstKinematicsForPositionBreakFrequency", registry);
195197
footImuAgainstKinematicsForPositionBreakFrequency.set(12.0);
196198
footImuAgainstKinematicsForVelocityBreakFrequency.set(2.0);
197199
footAlphaLeakIMUOnly.set(0.999);
200+
footLinearVelocityMovingThreshold.set(0.3);
201+
footAngularVelocityMovingThreshold.set(0.6);
198202

199203
RigidBodyBasics[] feetRigidBodies = feetContactablePlaneBodies.keySet().toArray(new RigidBodyBasics[0]);
200204

@@ -213,6 +217,8 @@ public PelvisLinearStateUpdater(FullInverseDynamicsStructure inverseDynamicsStru
213217
copFilterBreakFrequency,
214218
centerOfPressureDataHolderFromController,
215219
cancelGravityFromAccelerationMeasurement,
220+
footLinearVelocityMovingThreshold,
221+
footAngularVelocityMovingThreshold,
216222
gravityVector,
217223
useFootIMUData,
218224
footImuAgainstKinematicsForPositionBreakFrequency,

ihmc-state-estimation/src/main/java/us/ihmc/stateEstimation/humanoid/kinematicsBasedStateEstimation/SingleFootEstimator.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import us.ihmc.yoVariables.providers.DoubleProvider;
4040
import us.ihmc.yoVariables.registry.YoRegistry;
4141
import us.ihmc.yoVariables.variable.YoBoolean;
42+
import us.ihmc.yoVariables.variable.YoDouble;
4243

4344
public class SingleFootEstimator implements SCS2YoGraphicHolder
4445
{
@@ -56,6 +57,8 @@ public class SingleFootEstimator implements SCS2YoGraphicHolder
5657
private final YoFrameVector3D footFusedLinearVelocityInWorld;
5758
private final YoFrameVector3D footFusedAngularVelocityInWorld;
5859

60+
private final YoDouble footLinearVelocity;
61+
private final YoDouble footAngularVelocity;
5962
private final YoBoolean footIsMoving;
6063

6164
private final YoFrameVector3D copVelocityInWorld;
@@ -81,6 +84,8 @@ public class SingleFootEstimator implements SCS2YoGraphicHolder
8184
private final DoubleProvider imuAgainstKinematicsForVelocityBreakFrequency;
8285
private final DoubleProvider imuAgainstKinematicsForPositionBreakFrequency;
8386
private final BooleanProvider cancelGravityFromAccelerationMeasurement;
87+
private final DoubleProvider footLinearVelocityMovingThreshold;
88+
private final DoubleProvider footAngularVelocityMovingThreshold;
8489
private final FrameVector3DReadOnly gravityVector;
8590
private final double estimatorDT;
8691

@@ -95,6 +100,8 @@ public SingleFootEstimator(FloatingJointBasics rootJoint,
95100
DoubleProvider copFilterBreakFrequency,
96101
CenterOfPressureDataHolder centerOfPressureDataHolderFromController,
97102
BooleanProvider cancelGravityFromAccelerationMeasurement,
103+
DoubleProvider footLinearVelocityMovingThreshold,
104+
DoubleProvider footAngularVelocityMovingThreshold,
98105
FrameVector3DReadOnly gravityVector,
99106
BooleanProvider useIMUData,
100107
DoubleProvider imuAgainstKinematicsForPositionBreakFrequency,
@@ -109,6 +116,8 @@ public SingleFootEstimator(FloatingJointBasics rootJoint,
109116
this.imuBiasProvider = imuBiasProvider;
110117
this.centerOfPressureDataHolderFromController = centerOfPressureDataHolderFromController;
111118
this.cancelGravityFromAccelerationMeasurement = cancelGravityFromAccelerationMeasurement;
119+
this.footLinearVelocityMovingThreshold = footLinearVelocityMovingThreshold;
120+
this.footAngularVelocityMovingThreshold = footAngularVelocityMovingThreshold;
112121
this.gravityVector = gravityVector;
113122
this.useIMUData = useIMUData;
114123
this.imuAgainstKinematicsForPositionBreakFrequency = imuAgainstKinematicsForPositionBreakFrequency;
@@ -129,6 +138,8 @@ public SingleFootEstimator(FloatingJointBasics rootJoint,
129138
copRawInFootFrame = new YoFramePoint2D(namePrefix + "CoPRawInFootFrame", soleFrame, registry);
130139
previousCoPInFootFrame = new YoFramePoint2D(namePrefix + "PreviousCoPInFootFrame", soleFrame, registry);
131140

141+
footLinearVelocity = new YoDouble(namePrefix + "LinearVelocity", registry);
142+
footAngularVelocity = new YoDouble(namePrefix + "AngularVelocity", registry);
132143
footIsMoving = new YoBoolean(namePrefix + "IsMoving", registry);
133144

134145
footIKLinearVelocityInWorld = new YoFrameVector3D(namePrefix + "IKLinearVelocityInWorld", worldFrame, registry);
@@ -203,9 +214,11 @@ public void updateStateFromKinematics(TwistReadOnly rootBodyTwist)
203214

204215
footToRootJointPosition.update(tempFrameVector);
205216

206-
// FIXME remove magic parameters
217+
footLinearVelocity.set(getFootLinearVelocityInWorld().norm());
218+
footAngularVelocity.set(getFootAngularVelocityInWorld().norm());
219+
207220
if (useIMUData.getValue() && footIMU != null)
208-
footIsMoving.set(getFootLinearVelocityInWorld().norm() > 0.5 || getFootAngularVelocityInWorld().norm() > 1.0);
221+
footIsMoving.set(footLinearVelocity.getDoubleValue() > footLinearVelocityMovingThreshold.getValue() || footAngularVelocity.getDoubleValue() > footAngularVelocityMovingThreshold.getValue());
209222
else
210223
footIsMoving.set(false);
211224
}

0 commit comments

Comments
 (0)