gpt4 book ai didi

us.ihmc.robotics.screwTheory.Wrench类的使用及代码示例

转载 作者:知者 更新时间:2024-03-26 06:27:05 27 4
gpt4 key购买 nike

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

Wrench介绍

暂无

代码示例

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

public void getWrench(Wrench wrenchToPack)
{
 wrenchToPack.setToZero(successorWrench.getBodyFrame(), successorWrench.getExpressedInFrame());
 wrenchToPack.setAngularPartY(successorWrench.getAngularPartY());
 wrenchToPack.setLinearPartX(successorWrench.getLinearPartX());
 wrenchToPack.setLinearPartZ(successorWrench.getLinearPartZ());
}

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

public Wrench computeTotalExternalWrench(ReferenceFrame referenceFrame)
{
 Wrench totalGroundReactionWrench = new Wrench(referenceFrame, referenceFrame);
 Wrench temporaryWrench = new Wrench();
 for (int i = 0; i < listOfBodiesWithExternalWrenches.size(); i++)
 {
   Wrench externalWrench = externalWrenches.get(listOfBodiesWithExternalWrenches.get(i));
   temporaryWrench.set(externalWrench);
   temporaryWrench.changeFrame(referenceFrame);
   temporaryWrench.changeBodyFrameAttachedToSameBody(referenceFrame);
   totalGroundReactionWrench.add(temporaryWrench);
 }
 return totalGroundReactionWrench;
}

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

protected void putYoValuesIntoWrench()
{
 wrench.setToZero(bodyFrame, expressedInFrame);
 wrench.setLinearPart(linearPart.getFrameTuple());
 wrench.setAngularPart(angularPart.getFrameTuple());
}

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

public void computeTotalWrench(Wrench totalGroundReactionWrenchToPack, Collection<Wrench> wrenches, ReferenceFrame referenceFrame)
  {
   totalGroundReactionWrenchToPack.setToZero(referenceFrame, referenceFrame);

   for (Wrench wrench : wrenches)
   {
     temporaryWrench.set(wrench);
     temporaryWrench.changeFrame(referenceFrame);
     temporaryWrench.changeBodyFrameAttachedToSameBody(referenceFrame);
     totalGroundReactionWrenchToPack.add(temporaryWrench);
   }
  }
}

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

@Override
public void getWrench(Wrench wrenchToPack)
{
 wrenchToPack.changeBodyFrameAttachedToSameBody(measurementFrame);
 wrenchToPack.set(measurementFrame, wrench);
}

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

public void update(Wrench sensorWrench)
{
 sensorWrench.changeFrame(world);
 yoSensorForce.set(sensorWrench.getExpressedInFrame(), sensorWrench.getLinearPartX(), sensorWrench.getLinearPartY(), sensorWrench.getLinearPartZ());
 yoSensorTorque.set(sensorWrench.getExpressedInFrame(), sensorWrench.getAngularPartX(), sensorWrench.getAngularPartY(), sensorWrench.getAngularPartZ());
 if (addSimulatedSensorNoise.getBooleanValue())
 {
   double amp = 0.1;
   double bias = 0.25;
      yoSensorForce.add(amp*2.0*(Math.random()-0.5)+bias, amp*2.0*(Math.random()-0.5)+bias, amp*2.0*(Math.random()-0.5)+bias);
   yoSensorTorque.add(amp*2.0*(Math.random()-0.5)+bias, amp*2.0*(Math.random()-0.5)+bias, amp*2.0*(Math.random()-0.5)+bias);
 }
 
 updateSensorPosition();
 updateCenterOfMass();
 yoSensorToDistalCoMvectorInWorld.sub(distalCoMInWorld, yoSensorPositionInWorld);
 distalMassWrench.setToZero(world);
 distalMassWrench.setUsingArm(world, distalMassForceInWorld.getFrameTuple().getVector(), yoSensorToDistalCoMvectorInWorld.getFrameTuple().getVector());
 yoSensorForceFromDistalMass.set(distalMassWrench.getExpressedInFrame(), distalMassWrench.getLinearPartX(), distalMassWrench.getLinearPartY(), distalMassWrench.getLinearPartZ());
 yoSensorTorqueFromDistalMass.set(distalMassWrench.getExpressedInFrame(), distalMassWrench.getAngularPartX(), distalMassWrench.getAngularPartY(), distalMassWrench.getAngularPartZ());
 yoSensorForceMassCompensated.sub(yoSensorForce, yoSensorForceFromDistalMass);
 yoSensorTorqueMassCompensated.sub(yoSensorTorque, yoSensorTorqueFromDistalMass);
}

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

private void handleSpatialAccelerationCommand(SpatialAccelerationCommand command)
{
 RigidBody controlledBody = command.getEndEffector();
 SpatialAccelerationVector accelerationVector = command.getSpatialAcceleration();
 accelerationVector.changeBaseFrameNoRelativeAcceleration(ReferenceFrame.getWorldFrame());
 twistCalculator.getTwistOfBody(tmpTwist, controlledBody);
 tmpWrench.setToZero(accelerationVector.getBodyFrame(), accelerationVector.getExpressedInFrame());
 conversionInertias.get(controlledBody).computeDynamicWrenchInBodyCoordinates(accelerationVector, tmpTwist, tmpWrench);
 tmpWrench.changeBodyFrameAttachedToSameBody(controlledBody.getBodyFixedFrame());
 tmpWrench.changeFrame(ReferenceFrame.getWorldFrame());
 VirtualWrenchCommand virtualWrenchCommand = new VirtualWrenchCommand();
 virtualWrenchCommand.set(controlledBody, tmpWrench, command.getSelectionMatrix());
 virtualWrenchCommandList.addCommand(virtualWrenchCommand);
 if (controlledBody == controlRootBody)
 {
   tmpExternalWrench.set(tmpWrench);
   tmpExternalWrench.negate();
   tmpExternalWrench.changeFrame(controlledBody.getBodyFixedFrame());
   optimizationControlModule.submitExternalWrench(controlledBody, tmpExternalWrench);
 }
 optimizationControlModule.addSelection(command.getSelectionMatrix());
}

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

if ((wrench = wrenches.get(rigidBody)) != null)
 tempWrench.set(wrench);
 tempWrench.changeFrame(tempWrench.getBodyFrame());
 tempVector.setToZero(tempWrench.getExpressedInFrame());
 tempWrench.getLinearPart(tempVector);
 tempVector.changeFrame(ReferenceFrame.getWorldFrame());
 force.set(tempVector);
 tempVector.setToZero(tempWrench.getExpressedInFrame());
 tempWrench.getAngularPart(tempVector);
 tempVector.changeFrame(ReferenceFrame.getWorldFrame());
 torque.set(tempVector);
 tempPoint.setToZero(wrench.getBodyFrame());
 tempPoint.changeFrame(ReferenceFrame.getWorldFrame());
 pointOfApplication.set(tempPoint);

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

private void cancelHandWeight(RobotSide robotSide, Wrench wrenchToSubstractHandWeightTo, ReferenceFrame measurementFrame)
{
 CenterOfMassReferenceFrame handCoMFrame = wristsubtreeCenterOfMassFrames.get(robotSide);
 handCoMFrame.update();
 tempForce.setIncludingFrame(worldFrame, 0.0, 0.0, -wristSubtreeMass.get(robotSide).getDoubleValue() * gravity);
 tempForce.changeFrame(handCoMFrame);
 wristWrenchDueToGravity.setToZero(measurementFrame, handCoMFrame);
 wristWrenchDueToGravity.setLinearPart(tempForce);
 wristWrenchDueToGravity.changeFrame(measurementFrame);
 wrenchToSubstractHandWeightTo.sub(wristWrenchDueToGravity);
}

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

protected void getYoValuesFromWrench()
{
 linearPart.set(wrench.getExpressedInFrame(), wrench.getLinearPartX(), wrench.getLinearPartY(), wrench.getLinearPartZ());
 angularPart.set(wrench.getExpressedInFrame(), wrench.getAngularPartX(), wrench.getAngularPartY(), wrench.getAngularPartZ());
}

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

private void updateWristMeasuredWrench(FrameVector measuredForceToPack, FrameVector measuredTorqueToPack)
{
 momentumBasedController.getWristMeasuredWrenchHandWeightCancelled(measuredWrench, robotSide);
 measuredWrench.getLinearPartIncludingFrame(tempForceVector);
 measuredWrench.getAngularPartIncludingFrame(tempTorqueVector);
 deadzoneMeasuredForce.update(tempForceVector);
 deadzoneMeasuredTorque.update(tempTorqueVector);
 filteredMeasuredForce.update();
 filteredMeasuredTorque.update();
 filteredMeasuredForce.getFrameTupleIncludingFrame(tempForceVector);
 filteredMeasuredTorque.getFrameTupleIncludingFrame(tempTorqueVector);
 measuredWrench.setLinearPart(tempForceVector);
 measuredWrench.setAngularPart(tempTorqueVector);
 measuredWrench.changeFrame(controlFrame);
 measuredWrench.getLinearPartIncludingFrame(measuredForceToPack);
 measuredWrench.getAngularPartIncludingFrame(measuredTorqueToPack);
}

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

private void computeJointWrenchesAndTorques()
{
 for (int jointIndex = allJoints.size() - 1; jointIndex >= 0; jointIndex--)
 {
   InverseDynamicsJoint joint = allJoints.get(jointIndex);
   RigidBody successor = joint.getSuccessor();
   Wrench jointWrench = jointWrenches.get(joint);
   jointWrench.set(netWrenches.get(successor));
   Wrench externalWrench = externalWrenches.get(successor);
   jointWrench.sub(externalWrench);
   List<InverseDynamicsJoint> childrenJoints = successor.getChildrenJoints();
   for (int childIndex = 0; childIndex < childrenJoints.size(); childIndex++)
   {
    InverseDynamicsJoint child = childrenJoints.get(childIndex);
    if (!jointsToIgnore.contains(child))
    {
      Wrench wrenchExertedOnChild = jointWrenches.get(child);
      ReferenceFrame successorFrame = successor.getBodyFixedFrame();
      wrenchExertedByChild.set(wrenchExertedOnChild);
      wrenchExertedByChild.changeBodyFrameAttachedToSameBody(successorFrame);
      wrenchExertedByChild.scale(-1.0); // Action = -reaction
      wrenchExertedByChild.changeFrame(jointWrench.getExpressedInFrame());
      jointWrench.sub(wrenchExertedByChild);
    }
   }
   joint.setTorqueFromWrench(jointWrench);
 }
}

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

private Wrench createEmptyWrench()
{
 return new Wrench(bodyFrame, expressedInFrame);
}

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

public void control(SpatialAccelerationVector handSpatialAccelerationVector, Wrench toolWrench)
{
 if (!hasBeenInitialized)
 {
   update();
   initialize();
 }
 update();
 toolAcceleration.set(handSpatialAccelerationVector);
 toolAcceleration.changeFrameNoRelativeMotion(toolJoint.getFrameAfterJoint());
 // TODO: Take relative acceleration between uTorsoCoM and elevator in account
 toolAcceleration.changeBaseFrameNoRelativeAcceleration(elevatorFrame);
 toolAcceleration.changeBodyFrameNoRelativeAcceleration(toolJoint.getFrameAfterJoint());
 toolJoint.setDesiredAcceleration(toolAcceleration);
 inverseDynamicsCalculator.compute();
 inverseDynamicsCalculator.getJointWrench(toolJoint, toolWrench);
 toolWrench.negate();
 toolWrench.changeFrame(handFixedFrame);
 toolWrench.changeBodyFrameAttachedToSameBody(handFixedFrame);
 // Visualization
 temporaryVector.setIncludingFrame(handFixedFrame, toolWrench.getLinearPartX(), toolWrench.getLinearPartY(), toolWrench.getLinearPartZ());
 temporaryVector.changeFrame(ReferenceFrame.getWorldFrame());
 temporaryVector.scale(0.01);
 objectForceInWorld.set(temporaryVector);
}

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

public void setExternalWrenchToCompensateFor(RigidBody rigidBody, Wrench wrench)
{
 boolean containsRigidBody = externalWrenchesToCompensateFor.get(rigidBody) != null;
 if (!containsRigidBody)
 {
   externalWrenches.put(rigidBody, new Wrench(rigidBody.getBodyFixedFrame(), rigidBody.getBodyFixedFrame()));
   externalWrenchesToCompensateFor.put(rigidBody, new Wrench(rigidBody.getBodyFixedFrame(), rigidBody.getBodyFixedFrame()));
   externalWrenchesToCompensateForList.add(externalWrenchesToCompensateFor.get(rigidBody));
   rigidBodiesWithWrenchToCompensateFor.add(rigidBody);
 }
 ReferenceFrame bodyFixedFrame = rigidBody.getBodyFixedFrame();
 wrench.getBodyFrame().checkReferenceFrameMatch(bodyFixedFrame);
 wrench.getExpressedInFrame().checkReferenceFrameMatch(bodyFixedFrame);
 externalWrenchesToCompensateFor.get(rigidBody).set(wrench);
}

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

@Override
public void doControl()
{
 forceSensorData.getWrench(tempWrench);
 for(int i = 0; i < yoTorqueInJoints.size(); i++)
 {
   ImmutablePair<FrameVector, DoubleYoVariable> pair = yoTorqueInJoints.get(i);
   FrameVector jointAxis = pair.getLeft();
   DoubleYoVariable torqueAboutJointAxis = pair.getRight();
   tempWrench.changeFrame(jointAxis.getReferenceFrame());
   tempFrameVector.setToZero(tempWrench.getExpressedInFrame());
   tempWrench.getAngularPart(tempFrameVector);
   torqueAboutJointAxis.set(-tempFrameVector.dot(jointAxis));
 }
}

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

public void reset()
{
 for (int i = 0; i < listOfBodiesWithExternalWrenches.size(); i++)
 {
   Wrench externalWrench = externalWrenches.get(listOfBodiesWithExternalWrenches.get(i));
   externalWrench.setToZero(externalWrench.getBodyFrame(), externalWrench.getExpressedInFrame());
 }
}

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

public void computeDynamicWrenchInBodyCoordinates(SpatialAccelerationVector acceleration, Twist twist, Wrench dynamicWrenchToPack)    // TODO: write test
{
 checkExpressedInBodyFixedFrame();
 checkIsCrossPartZero();    // otherwise this operation would be a lot less efficient
 acceleration.getBodyFrame().checkReferenceFrameMatch(this.bodyFrame);
 acceleration.getBaseFrame().checkIsWorldFrame();
 acceleration.getExpressedInFrame().checkReferenceFrameMatch(this.expressedInframe);
 twist.getBodyFrame().checkReferenceFrameMatch(this.bodyFrame);
 twist.getBaseFrame().checkIsWorldFrame();
 twist.getExpressedInFrame().checkReferenceFrameMatch(this.expressedInframe);
 dynamicWrenchToPack.getBodyFrame().checkReferenceFrameMatch(this.bodyFrame);
 dynamicWrenchToPack.getExpressedInFrame().checkReferenceFrameMatch(this.expressedInframe);
 massMomentOfInertiaPart.transform(acceleration.getAngularPart(), tempVector);    // J * omegad
 dynamicWrenchToPack.setAngularPart(tempVector);    // [J * omegad; 0]
 massMomentOfInertiaPart.transform(twist.getAngularPart(), tempVector);    // J * omega
 tempVector.cross(twist.getAngularPart(), tempVector);    // omega x J * omega
 dynamicWrenchToPack.addAngularPart(tempVector);    // [J * omegad + omega x J * omega; 0]
 tempVector.set(acceleration.getLinearPart());    // vd
 tempVector.scale(mass);    // m * vd
 dynamicWrenchToPack.setLinearPart(tempVector);    // [J * omegad + omega x J * omega; m * vd]
 tempVector.set(twist.getLinearPart());    // v
 tempVector.scale(mass);    // m * v
 tempVector.cross(twist.getAngularPart(), tempVector);    // omega x m * v
 dynamicWrenchToPack.addLinearPart(tempVector);    // [J * omegad + omega x J * omega; m * vd + omega x m * v]
}

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

public Map<RigidBody, Wrench> computeWrenchesFromRho(DenseMatrix64F rho)
{
 // Reinintialize wrenches
 for (int i = 0; i < rigidBodies.size(); i++)
 {
   RigidBody rigidBody = rigidBodies.get(i);
   ReferenceFrame bodyFixedFrame = rigidBody.getBodyFixedFrame();
   wrenchesFromRho.get(rigidBody).setToZero(bodyFixedFrame, bodyFixedFrame);
 }
 int rhoStartIndex = 0;
 for (int i = 0; i < rigidBodies.size(); i++)
 {
   RigidBody rigidBody = rigidBodies.get(i);
   ReferenceFrame bodyFixedFrame = rigidBody.getBodyFixedFrame();
   PlaneContactStateToWrenchMatrixHelper helper = planeContactStateToWrenchMatrixHelpers.get(rigidBody);
   helper.computeWrenchFromRho(rhoStartIndex, rho);
   Wrench wrenchFromRho = helper.getWrenchFromRho();
   wrenchFromRho.changeFrame(bodyFixedFrame);
   wrenchesFromRho.get(rigidBody).add(wrenchFromRho);
   rhoStartIndex += helper.getRhoSize();
 }
 return wrenchesFromRho;
}

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

wrench = new Wrench(centerOfMassFrame, centerOfMassFrame, momentumObjective);
   else
     wrench = new Wrench(centerOfMassFrame, centerOfMassFrame, new DenseMatrix64F(Wrench.SIZE, 1));
   wrench.changeFrame(controlledBody.getBodyFixedFrame());
   wrench.changeBodyFrameAttachedToSameBody(controlledBody.getBodyFixedFrame());
   groundReactionWrenches.put(controlledBody, wrench);
for (RigidBody rigidBody : rigidBodiesWithExternalWrench)
  externalWrenchSolution.get(rigidBody).changeFrame(centerOfMassFrame);
  externalWrenchSolution.get(rigidBody).getMatrix(tmpWrench);
  CommonOps.add(contactWrench, tmpWrench, contactWrench);
  externalWrenchSolution.get(rigidBody).changeFrame(rigidBody.getBodyFixedFrame());

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