diff --git a/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/estimator/stateEstimator/QuadrupedFootContactableBodiesFactory.java b/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/estimator/stateEstimator/QuadrupedFootContactableBodiesFactory.java new file mode 100644 index 00000000000..09228f444ce --- /dev/null +++ b/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/estimator/stateEstimator/QuadrupedFootContactableBodiesFactory.java @@ -0,0 +1,52 @@ +package us.ihmc.quadrupedRobotics.estimator.stateEstimator; + +import us.ihmc.SdfLoader.SDFFullQuadrupedRobotModel; +import us.ihmc.commonWalkingControlModules.bipedSupportPolygons.ListOfPointsContactablePlaneBody; +import us.ihmc.humanoidRobotics.bipedSupportPolygons.ContactablePlaneBody; +import us.ihmc.quadrupedRobotics.estimator.referenceFrames.CommonQuadrupedReferenceFrames; +import us.ihmc.quadrupedRobotics.model.QuadrupedPhysicalProperties; +import us.ihmc.robotics.robotSide.QuadrantDependentList; +import us.ihmc.robotics.robotSide.RobotQuadrant; +import us.ihmc.robotics.screwTheory.RigidBody; +import us.ihmc.tools.factories.FactoryTools; +import us.ihmc.tools.factories.RequiredFactoryField; + +public class QuadrupedFootContactableBodiesFactory +{ + private final RequiredFactoryField fullRobotModel = new RequiredFactoryField<>("fullRobotModel"); + private final RequiredFactoryField referenceFrames = new RequiredFactoryField<>("referenceFrames"); + private final RequiredFactoryField physicalProperties = new RequiredFactoryField<>("physicalProperties"); + + public QuadrantDependentList createFootContactableBodies() + { + FactoryTools.checkAllRequiredFactoryFieldsAreSet(this); + + QuadrantDependentList footContactableBodies = new QuadrantDependentList(); + + for (RobotQuadrant robotQuadrant : RobotQuadrant.values) + { + RigidBody foot = fullRobotModel.get().getFoot(robotQuadrant); + ListOfPointsContactablePlaneBody footContactableBody = new ListOfPointsContactablePlaneBody(foot, referenceFrames.get().getFootFrame(robotQuadrant), + physicalProperties.get() + .getFootGroundContactPoints(robotQuadrant)); + footContactableBodies.set(robotQuadrant, footContactableBody); + } + + return footContactableBodies; + } + + public void setFullRobotModel(SDFFullQuadrupedRobotModel fullRobotModel) + { + this.fullRobotModel.set(fullRobotModel); + } + + public void setReferenceFrames(CommonQuadrupedReferenceFrames referenceFrames) + { + this.referenceFrames.set(referenceFrames); + } + + public void setPhysicalProperties(QuadrupedPhysicalProperties physicalProperties) + { + this.physicalProperties.set(physicalProperties); + } +} diff --git a/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/estimator/stateEstimator/QuadrupedFootSwitchFactory.java b/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/estimator/stateEstimator/QuadrupedFootSwitchFactory.java new file mode 100644 index 00000000000..9e66a394c1e --- /dev/null +++ b/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/estimator/stateEstimator/QuadrupedFootSwitchFactory.java @@ -0,0 +1,58 @@ +package us.ihmc.quadrupedRobotics.estimator.stateEstimator; + +import us.ihmc.SdfLoader.SDFFullRobotModel; +import us.ihmc.commonWalkingControlModules.sensors.footSwitch.FootSwitchInterface; +import us.ihmc.commonWalkingControlModules.sensors.footSwitch.SettableFootSwitch; +import us.ihmc.humanoidRobotics.bipedSupportPolygons.ContactablePlaneBody; +import us.ihmc.robotics.dataStructures.registry.YoVariableRegistry; +import us.ihmc.robotics.robotSide.QuadrantDependentList; +import us.ihmc.robotics.robotSide.RobotQuadrant; +import us.ihmc.robotics.screwTheory.TotalMassCalculator; +import us.ihmc.tools.factories.FactoryTools; +import us.ihmc.tools.factories.RequiredFactoryField; + +public class QuadrupedFootSwitchFactory +{ + private final RequiredFactoryField gravity = new RequiredFactoryField<>("gravity"); + private final RequiredFactoryField yoVariableRegistry = new RequiredFactoryField<>("yoVariableRegistry"); + private final RequiredFactoryField> footContactableBodies = new RequiredFactoryField<>("footContactableBodies"); + private final RequiredFactoryField fullRobotModel = new RequiredFactoryField<>("fullRobotModel"); + + public QuadrantDependentList createFootSwitches() + { + FactoryTools.checkAllRequiredFactoryFieldsAreSet(this); + + QuadrantDependentList footSwitches = new QuadrantDependentList(); + double gravityMagnitude = Math.abs(gravity.get()); + double totalRobotWeight = TotalMassCalculator.computeSubTreeMass(fullRobotModel.get().getElevator()) * gravityMagnitude; + + for (RobotQuadrant robotQuadrant : RobotQuadrant.values) + { + SettableFootSwitch footSwitch = new SettableFootSwitch(footContactableBodies.get().get(robotQuadrant), robotQuadrant, totalRobotWeight, yoVariableRegistry.get()); + // KinematicsBasedFootSwitch footSwitch = new KinematicsBasedFootSwitch(namePrefix, footContactableBodies.get(), switchZThreshold, totalRobotWeight, robotQuadrant, yoVariableRegistry.get()); + footSwitches.set(robotQuadrant, footSwitch); + } + + return footSwitches; + } + + public void setGravity(double gravity) + { + this.gravity.set(gravity); + } + + public void setYoVariableRegistry(YoVariableRegistry yoVariableRegistry) + { + this.yoVariableRegistry.set(yoVariableRegistry); + } + + public void setFootContactableBodies(QuadrantDependentList footContactableBodies) + { + this.footContactableBodies.set(footContactableBodies); + } + + public void setFullRobotModel(SDFFullRobotModel fullRobotModel) + { + this.fullRobotModel.set(fullRobotModel); + } +} diff --git a/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/estimator/stateEstimator/QuadrupedStateEstimatorFactory.java b/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/estimator/stateEstimator/QuadrupedStateEstimatorFactory.java index 245af057376..821b1596494 100644 --- a/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/estimator/stateEstimator/QuadrupedStateEstimatorFactory.java +++ b/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/estimator/stateEstimator/QuadrupedStateEstimatorFactory.java @@ -3,20 +3,15 @@ import java.util.HashMap; import java.util.Map; -import us.ihmc.SdfLoader.SDFFullQuadrupedRobotModel; import us.ihmc.SdfLoader.SDFFullRobotModel; -import us.ihmc.quadrupedRobotics.model.QuadrupedPhysicalProperties; -import us.ihmc.commonWalkingControlModules.bipedSupportPolygons.ListOfPointsContactablePlaneBody; import us.ihmc.commonWalkingControlModules.sensors.footSwitch.FootSwitchInterface; -import us.ihmc.commonWalkingControlModules.sensors.footSwitch.SettableFootSwitch; import us.ihmc.humanoidRobotics.bipedSupportPolygons.ContactablePlaneBody; -import us.ihmc.quadrupedRobotics.estimator.referenceFrames.CommonQuadrupedReferenceFrames; +import us.ihmc.humanoidRobotics.model.CenterOfPressureDataHolder; import us.ihmc.robotics.dataStructures.registry.YoVariableRegistry; import us.ihmc.robotics.robotSide.QuadrantDependentList; import us.ihmc.robotics.robotSide.RobotQuadrant; import us.ihmc.robotics.screwTheory.RigidBody; import us.ihmc.robotics.screwTheory.SixDoFJoint; -import us.ihmc.robotics.screwTheory.TotalMassCalculator; import us.ihmc.robotics.sensors.ForceSensorDataHolder; import us.ihmc.sensorProcessing.model.RobotMotionStatus; import us.ihmc.sensorProcessing.model.RobotMotionStatusHolder; @@ -25,75 +20,108 @@ import us.ihmc.sensorProcessing.stateEstimation.evaluation.FullInverseDynamicsStructure; import us.ihmc.simulationconstructionset.yoUtilities.graphics.YoGraphicsListRegistry; import us.ihmc.stateEstimation.humanoid.kinematicsBasedStateEstimation.DRCKinematicsBasedStateEstimator; +import us.ihmc.tools.factories.FactoryTools; +import us.ihmc.tools.factories.RequiredFactoryField; public class QuadrupedStateEstimatorFactory { - - private static double switchZThreshold = 0.005; + private final RequiredFactoryField sensorInformation = new RequiredFactoryField<>("sensorInformation"); + private final RequiredFactoryField stateEstimatorParameters = new RequiredFactoryField<>("stateEstimatorParameters"); + private final RequiredFactoryField fullRobotModel = new RequiredFactoryField<>("fullRobotModel"); + private final RequiredFactoryField sensorOutputMapReadOnly = new RequiredFactoryField<>("sensorOutputMapReadOnly"); + private final RequiredFactoryField> footContactableBodies = new RequiredFactoryField<>("footContactableBodies"); + private final RequiredFactoryField> footSwitches = new RequiredFactoryField<>("footSwitches"); + private final RequiredFactoryField gravity = new RequiredFactoryField<>("gravity"); + private final RequiredFactoryField estimatorDT = new RequiredFactoryField<>("estimatorDT"); + private final RequiredFactoryField yoVariableRegistry = new RequiredFactoryField<>("yoVariableRegistry"); + private final RequiredFactoryField yoGraphicsListRegistry = new RequiredFactoryField<>("yoGraphicsListRegistry"); - public static DRCKinematicsBasedStateEstimator createStateEstimator(QuadrupedSensorInformation sensorInformation, StateEstimatorParameters stateEstimatorParameters, SDFFullRobotModel fullRobotModel, SensorOutputMapReadOnly sensorOutputMapReadOnly, - QuadrantDependentList feet, QuadrantDependentList footSwitches, double gravity, double estimatorDT, YoVariableRegistry registry, YoGraphicsListRegistry yoGraphicsListRegistry) + public DRCKinematicsBasedStateEstimator createStateEstimator() { - RigidBody elevator = fullRobotModel.getElevator(); - SixDoFJoint rootInverseDynamicsJoint = fullRobotModel.getRootJoint(); - RigidBody estimationLink = fullRobotModel.getPelvis(); + FactoryTools.checkAllRequiredFactoryFieldsAreSet(this); + + RigidBody elevator = fullRobotModel.get().getElevator(); + SixDoFJoint rootInverseDynamicsJoint = fullRobotModel.get().getRootJoint(); + RigidBody estimationLink = fullRobotModel.get().getPelvis(); FullInverseDynamicsStructure inverseDynamicsStructure = new FullInverseDynamicsStructure(elevator, estimationLink, rootInverseDynamicsJoint); RobotMotionStatusHolder robotMotionStatusFromController = new RobotMotionStatusHolder(); robotMotionStatusFromController.setCurrentRobotMotionStatus(RobotMotionStatus.IN_MOTION); ForceSensorDataHolder forceSensorDataHolderToUpdate = null; + CenterOfPressureDataHolder centerOfPressureDataHolder = null; Map feetMap = new HashMap(); Map footSwitchMap = new HashMap(); - for(RobotQuadrant quadrant : RobotQuadrant.values) + for (RobotQuadrant quadrant : RobotQuadrant.values) { - ContactablePlaneBody contactablePlaneBody = feet.get(quadrant); + ContactablePlaneBody contactablePlaneBody = footContactableBodies.get().get(quadrant); RigidBody rigidBody = contactablePlaneBody.getRigidBody(); feetMap.put(rigidBody, contactablePlaneBody); - FootSwitchInterface footSwitch = footSwitches.get(quadrant); + FootSwitchInterface footSwitch = footSwitches.get().get(quadrant); footSwitchMap.put(rigidBody, footSwitch); } - - String[] imuSensorsToUseInStateEstimator = sensorInformation.getImuNames(); - double gravityMagnitude = Math.abs(gravity); - - // Create the sensor readers and state estimator here: - DRCKinematicsBasedStateEstimator stateEstimator = new DRCKinematicsBasedStateEstimator(inverseDynamicsStructure, stateEstimatorParameters, sensorOutputMapReadOnly, forceSensorDataHolderToUpdate, imuSensorsToUseInStateEstimator, - gravityMagnitude, footSwitchMap, null, robotMotionStatusFromController, feetMap, yoGraphicsListRegistry); - - registry.addChild(stateEstimator.getYoVariableRegistry()); + String[] imuSensorsToUseInStateEstimator = sensorInformation.get().getImuNames(); + double gravityMagnitude = Math.abs(gravity.get()); + + DRCKinematicsBasedStateEstimator stateEstimator = new DRCKinematicsBasedStateEstimator(inverseDynamicsStructure, stateEstimatorParameters.get(), + sensorOutputMapReadOnly.get(), forceSensorDataHolderToUpdate, + imuSensorsToUseInStateEstimator, gravityMagnitude, footSwitchMap, + centerOfPressureDataHolder , robotMotionStatusFromController, feetMap, + yoGraphicsListRegistry.get()); + + yoVariableRegistry.get().addChild(stateEstimator.getYoVariableRegistry()); + return stateEstimator; } - - public static QuadrantDependentList createFootSwitches(QuadrantDependentList quadrupedFeet, double gravity, SDFFullRobotModel fullRobotModel, YoVariableRegistry registry) + + public void setSensorInformation(QuadrupedSensorInformation sensorInformation) { - QuadrantDependentList footSwitches = new QuadrantDependentList(); - double gravityMagnitude = Math.abs(gravity); - double totalRobotWeight = TotalMassCalculator.computeSubTreeMass(fullRobotModel.getElevator()) * gravityMagnitude; - - for (RobotQuadrant robotQuadrant : RobotQuadrant.values) - { - ContactablePlaneBody contactablePlaneBody = quadrupedFeet.get(robotQuadrant); - String namePrefix = contactablePlaneBody.getName() + "StateEstimator"; - SettableFootSwitch footSwitch = new SettableFootSwitch(quadrupedFeet.get(robotQuadrant), robotQuadrant, totalRobotWeight, registry); -// KinematicsBasedFootSwitch footSwitch = new KinematicsBasedFootSwitch(namePrefix, quadrupedFeet, switchZThreshold, totalRobotWeight, robotQuadrant, registry); - footSwitches.set(robotQuadrant, footSwitch); - } - return footSwitches; + this.sensorInformation.set(sensorInformation); } - - public static QuadrantDependentList createFootContactableBodies(SDFFullQuadrupedRobotModel fullRobotModel, CommonQuadrupedReferenceFrames referenceFrames, - QuadrupedPhysicalProperties quadrupedPhysicalProperties) + + public void setStateEstimatorParameters(StateEstimatorParameters stateEstimatorParameters) { - QuadrantDependentList footContactableBodies = new QuadrantDependentList(); - - for (RobotQuadrant robotQuadrant : RobotQuadrant.values) - { - RigidBody foot = fullRobotModel.getFoot(robotQuadrant); - ListOfPointsContactablePlaneBody footContactableBody = new ListOfPointsContactablePlaneBody(foot, referenceFrames.getFootFrame(robotQuadrant), quadrupedPhysicalProperties.getFootGroundContactPoints(robotQuadrant)); - footContactableBodies.set(robotQuadrant, footContactableBody); - } - return footContactableBodies; + this.stateEstimatorParameters.set(stateEstimatorParameters); + } + + public void setFullRobotModel(SDFFullRobotModel fullRobotModel) + { + this.fullRobotModel.set(fullRobotModel); + } + + public void setSensorOutputMapReadOnly(SensorOutputMapReadOnly sensorOutputMapReadOnly) + { + this.sensorOutputMapReadOnly.set(sensorOutputMapReadOnly); + } + + public void setFootContactableBodies(QuadrantDependentList footContactableBodies) + { + this.footContactableBodies.set(footContactableBodies); + } + + public void setFootSwitches(QuadrantDependentList footSwitches) + { + this.footSwitches.set(footSwitches); + } + + public void setGravity(double gravity) + { + this.gravity.set(gravity); + } + + public void setEstimatorDT(double estimatorDT) + { + this.estimatorDT.set(estimatorDT); + } + + public void setYoVariableRegistry(YoVariableRegistry yoVariableRegistry) + { + this.yoVariableRegistry.set(yoVariableRegistry); + } + + public void setYoGraphicsListRegistry(YoGraphicsListRegistry yoGraphicsListRegistry) + { + this.yoGraphicsListRegistry.set(yoGraphicsListRegistry); } } diff --git a/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/factories/QuadrupedSimulationFactory.java b/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/factories/QuadrupedSimulationFactory.java index adfdfa307a9..4b4c2f72b4c 100644 --- a/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/factories/QuadrupedSimulationFactory.java +++ b/IHMCQuadrupedRobotics/src/us/ihmc/quadrupedRobotics/factories/QuadrupedSimulationFactory.java @@ -28,6 +28,8 @@ import us.ihmc.quadrupedRobotics.controller.positionDevelopment.QuadrupedPositionDevelopmentControllerManager; import us.ihmc.quadrupedRobotics.estimator.referenceFrames.QuadrupedReferenceFrames; import us.ihmc.quadrupedRobotics.estimator.sensorProcessing.simulatedSensors.SDFQuadrupedPerfectSimulatedSensor; +import us.ihmc.quadrupedRobotics.estimator.stateEstimator.QuadrupedFootContactableBodiesFactory; +import us.ihmc.quadrupedRobotics.estimator.stateEstimator.QuadrupedFootSwitchFactory; import us.ihmc.quadrupedRobotics.estimator.stateEstimator.QuadrupedSensorInformation; import us.ihmc.quadrupedRobotics.estimator.stateEstimator.QuadrupedStateEstimatorFactory; import us.ihmc.quadrupedRobotics.mechanics.inverseKinematics.QuadrupedInverseKinematicsCalculators; @@ -153,21 +155,39 @@ private void createSensorReader() private void createContactibleFeet() { - contactableFeet = QuadrupedStateEstimatorFactory.createFootContactableBodies(fullRobotModel.get(), referenceFrames.get(), physicalProperties.get()); + QuadrupedFootContactableBodiesFactory footContactableBodiesFactory = new QuadrupedFootContactableBodiesFactory(); + footContactableBodiesFactory.setFullRobotModel(fullRobotModel.get()); + footContactableBodiesFactory.setPhysicalProperties(physicalProperties.get()); + footContactableBodiesFactory.setReferenceFrames(referenceFrames.get()); + contactableFeet = footContactableBodiesFactory.createFootContactableBodies(); } private void createFootSwitches() { - footSwitches = QuadrupedStateEstimatorFactory.createFootSwitches(contactableFeet, gravity.get(), fullRobotModel.get(), sdfRobot.get().getRobotsYoVariableRegistry()); + QuadrupedFootSwitchFactory footSwitchFactory = new QuadrupedFootSwitchFactory(); + footSwitchFactory.setFootContactableBodies(contactableFeet); + footSwitchFactory.setFullRobotModel(fullRobotModel.get()); + footSwitchFactory.setGravity(gravity.get()); + footSwitchFactory.setYoVariableRegistry(sdfRobot.get().getRobotsYoVariableRegistry()); + footSwitches = footSwitchFactory.createFootSwitches(); } private void createStateEstimator() { if (useStateEstimator.get()) { - stateEstimator = QuadrupedStateEstimatorFactory - .createStateEstimator(sensorInformation.get(), stateEstimatorParameters.get(), fullRobotModel.get(), sensorReader.getSensorOutputMapReadOnly(), contactableFeet, - footSwitches, gravity.get(), controlDT.get(), sdfRobot.get().getRobotsYoVariableRegistry(), yoGraphicsListRegistry); + QuadrupedStateEstimatorFactory stateEstimatorFactory = new QuadrupedStateEstimatorFactory(); + stateEstimatorFactory.setEstimatorDT(controlDT.get()); + stateEstimatorFactory.setFootContactableBodies(contactableFeet); + stateEstimatorFactory.setFootSwitches(footSwitches); + stateEstimatorFactory.setFullRobotModel(fullRobotModel.get()); + stateEstimatorFactory.setGravity(gravity.get()); + stateEstimatorFactory.setSensorInformation(sensorInformation.get()); + stateEstimatorFactory.setSensorOutputMapReadOnly(sensorReader.getSensorOutputMapReadOnly()); + stateEstimatorFactory.setStateEstimatorParameters(stateEstimatorParameters.get()); + stateEstimatorFactory.setYoGraphicsListRegistry(yoGraphicsListRegistry); + stateEstimatorFactory.setYoVariableRegistry(sdfRobot.get().getRobotsYoVariableRegistry()); + stateEstimator = stateEstimatorFactory.createStateEstimator(); } else { diff --git a/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/AbstractInverseDynamicsJoint.java b/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/AbstractInverseDynamicsJoint.java index bb4403626a9..a7bed77100d 100644 --- a/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/AbstractInverseDynamicsJoint.java +++ b/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/AbstractInverseDynamicsJoint.java @@ -24,31 +24,37 @@ public AbstractInverseDynamicsJoint(String name, RigidBody predecessor, Referenc predecessor.addChildJoint(this); } + @Override public final ReferenceFrame getFrameBeforeJoint() { return beforeJointFrame; } + @Override public final GeometricJacobian getMotionSubspace() { return motionSubspace; } + @Override public final RigidBody getPredecessor() { return predecessor; } + @Override public final RigidBody getSuccessor() { return successor; } + @Override public final String getName() { return name; } + @Override public final void updateFramesRecursively() { getFrameAfterJoint().update(); @@ -59,6 +65,7 @@ public final void updateFramesRecursively() } } + @Override public void getSuccessorTwist(Twist twistToPack) { getJointTwist(twistToPack); @@ -71,6 +78,7 @@ public void getSuccessorTwist(Twist twistToPack) twistToPack.changeFrame(successorFrame); } + @Override public void getPredecessorTwist(Twist twistToPack) { getJointTwist(twistToPack); @@ -84,6 +92,7 @@ public void getPredecessorTwist(Twist twistToPack) twistToPack.changeFrame(predecessorFrame); } + @Override public void getSuccessorAcceleration(SpatialAccelerationVector accelerationToPack) { getJointAcceleration(accelerationToPack); @@ -96,6 +105,7 @@ public void getSuccessorAcceleration(SpatialAccelerationVector accelerationToPac accelerationToPack.changeFrameNoRelativeMotion(successorFrame); } + @Override public void getDesiredSuccessorAcceleration(SpatialAccelerationVector accelerationToPack) { getDesiredJointAcceleration(accelerationToPack); @@ -108,6 +118,7 @@ public void getDesiredSuccessorAcceleration(SpatialAccelerationVector accelerati accelerationToPack.changeFrameNoRelativeMotion(successorFrame); } + @Override public void getDesiredPredecessorAcceleration(SpatialAccelerationVector accelerationToPack) { getDesiredJointAcceleration(accelerationToPack); @@ -122,11 +133,13 @@ public void getDesiredPredecessorAcceleration(SpatialAccelerationVector accelera } + @Override public RigidBodyTransform getOffsetTransform3D() { return getFrameBeforeJoint().getTransformToParent(); } + @Override public RigidBodyTransform getJointTransform3D() { return getFrameAfterJoint().getTransformToParent(); diff --git a/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/CentroidalMomentumRateADotVTerm.java b/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/CentroidalMomentumRateADotVTerm.java index 6f20a7ff8ee..2647b43b52c 100644 --- a/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/CentroidalMomentumRateADotVTerm.java +++ b/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/CentroidalMomentumRateADotVTerm.java @@ -18,8 +18,6 @@ public class CentroidalMomentumRateADotVTerm private final CentroidalMomentumMatrix centroidalMomentumMatrix; private final RigidBody rootBody; private final DenseMatrix64F v; - private final DenseMatrix64F tmpOmegaSkew; - private final DenseMatrix64F tmpVelSkew; private final double robotMass; private final DenseMatrix64F aDotV; @@ -53,8 +51,6 @@ public CentroidalMomentumRateADotVTerm(RigidBody rootBody, ReferenceFrame center comTwist.setToZero(); this.comVelocityVector = new Vector3d(); - this.tmpVelSkew = new DenseMatrix64F(3, 3); - this.tmpOmegaSkew = new DenseMatrix64F(3, 3); this.aDotV = new DenseMatrix64F(6, 1); this.tempSpatialAcceleration = new SpatialAccelerationVector(); this.tempMomentum = new Momentum(); @@ -126,22 +122,6 @@ public void compute() } } - /** - * @param twist - * Create a 6x6 adjoint from a twist. See Vincent Duindam's thesis, Lemma 2.8(f) - * Method is depracated as the computation is now done without the creation a 6x6 matrix for efficiency. - */ - @Deprecated - private void createAdjointFromTwist(Twist twist, DenseMatrix64F matrixToPack) - { - MatrixTools.vectorToSkewSymmetricMatrix(tmpOmegaSkew, twist.getAngularPart()); - MatrixTools.vectorToSkewSymmetricMatrix(tmpVelSkew, twist.getLinearPart()); - - MatrixTools.setMatrixBlock(matrixToPack, 0, 0, tmpOmegaSkew, 0, 0, 3, 3, 1.0); // top left block - MatrixTools.setMatrixBlock(matrixToPack, 3, 3, tmpOmegaSkew, 0, 0, 3, 3, 1.0); // bottom right block - MatrixTools.setMatrixBlock(matrixToPack, 3, 0, tmpVelSkew, 0, 0, 3, 3, 1.0); // bottom left block - } - /** * Compute the center of mass velocity given a centroidal momentum matrix. * Just takes linear portion of centroidal momentum matrix(bottom three rows), diff --git a/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/CompositeRigidBodyMassMatrixCalculator.java b/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/CompositeRigidBodyMassMatrixCalculator.java index ed1518c3434..10d1c31d2c7 100644 --- a/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/CompositeRigidBodyMassMatrixCalculator.java +++ b/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/CompositeRigidBodyMassMatrixCalculator.java @@ -45,6 +45,7 @@ public CompositeRigidBodyMassMatrixCalculator(RigidBody rootBody) this(rootBody, new ArrayList()); } + @Override public void compute() { MatrixTools.setToZero(massMatrix); @@ -111,11 +112,13 @@ private void buildCrbInertia(int i) } } + @Override public DenseMatrix64F getMassMatrix() { return massMatrix; } + @Override public InverseDynamicsJoint[] getJointsInOrder() { return jointsInOrder; diff --git a/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/DifferentialIDMassMatrixCalculator.java b/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/DifferentialIDMassMatrixCalculator.java index c32b47e14d1..593ce9151f9 100644 --- a/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/DifferentialIDMassMatrixCalculator.java +++ b/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/DifferentialIDMassMatrixCalculator.java @@ -50,6 +50,7 @@ public DifferentialIDMassMatrixCalculator(ReferenceFrame inertialFrame, RigidBod } } + @Override public void compute() { storeJointState(); @@ -109,11 +110,13 @@ private void restoreJointState() } } + @Override public DenseMatrix64F getMassMatrix() { return massMatrix; } + @Override public InverseDynamicsJoint[] getJointsInOrder() { return jointsInOrder; diff --git a/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/GeometricJacobian.java b/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/GeometricJacobian.java index 1317c6e05db..03003b812a8 100644 --- a/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/GeometricJacobian.java +++ b/IHMCRoboticsToolkit/src/us/ihmc/robotics/screwTheory/GeometricJacobian.java @@ -271,6 +271,7 @@ private static DenseMatrix64F createJacobianMatrix(LinkedHashMap