us.ihmc.mecano.multiBodySystem.interfaces.RigidBodyBasics.updateFramesRecursively()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(65)

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

RigidBodyBasics.updateFramesRecursively介绍

[英]Request all the children joints of this rigid-body to update their reference frame and request their own successor to call this same method.

By calling this method on the root body of a robot, it will update the reference frames of all the robot's joints.
[中]请求该刚体的所有子关节更新它们的参考框架,并请求它们自己的继承者调用相同的方法。
通过在机器人的根体上调用此方法,它将更新机器人所有关节的参考帧。

代码示例

代码示例来源:origin: us.ihmc/ihmc-robot-models

/** {@inheritDoc} */
@Override
public synchronized void updateFrames()
{
 elevator.updateFramesRecursively();
}

代码示例来源:origin: us.ihmc/simulation-construction-set-tools-test

public void updateFrames()
{
  elevator.updateFramesRecursively();
}

代码示例来源:origin: us.ihmc/ihmc-robot-models

@Override public void updateFrames()
{
  elevator.updateFramesRecursively();
}

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

public void updateFramesRecursively()
{
 elevator.updateFramesRecursively();
}

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

@Override
public void updateFrames()
{
  worldFrame.update();
  elevator.updateFramesRecursively();
}

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

/**
* Updates all the reference frames and the twist calculator. This method needs to be called at
* the beginning of each control tick.
*/
protected void updateTools()
{
 rootBody.updateFramesRecursively();
 centerOfMassFrame.update();
}

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

@Override
public void updateFrames()
{
  worldFrame.update();
  elevator.updateFramesRecursively();
}

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

@Override
public void updateFrames()
{
  worldFrame.update();
  elevator.updateFramesRecursively();
}

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

@Override
public void updateFrames()
{
  worldFrame.update();
  elevator.updateFramesRecursively();
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public void compare()
{
 for (MassMatrixCalculator massMatrixCalculator : massMatrixCalculators)
 {
   long startTime = System.nanoTime();
   int nIterations = 10000;
   for (int i = 0; i < nIterations; i++)
   {
    MultiBodySystemRandomTools.nextState(random, JointStateType.CONFIGURATION, -Math.PI / 2.0, Math.PI / 2.0, joints);
    elevator.updateFramesRecursively();
    massMatrixCalculator.compute();
   }
   long endTime = System.nanoTime();
   double timeTaken = (endTime - startTime) / (1e9);
   double timeTakenPerIteration = timeTaken / nIterations;
   System.out.println("Time taken per iteration: " + timeTakenPerIteration + " s");
 }
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test

protected void setUpRandomChainRobot()
{
 Random random = new Random();
 joints = new ArrayList<RevoluteJoint>();
 Vector3D[] jointAxes = {X, Y, Z, X, Z, Z, X, Y, Z, X};
 joints.addAll(MultiBodySystemRandomTools.nextRevoluteJointChain(random, "", elevator, jointAxes));
 MultiBodySystemRandomTools.nextState(random, JointStateType.CONFIGURATION, -Math.PI / 2.0, Math.PI / 2.0, joints);
 elevator.updateFramesRecursively();
 MultiBodySystemRandomTools.nextState(random, JointStateType.VELOCITY, joints);
}

代码示例来源:origin: us.ihmc/ihmc-simulation-toolkit

private void updateReferenceFrames()
{
 if (referenceFrames != null)
 {
   referenceFrames.updateFrames();
 }
 else
 {
   rootJoint.getPredecessor().updateFramesRecursively();
 }
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit

public void altCompare()
{
 double diffIdTimeTaken = 0.0;
 double compositeTimeTaken = 0.0;
 int nIterations = 10000;
 for (int i = 0; i < nIterations; i++)
 {
   MultiBodySystemRandomTools.nextState(random, JointStateType.CONFIGURATION, -Math.PI / 2.0, Math.PI / 2.0, joints);
   elevator.updateFramesRecursively();
   long startTime = System.nanoTime();
   diffIdMassMatricCalculator.compute();
   long endTime = System.nanoTime();
   diffIdTimeTaken += (endTime - startTime) / (1e9);
   startTime = System.nanoTime();
   compositeMassMatricCalculator.reset();
   endTime = System.nanoTime();
   compositeTimeTaken += (endTime - startTime) / (1e9);
 }
 double diffIdTimeTakenPerIteration = diffIdTimeTaken / nIterations;
 double compositeTimeTakenPerIteration = compositeTimeTaken / nIterations;
 System.out.println("Diff ID time taken per iteration: " + diffIdTimeTakenPerIteration + " s");
 System.out.println("Composite RBM time taken per iteration: " + compositeTimeTakenPerIteration + " s");
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test

private Momentum computeMomentum(RigidBodyBasics elevator, ReferenceFrame frame)
  {
   elevator.updateFramesRecursively();
   MomentumCalculator momentumCalculator = new MomentumCalculator(elevator);
   Momentum momentum = new Momentum(frame);
   momentumCalculator.computeAndPack(momentum);

   return momentum;
  }
}

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

private void randomizeJointPositions(Random random, Pair<FloatingJointBasics, OneDoFJointBasics[]> randomizedFullRobotModel,
                  double percentOfMotionRangeAllowed)
{
 for (OneDoFJointBasics joint : randomizedFullRobotModel.getRight())
 {
   double jointLimitLower = joint.getJointLimitLower();
   if (Double.isInfinite(jointLimitLower))
    jointLimitLower = -Math.PI;
   double jointLimitUpper = joint.getJointLimitUpper();
   if (Double.isInfinite(jointLimitUpper))
    jointLimitUpper = -Math.PI;
   double rangeReduction = (1.0 - percentOfMotionRangeAllowed) * (jointLimitUpper - jointLimitLower);
   jointLimitLower += 0.5 * rangeReduction;
   jointLimitUpper -= 0.5 * rangeReduction;
   joint.setQ(RandomNumbers.nextDouble(random, jointLimitLower, jointLimitUpper));
 }
 MultiBodySystemTools.getRootBody(randomizedFullRobotModel.getRight()[0].getPredecessor()).updateFramesRecursively();
}

代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test

private void initializeFourBar(RigidBodyTransform jointAtoElevator, RigidBodyTransform jointBtoA, RigidBodyTransform jointCtoB, RigidBodyTransform jointDtoC,
   Vector3D jointAxisA, Vector3D jointAxisB, Vector3D jointAxisC, Vector3D jointAxisD)
{
 masterJointA = new RevoluteJoint("jointA", elevator, jointAtoElevator, jointAxisA);
 rigidBodyAB = createAndAttachCylinderRB("rigidBodyAB", masterJointA);
 passiveJointB = ScrewTools.addPassiveRevoluteJoint("jointB", rigidBodyAB, jointBtoA, jointAxisB, true);
 rigidBodyBC = createAndAttachCylinderRB("rigidBodyBC", passiveJointB);
 passiveJointC = ScrewTools.addPassiveRevoluteJoint("jointC", rigidBodyBC, jointCtoB, jointAxisC, true);
 rigidBodyCD = createAndAttachCylinderRB("rigidBodyCD", passiveJointC);
 passiveJointD = ScrewTools.addPassiveRevoluteJoint("jointD", rigidBodyCD, jointDtoC, jointAxisD, true);
 rigidBodyDA = createAndAttachCylinderRB("rigidBodyCD", passiveJointD);
 masterJointA.setQ(random.nextDouble());
 passiveJointB.setQ(random.nextDouble());
 passiveJointC.setQ(random.nextDouble());
 passiveJointD.setQ(random.nextDouble());
 elevator.updateFramesRecursively();
}

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

private Pair<FloatingJointBasics, OneDoFJointBasics[]> createFullRobotModelAtInitialConfiguration()
{
 RobotDescription robotDescription = new KinematicsToolboxControllerTestRobots.SevenDoFArm();
 Pair<FloatingJointBasics, OneDoFJointBasics[]> fullRobotModel = KinematicsToolboxControllerTestRobots.createInverseDynamicsRobot(robotDescription);
 for (OneDoFJointBasics joint : fullRobotModel.getRight())
 {
   if (Double.isFinite(joint.getJointLimitLower()) && Double.isFinite(joint.getJointLimitUpper()))
    joint.setQ(0.5 * (joint.getJointLimitLower() + joint.getJointLimitUpper()));
 }
 MultiBodySystemTools.getRootBody(fullRobotModel.getRight()[0].getPredecessor()).updateFramesRecursively();
 return fullRobotModel;
}

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

PlanarRobotArm()
{
  elevator = new RigidBody("elevator", worldFrame);
  elevatorFrame = elevator.getBodyFixedFrame();
  centerOfMassFrame = new CenterOfMassReferenceFrame("centerOfMassFrame", ReferenceFrame.getWorldFrame(), elevator);
  upperArm = createUpperArm(elevator);
  lowerArm = createLowerArm(upperArm);
  hand = createHand(lowerArm);
  scsRobotArm = new SCSRobotFromInverseDynamicsRobotModel("robotArm", elevator.getChildrenJoints().get(0));
  scsRobotArm.setGravity(0);
  scsRobotArm.updateJointPositions_ID_to_SCS();
  scsRobotArm.update();
  addLinkGraphics();
  addForcePoint();
  oneDoFJoints = MultiBodySystemTools.createOneDoFJointPath(elevator, hand);
  elevator.updateFramesRecursively();
}

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

RobotArm()
{
  elevator = new RigidBody("elevator", worldFrame);
  elevatorFrame = elevator.getBodyFixedFrame();
  centerOfMassFrame = new CenterOfMassReferenceFrame("centerOfMass", ReferenceFrame.getWorldFrame(), elevator);
  shoulderDifferentialYaw = createDifferential("shoulderDifferential", elevator, new Vector3D(), Z);
  RigidBodyBasics shoulderDifferentialRoll = createDifferential("shoulderDifferential", shoulderDifferentialYaw, new Vector3D(), X);
  RigidBodyBasics upperArm = createUpperArm(shoulderDifferentialRoll);
  RigidBodyBasics lowerArm = createLowerArm(upperArm);
  RigidBodyBasics wristDifferentialRoll = createDifferential("wristDifferential", lowerArm, new Vector3D(0.0, 0.0, SHIN_LENGTH), X);
  //RigidBody wristDifferentialYaw = createDifferential("wristDifferential", wristDifferentialRoll, new Vector3d(), Z);
  hand = createHand(wristDifferentialRoll);
  scsRobotArm = new SCSRobotFromInverseDynamicsRobotModel("robotArm", elevator.getChildrenJoints().get(0));
  scsRobotArm.setGravity(0);
  scsRobotArm.updateJointPositions_ID_to_SCS();
  scsRobotArm.update();
  addLinkGraphics();
  addForcePoint();
  oneDoFJoints = MultiBodySystemTools.createOneDoFJointPath(elevator, hand);
  elevator.updateFramesRecursively();
}

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

@Override
public void receivedPacket(RobotConfigurationData packet)
{
 latestRobotConfigurationData = packet;
 FloatingJointBasics rootJoint = fullRobotModel.getRootJoint();
 TFloatArrayList newJointAngles = packet.getJointAngles();
 TFloatArrayList newJointVelocities = packet.getJointAngles();
 TFloatArrayList newJointTorques = packet.getJointTorques();
 OneDoFJointBasics[] oneDoFJoints = fullRobotModel.getOneDoFJoints();
 for (int i = 0; i < newJointAngles.size(); i++)
 {
   oneDoFJoints[i].setQ(newJointAngles.get(i));
   oneDoFJoints[i].setQd(newJointVelocities.get(i));
   oneDoFJoints[i].setTau(newJointTorques.get(i));
 }
 pelvisTranslationFromRobotConfigurationData.set(packet.getRootTranslation());
 pelvisOrientationFromRobotConfigurationData.set(packet.getRootOrientation());
 rootJoint.getJointPose().setPosition(pelvisTranslationFromRobotConfigurationData.getX(), pelvisTranslationFromRobotConfigurationData.getY(), pelvisTranslationFromRobotConfigurationData.getZ());
 rootJoint.getJointPose().getOrientation().setQuaternion(pelvisOrientationFromRobotConfigurationData.getX(), pelvisOrientationFromRobotConfigurationData.getY(), pelvisOrientationFromRobotConfigurationData.getZ(), pelvisOrientationFromRobotConfigurationData.getS());
 
 computeDriftTransform();
 rootJoint.getPredecessor().updateFramesRecursively();
 yoVariableServer.update(System.currentTimeMillis());
}

相关文章