gpt4 book ai didi

us.ihmc.mecano.spatial.Wrench.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 14:29:05 28 4
gpt4 key购买 nike

本文整理了Java中us.ihmc.mecano.spatial.Wrench.<init>()方法的一些代码示例,展示了Wrench.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Wrench.<init>()方法的具体详情如下:
包路径:us.ihmc.mecano.spatial.Wrench
类名称:Wrench
方法名:<init>

Wrench.<init>介绍

[英]Creates a new wrench with its components set to zero and its reference frames set to null.
[中]创建一个新扳手,其零部件设置为零,参考坐标设置为空。

代码示例

代码示例来源:origin: us.ihmc/mecano

/** {@inheritDoc} */
@Override
public void setSuccessor(RigidBodyBasics successor)
{
 this.successor = successor;
 ReferenceFrame successorFrame = successor.getBodyFixedFrame();
 jointWrench = new Wrench(successorFrame, jointFrame);
}

代码示例来源:origin: us.ihmc/mecano

/** {@inheritDoc} */
@Override
public void setSuccessor(RigidBodyBasics successor)
{
 this.successor = successor;
 ReferenceFrame successorFrame = successor.getBodyFixedFrame();
 jointWrench = new Wrench(successorFrame, afterJointFrame);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

public static void assertWrenchesSumUpToMomentumDot(Collection<Wrench> externalWrenches, SpatialForce desiredCentroidalMomentumRate, double gravityZ,
   double mass, ReferenceFrame centerOfMassFrame, double epsilon)
{
 SpatialForce totalWrench = new SpatialForce(centerOfMassFrame);
 Wrench tempWrench = new Wrench();
 for (Wrench wrench : externalWrenches)
 {
   tempWrench.setIncludingFrame(wrench);
   tempWrench.changeFrame(centerOfMassFrame);
   totalWrench.add(tempWrench);
 }
 Wrench gravitationalWrench = new Wrench(centerOfMassFrame, centerOfMassFrame);
 gravitationalWrench.setLinearPartZ(-mass * gravityZ);
 totalWrench.add(gravitationalWrench);
 MecanoTestTools.assertSpatialForceEquals(desiredCentroidalMomentumRate, totalWrench, epsilon);
}

代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test

public void setFullRobotModelExternalForcesRandomly(Random random, double maxFeetExternalForce, double maxFeetExternalTorque)
{
 inverseDynamicsCalculator.setExternalWrenchesToZero();
 for (RobotSide robotSide : RobotSide.values)
 {
   RigidBodyBasics foot = fullRobotModel.getFoot(robotSide);
   ReferenceFrame bodyFixedFrame = foot.getBodyFixedFrame();
   Wrench wrench = new Wrench(bodyFixedFrame, bodyFixedFrame, RandomGeometry.nextVector3D(random, maxFeetExternalTorque),
      RandomGeometry.nextVector3D(random, maxFeetExternalForce));
   inverseDynamicsCalculator.setExternalWrench(foot, wrench);
 }
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testVMC()
{
 simulationTestingParameters.setKeepSCSUp(false);
 hasSCSSimulation = false;
 double gravity = -9.81;
 
 RobotLegs robotLeg = VirtualModelControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 ReferenceFrame centerOfMassFrame = robotLeg.getReferenceFrames().getCenterOfMassFrame();
 // send in the correct frame and no selection matrix
 FrameVector3D desiredForce = new FrameVector3D(foot.getBodyFixedFrame(), new Vector3D(bigRandom.nextDouble(), bigRandom.nextDouble(), bigRandom.nextDouble()));
 FrameVector3D desiredTorque = new FrameVector3D(foot.getBodyFixedFrame(), new Vector3D(bigRandom.nextDouble(), bigRandom.nextDouble(), bigRandom.nextDouble()));
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 submitAndCheckVMC(pelvis, foot, centerOfMassFrame, desiredWrench, null);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

public static void assertRootJointWrenchZero(Map<RigidBodyBasics, Wrench> externalWrenches, SixDoFJoint rootJoint, double gravityZ, double epsilon)
  {
   InverseDynamicsCalculator inverseDynamicsCalculator = new InverseDynamicsCalculator(rootJoint.getPredecessor());
   inverseDynamicsCalculator.setGravitionalAcceleration(-gravityZ);
   for (RigidBodyBasics rigidBody : externalWrenches.keySet())
   {
     Wrench externalWrench = externalWrenches.get(rigidBody);
     externalWrench.changeFrame(rigidBody.getBodyFixedFrame());
     inverseDynamicsCalculator.setExternalWrench(rigidBody, externalWrench);
   }
   inverseDynamicsCalculator.compute();
   Wrench wrench = new Wrench();
   wrench.setIncludingFrame(rootJoint.getJointWrench());

   SpatialForce zeroWrench = new SpatialForce(wrench.getReferenceFrame());
   MecanoTestTools.assertSpatialForceEquals(wrench, zeroWrench, epsilon);
  }
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testVMCSelectAll()
{
 simulationTestingParameters.setKeepSCSUp(false);
 hasSCSSimulation = false;
 double gravity = -9.81;
 
 RobotLegs robotLeg = VirtualModelControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 ReferenceFrame centerOfMassFrame = robotLeg.getReferenceFrames().getCenterOfMassFrame();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = new FrameVector3D(foot.getBodyFixedFrame(), new Vector3D(bigRandom.nextDouble(), bigRandom.nextDouble(), bigRandom.nextDouble()));
 FrameVector3D desiredTorque = new FrameVector3D(foot.getBodyFixedFrame(), new Vector3D(bigRandom.nextDouble(), bigRandom.nextDouble(), bigRandom.nextDouble()));
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 submitAndCheckVMC(pelvis, foot, centerOfMassFrame, desiredWrench, CommonOps.identity(Wrench.SIZE, Wrench.SIZE));
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationAnnotations.ContinuousIntegrationTest(estimatedDuration = 0.1)
@Test(timeout = 30000)
public void testprovidedMassMatrixToolRigidBody()
{
 FullHumanoidRobotModel fullRobotModel = getFullRobotModel();
 ReferenceFrame elevatorFrame = fullRobotModel.getElevatorFrame();
 ProvidedMassMatrixToolRigidBody providedMassMatrixToolRigidBody = new ProvidedMassMatrixToolRigidBody(robotSide, fullRobotModel, gravity, registry, null);
 providedMassMatrixToolRigidBody.setMass(mass);
 SpatialAcceleration handSpatialAccelerationVector = new SpatialAcceleration(elevatorFrame, elevatorFrame, elevatorFrame);
 Wrench toolWrench = new Wrench();
 providedMassMatrixToolRigidBody.control(handSpatialAccelerationVector, toolWrench);
 toolWrench.changeFrame(ReferenceFrame.getWorldFrame());
 assertTrue(toolWrench.getLinearPart().epsilonEquals(new Vector3D(0.0, 0.0, -mass * gravity), 10e-5));
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.6)
@Test(timeout = 30000)
public void testVMC()
{
 RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame and no selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 submitAndCheckVMC(pelvis, foot, desiredWrench, null);
}

代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test

private void getExternalWrenchesFromSCS()
{
  calculator.setExternalWrenchesToZero();
  for (ExternalForcePoint efp : robot.getAllGroundContactPoints())
  {
   String parentJointName = efp.getParentJoint().getName();
   RigidBodyBasics body = nameToJointMap.get(parentJointName).getSuccessor();
   FrameVector3DReadOnly moment = efp.getYoMoment();
   FrameVector3DReadOnly force = efp.getYoForce();
   FramePoint3D pointOfApplication = new FramePoint3D(efp.getYoPosition());
   pointOfApplication.changeFrame(body.getBodyFixedFrame());
   SpatialVector vector6D = new SpatialVector(moment, force);
   vector6D.changeFrame(body.getBodyFixedFrame());
   Wrench externalWrench = new Wrench(body.getBodyFixedFrame(), body.getBodyFixedFrame());
   externalWrench.set(vector6D.getAngularPart(), vector6D.getLinearPart(), pointOfApplication);
   calculator.getExternalWrench(body).add(externalWrench);
  }
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.6)
@Test(timeout = 30000)
public void testVMCSelectAll()
{
   RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 SelectionMatrix6D selectionMatrix = new SelectionMatrix6D();
 submitAndCheckVMC(pelvis, foot, desiredWrench, selectionMatrix);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.5)
@Test(timeout = 30000)
public void testVMCSelectTorqueZ()
{
 RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 SelectionMatrix6D selectionMatrix = new SelectionMatrix6D();
 selectionMatrix.clearSelection();
 selectionMatrix.selectAngularZ(true);
 submitAndCheckVMC(pelvis, foot, desiredWrench, selectionMatrix);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.6)
@Test(timeout = 30000)
public void testVMCSelectForceX()
{
 RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 SelectionMatrix6D selectionMatrix = new SelectionMatrix6D();
 selectionMatrix.clearSelection();
 selectionMatrix.selectLinearX(true);
 submitAndCheckVMC(pelvis, foot, desiredWrench, selectionMatrix);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.6)
@Test(timeout = 30000)
public void testVMCSelectForceY()
{
 RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 SelectionMatrix6D selectionMatrix = new SelectionMatrix6D();
 selectionMatrix.clearSelection();
 selectionMatrix.selectLinearY(true);
 submitAndCheckVMC(pelvis, foot, desiredWrench, selectionMatrix);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.5)
@Test(timeout = 30000)
public void testVMCSelectTorqueX()
{
 RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 SelectionMatrix6D selectionMatrix = new SelectionMatrix6D();
 selectionMatrix.clearSelection();
 selectionMatrix.selectAngularX(true);
 submitAndCheckVMC(pelvis, foot, desiredWrench, selectionMatrix);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.5)
@Test(timeout = 30000)
public void testVMCSelectTorque()
{
 RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 // select only torque
 SelectionMatrix6D selectionMatrix = new SelectionMatrix6D();
 selectionMatrix.clearSelection();
 selectionMatrix.setToAngularSelectionOnly();
 submitAndCheckVMC(pelvis, foot, desiredWrench, selectionMatrix);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.5)
@Test(timeout = 30000)
public void testVMCSelectForceXTorqueY()
{
 RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 // select only torque
 SelectionMatrix6D selectionMatrix = new SelectionMatrix6D();
 selectionMatrix.selectLinearX(true);
 selectionMatrix.selectAngularY(true);
 submitAndCheckVMC(pelvis, foot, desiredWrench, selectionMatrix);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.6)
@Test(timeout = 30000)
public void testVMCWrongExpressedInFrame()
{
 RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), pelvis.getBodyFixedFrame(), desiredTorque, desiredForce);
 // select only torque
 SelectionMatrix6D selectionMatrix = new SelectionMatrix6D();
 selectionMatrix.clearSelection();
 selectionMatrix.setToAngularSelectionOnly();
 submitAndCheckVMC(pelvis, foot, desiredWrench, selectionMatrix);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.6)
@Test(timeout = 30000)
public void testVMCSelectForceZ()
{
 RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 SelectionMatrix6D selectionMatrix = new SelectionMatrix6D();
 selectionMatrix.clearSelection();
 selectionMatrix.selectLinearZ(true);
 submitAndCheckVMC(pelvis, foot, desiredWrench, selectionMatrix);
}

代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test

@ContinuousIntegrationTest(estimatedDuration = 0.5)
@Test(timeout = 30000)
public void testVMCSelectTorqueY()
{
 RobotLegs robotLeg = VirtualModelMomentumControllerTestHelper.createRobotLeg(gravity);
 RigidBodyBasics endEffector = robotLeg.getFoot(RobotSide.LEFT);
 RigidBodyBasics foot = endEffector.getParentJoint().getSuccessor();
 RigidBodyBasics pelvis = robotLeg.getRootJoint().getSuccessor();
 // send in the correct frame with identity selection matrix
 FrameVector3D desiredForce = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 FrameVector3D desiredTorque = EuclidFrameRandomTools.nextFrameVector3D(random, foot.getBodyFixedFrame());
 Wrench desiredWrench = new Wrench(foot.getBodyFixedFrame(), foot.getBodyFixedFrame(), desiredTorque, desiredForce);
 SelectionMatrix6D selectionMatrix = new SelectionMatrix6D();
 selectionMatrix.setSelectionFrame(robotLeg.getReferenceFrames().getCenterOfMassFrame());
 selectionMatrix.clearSelection();
 selectionMatrix.selectAngularY(true);
 submitAndCheckVMC(pelvis, foot, desiredWrench, selectionMatrix);
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com