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

x33g5p2x  于2022-01-26 转载在 其他  
字(15.3k)|赞(0)|评价(0)|浏览(119)

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

OneDoFJointBasics.getSuccessor介绍

暂无

代码示例

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

/**
* Retrieves the child or successor {@code RigidBody} from a simulated joint.
* <p>
* This method first retrieves the corresponding inverse dynamics joint and then returns its
* successor.
* </p>
* 
* @param joint the simulated joint.
* @return the child/successor rigid-body.
*/
public RigidBodyBasics getRigidBody(Joint joint)
{
 if (joint instanceof FloatingJoint)
 {
   FloatingJointBasics parentSixDoFJoint = floatingToSixDofToJointMap.get(joint);
   return parentSixDoFJoint.getSuccessor();
 }
 else if (joint instanceof OneDegreeOfFreedomJoint)
 {
   OneDoFJointBasics parentOneDoFJoint = scsToOneDoFJointMap.get(joint);
   return parentOneDoFJoint.getSuccessor();
 }
 else
 {
   throw new RuntimeException();
 }
}

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

public ControllerSpy(OneDoFJointBasics[] spineJoints, SimulationConstructionSet scs, double controllerDT)
{
  this.spineJoints = spineJoints;
  this.controllerDT = controllerDT;
  spineJointClones = MultiBodySystemFactories.cloneOneDoFJointKinematicChain(spineJoints);
  chestClone = spineJointClones[spineJointClones.length - 1].getSuccessor();
  for (int jointIdx = 0; jointIdx < numberOfJoints; jointIdx++)
  {
   OneDoFJointBasics joint = spineJoints[jointIdx];
   jointDesiredsMap.put(joint, findJointDesired(scs, joint));
   jointControlEnabled.put(joint, findJointControlEnabled(scs, joint));
  }
  orientationControlEnabled = findOrientationControlEnabled(scs, chest);
  desiredOrientation = findOrientationDesired(scs, chest);
  inconsistentControl.set(false);
  maxSpeed.set(0.0);
}

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

private LinkedHashMap<WrenchCalculatorInterface, ForceSensorDefinition> generateForceSensorDefinitions(
   ArrayList<WrenchCalculatorInterface> groundContactPointBasedWrenchCalculators)
{
 LinkedHashMap<WrenchCalculatorInterface, ForceSensorDefinition> forceSensorDefinitions = new LinkedHashMap<WrenchCalculatorInterface, ForceSensorDefinition>();
 for (WrenchCalculatorInterface groundContactPointBasedWrenchCalculator : groundContactPointBasedWrenchCalculators)
 {
   Joint forceTorqueSensorJoint = groundContactPointBasedWrenchCalculator.getJoint();
   OneDoFJointBasics sensorParentJoint;
   if (forceTorqueSensorJoint instanceof OneDegreeOfFreedomJoint)
    sensorParentJoint = scsToInverseDynamicsJointMap.getInverseDynamicsOneDoFJoint((OneDegreeOfFreedomJoint) forceTorqueSensorJoint);
   else
    throw new RuntimeException("Force sensor is only supported for OneDegreeOfFreedomJoint.");
   RigidBodyTransform transformFromSensorToParentJoint = new RigidBodyTransform();
   groundContactPointBasedWrenchCalculator.getTransformToParentJoint(transformFromSensorToParentJoint);
   ForceSensorDefinition sensorDefinition = new ForceSensorDefinition(groundContactPointBasedWrenchCalculator.getName(), sensorParentJoint.getSuccessor(), transformFromSensorToParentJoint);
   forceSensorDefinitions.put(groundContactPointBasedWrenchCalculator, sensorDefinition);
 }
 return forceSensorDefinitions;
}

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

public ForwardDynamicComparisonScript(Robot robot, DRCRobotModel robotModel)
{
  this.robot = robot;
  FullHumanoidRobotModel fullRobotModel = robotModel.createFullRobotModel();
  List<JointBasics> ignoredJoints = robotModel.getJointMap().getLastSimulatedJoints().stream()
                        .flatMap(name -> SubtreeStreams.fromChildren(fullRobotModel.getOneDoFJointByName(name).getSuccessor()))
                        .collect(Collectors.toList());
  multiBodySystem = MultiBodySystemBasics.toMultiBodySystemBasics(fullRobotModel.getElevator(), ignoredJoints);
  calculator = new ForwardDynamicsCalculator(multiBodySystem);
  floatingJoint = fullRobotModel.getRootJoint();
  allOneDoFJoints = MultiBodySystemTools.filterJoints(multiBodySystem.getJointsToConsider(), OneDoFJointBasics.class);
  multiBodySystem.getAllJoints().forEach(joint -> nameToJointMap.put(joint.getName(), joint));
}

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

RigidBodyBasics body = joint.getSuccessor();
Twist actualTwist = new Twist();
twistCalculator.getTwistOfBody(body, actualTwist);
ReferenceFrame bodyFrameInFuture = jointsInFuture.get(jointIndex).getSuccessor().getBodyFixedFrame();
Twist expectedTwist = computeExpectedTwistByFiniteDifference(dt, bodyFrame, bodyFrameInFuture);

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

RigidBodyBasics body = joint.getSuccessor();
Twist actualTwist = new Twist();
twistCalculator.getTwistOfBody(body, actualTwist);
ReferenceFrame bodyFrameInFuture = jointsInFuture.get(jointIndex).getSuccessor().getBodyFixedFrame();
Twist expectedTwist = computeExpectedTwistByFiniteDifference(dt, bodyFrame, bodyFrameInFuture);

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

@ContinuousIntegrationTest(estimatedDuration = 0.1)
@Test(timeout = 30000)
public void testAgainstTwistCalculatorWithChainRobot() throws Exception
{
 Random random = new Random(435423L);
 int numberOfJoints = 100;
 List<OneDoFJoint> joints = MultiBodySystemRandomTools.nextOneDoFJointChain(random, numberOfJoints);
 TwistCalculator twistCalculator = new TwistCalculator(worldFrame, joints.get(0).getPredecessor());
 Twist actualTwist = new Twist();
 Twist expectedTwist = new Twist();
 for (int i = 0; i < 100; i++)
 {
   MultiBodySystemRandomTools.nextState(random, JointStateType.CONFIGURATION, -1.0, 1.0, joints);
   MultiBodySystemRandomTools.nextState(random, JointStateType.VELOCITY, -1.0, 1.0, joints);
   joints.get(0).getPredecessor().updateFramesRecursively();
   twistCalculator.compute();
   for (int jointIndex = 0; jointIndex < numberOfJoints; jointIndex++)
   {
    OneDoFJointBasics joint = joints.get(jointIndex);
    RigidBodyBasics body = joint.getSuccessor();
    MovingReferenceFrame bodyFrame = body.getBodyFixedFrame();
    twistCalculator.getTwistOfBody(body, expectedTwist);
    bodyFrame.getTwistOfFrame(actualTwist);
    MecanoTestTools.assertTwistEquals(expectedTwist, actualTwist, 1.0e-5);
   }
 }
}

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

public ReachabilityMapSolver(OneDoFJointBasics[] robotArmJoints, YoGraphicsListRegistry yoGraphicsListRegistry, YoVariableRegistry parentRegistry)
{
 this.robotArmJoints = robotArmJoints;
 endEffector = robotArmJoints[robotArmJoints.length - 1].getSuccessor();
 kinematicsToolboxController = new KinematicsToolboxController(commandInputManager, statusOutputManager, null, robotArmJoints,
                                Collections.singleton(endEffector), yoGraphicsListRegistry, registry);
 commandInputManager.registerConversionHelper(new KinematicsToolboxCommandConverter(MultiBodySystemTools.getRootBody(endEffector)));
 defaultArmConfiguration = RobotConfigurationDataFactory.create(robotArmJoints, new ForceSensorDefinition[0], new IMUDefinition[0]);
 RobotConfigurationDataFactory.packJointState(defaultArmConfiguration, robotArmJoints);
 maximumNumberOfIterations.set(DEFAULT_MAX_NUMBER_OF_ITERATIONS);
 solutionQualityThreshold.set(DEFAULT_QUALITY_THRESHOLD);
 solutionStabilityThreshold.set(DEFAULT_STABILITY_THRESHOLD);
 solutionMinimumProgression.set(DEFAULT_MIN_PROGRESSION);
 parentRegistry.addChild(registry);
}

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

@ContinuousIntegrationTest(estimatedDuration = 0.1)
@Test(timeout = 30000)
public void testAgainstTwistCalculatorWithPrismaticChainRobot() throws Exception
{
 Random random = new Random(435423L);
 int numberOfJoints = 100;
 List<PrismaticJoint> joints = MultiBodySystemRandomTools.nextPrismaticJointChain(random, numberOfJoints);
 TwistCalculator twistCalculator = new TwistCalculator(worldFrame, joints.get(0).getPredecessor());
 Twist actualTwist = new Twist();
 Twist expectedTwist = new Twist();
 for (int i = 0; i < 100; i++)
 {
   MultiBodySystemRandomTools.nextState(random, JointStateType.CONFIGURATION, -1.0, 1.0, joints);
   MultiBodySystemRandomTools.nextState(random, JointStateType.VELOCITY, -1.0, 1.0, joints);
   joints.get(0).getPredecessor().updateFramesRecursively();
   twistCalculator.compute();
   for (int jointIndex = 0; jointIndex < numberOfJoints; jointIndex++)
   {
    OneDoFJointBasics joint = joints.get(jointIndex);
    RigidBodyBasics body = joint.getSuccessor();
    MovingReferenceFrame bodyFrame = body.getBodyFixedFrame();
    twistCalculator.getTwistOfBody(body, expectedTwist);
    bodyFrame.getTwistOfFrame(actualTwist);
    MecanoTestTools.assertTwistEquals(expectedTwist, actualTwist, 1.0e-5);
   }
 }
}

代码示例来源:origin: us.ihmc/ihmc-whole-body-controller

RigidBodyBasics spinePitchBody = fullRobotModel.getSpineJoint(SpineJointName.SPINE_PITCH).getSuccessor();
spinePitchCenterOfMassCalculator = createCenterOfMassCalculatorInJointZUpFrame(spinePitchBody, true);
spinePitchCoMInZUpFrame = new YoFramePoint3D("spinePitchCoMInZUpFrame", spinePitchCenterOfMassCalculator.getReferenceFrame(), registry);
RigidBodyBasics leftHipPitchBody = fullRobotModel.getLegJoint(RobotSide.LEFT, LegJointName.HIP_PITCH).getSuccessor();
leftHipPitchCenterOfMassCalculator = createCenterOfMassCalculatorInJointZUpFrame(leftHipPitchBody, true);
leftHipPitchCoMInZUpFrame = new YoFramePoint3D("leftHipPitchCoMInZUpFrame", leftHipPitchCenterOfMassCalculator.getReferenceFrame(), registry);
RigidBodyBasics rightHipPitchBody = fullRobotModel.getLegJoint(RobotSide.RIGHT, LegJointName.HIP_PITCH).getSuccessor();
rightHipPitchCenterOfMassCalculator = createCenterOfMassCalculatorInJointZUpFrame(rightHipPitchBody, true);
rightHipPitchCoMInZUpFrame = new YoFramePoint3D("rightHipPitchCoMInZUpFrame", rightHipPitchCenterOfMassCalculator.getReferenceFrame(), registry);
RigidBodyBasics leftKneeBody = fullRobotModel.getLegJoint(RobotSide.LEFT, LegJointName.KNEE_PITCH).getSuccessor();
leftKneeCenterOfMassCalculator = createCenterOfMassCalculatorInJointZUpFrame(leftKneeBody, true);
leftKneeCoMInZUpFrame = new YoFramePoint3D("leftKneeCoMInZUpFrame", leftKneeCenterOfMassCalculator.getReferenceFrame(), registry);
RigidBodyBasics rightKneeBody = fullRobotModel.getLegJoint(RobotSide.RIGHT, LegJointName.KNEE_PITCH).getSuccessor();
rightKneeCenterOfMassCalculator = createCenterOfMassCalculatorInJointZUpFrame(rightKneeBody, true);
rightKneeCoMInZUpFrame = new YoFramePoint3D("rightKneeCoMInZUpFrame", rightKneeCenterOfMassCalculator.getReferenceFrame(), registry);

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

private ChestTrajectoryMessage createRandomChestMessage(double trajectoryTime, Random random)
{
 OneDoFJointBasics[] spineClone = MultiBodySystemFactories.cloneOneDoFJointKinematicChain(pelvis, chest);
 MultiBodySystemRandomTools.nextStateWithinJointLimits(random, JointStateType.CONFIGURATION, spineClone);
 RigidBodyBasics chestClone = spineClone[spineClone.length - 1].getSuccessor();
 FrameQuaternion desiredRandomChestOrientation = new FrameQuaternion(chestClone.getBodyFixedFrame());
 desiredRandomChestOrientation.changeFrame(ReferenceFrame.getWorldFrame());
 Quaternion desiredOrientation = new Quaternion(desiredRandomChestOrientation);
 return HumanoidMessageTools.createChestTrajectoryMessage(trajectoryTime, desiredOrientation, ReferenceFrame.getWorldFrame(), ReferenceFrame.getWorldFrame());
}

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

@ContinuousIntegrationTest(estimatedDuration = 1.0)
@Test(timeout = 30000)
public void testAllFramesInFullRobotModelMatchHumanoidReferenceFramesThroughHashCode()
{
 DRCRobotModel robotModelA = getRobotModel();
 FullHumanoidRobotModel fullRobotModel = robotModelA.createFullRobotModel();
 HumanoidReferenceFrames referenceFramesA = new HumanoidReferenceFrames(fullRobotModel);
 ReferenceFrameHashCodeResolver referenceFrameHashCodeResolverA = new ReferenceFrameHashCodeResolver(fullRobotModel, referenceFramesA);
 for (OneDoFJointBasics joint : fullRobotModel.getOneDoFJoints())
 {
   ReferenceFrame frameBeforeJoint = joint.getFrameBeforeJoint();
   ReferenceFrame frameAfterJoint = joint.getFrameAfterJoint();
   ReferenceFrame comLinkBefore = joint.getPredecessor().getBodyFixedFrame();
   ReferenceFrame comLinkAfter = joint.getSuccessor().getBodyFixedFrame();
   System.out.println(frameBeforeJoint.getName() + " hashCode: " + frameBeforeJoint.hashCode());
   System.out.println(frameAfterJoint.getName() + " hashCode: " + frameAfterJoint.hashCode());
   System.out.println(comLinkBefore.getName() + " hashCode: " + comLinkBefore.hashCode());
   System.out.println(comLinkAfter.getName() + " hashCode: " + comLinkAfter.hashCode());
      ReferenceFrame otherFrameBeforeJoint = referenceFrameHashCodeResolverA.getReferenceFrameFromHashCode(frameBeforeJoint.hashCode());
   ReferenceFrame otherFrameAfterJoint = referenceFrameHashCodeResolverA.getReferenceFrameFromHashCode(frameAfterJoint.hashCode());
   ReferenceFrame otherCoMlinkBefore = referenceFrameHashCodeResolverA.getReferenceFrameFromHashCode(comLinkBefore.hashCode());
   ReferenceFrame otherCoMLinkAfter = referenceFrameHashCodeResolverA.getReferenceFrameFromHashCode(comLinkAfter.hashCode());
   checkReferenceFramesMatch(frameBeforeJoint, otherFrameBeforeJoint);
   checkReferenceFramesMatch(frameAfterJoint, otherFrameAfterJoint);
   checkReferenceFramesMatch(comLinkBefore, otherCoMlinkBefore);
   checkReferenceFramesMatch(comLinkAfter, otherCoMLinkAfter);
 }
}

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

RigidBodyBasics body = joint.getSuccessor();
MovingReferenceFrame bodyFrame = body.getBodyFixedFrame();

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

Pair<FloatingJointBasics, OneDoFJointBasics[]> desiredFullRobotModel = KinematicsToolboxControllerTestRobots.createInverseDynamicsRobot(robotDescription);
commandInputManager = new CommandInputManager(KinematicsToolboxModule.supportedCommands());
commandInputManager.registerConversionHelper(new KinematicsToolboxCommandConverter(MultiBodySystemTools.getRootBody(desiredFullRobotModel.getRight()[0].getSuccessor())));

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

RigidBodyBasics chestClone = spineClone[spineClone.length - 1].getSuccessor();
  FrameQuaternion desiredRandomChestOrientation = new FrameQuaternion(chestClone.getBodyFixedFrame());
  desiredRandomChestOrientation.changeFrame(ReferenceFrame.getWorldFrame());
RigidBodyBasics chestClone = spineClone[spineClone.length - 1].getSuccessor();
FrameQuaternion desiredRandomChestOrientation = new FrameQuaternion(chestClone.getBodyFixedFrame());
desiredRandomChestOrientation.changeFrame(ReferenceFrame.getWorldFrame());

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

ForceSensorDefinition forceSensorDefinition = new ForceSensorDefinition(sdfForceSensor.getName(), inverseDynamicsJoint.getSuccessor(), sdfForceSensor.getTransformToJoint());
forceSensorDefinitions.add(forceSensorDefinition);

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

RigidBodyBasics chestClone = spineClone[spineClone.length - 1].getSuccessor();
FrameQuaternion desiredRandomChestOrientation = new FrameQuaternion(chestClone.getBodyFixedFrame());
desiredRandomChestOrientation.changeFrame(ReferenceFrame.getWorldFrame());

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

RigidBodyBasics chestClone = spineClone[spineClone.length - 1].getSuccessor();
FrameQuaternion desiredRandomChestOrientation = new FrameQuaternion(chestClone.getBodyFixedFrame());
desiredRandomChestOrientation.changeFrame(ReferenceFrame.getWorldFrame());

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

RigidBodyBasics headClone = neckJoints[numberOfJoints - 1].getSuccessor();
FrameQuaternion desiredRandomChestOrientation = new FrameQuaternion(headClone.getBodyFixedFrame());
desiredRandomChestOrientation.changeFrame(ReferenceFrame.getWorldFrame());

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

throw new RuntimeException("Force sensor is only supported for OneDegreeOfFreedomJoint.");
RigidBodyBasics rigidBodyToApplyWrenchTo = oneDoFJoint.getSuccessor();
ReferenceFrame bodyFixedFrame = rigidBodyToApplyWrenchTo.getBodyFixedFrame();

相关文章