us.ihmc.mecano.multiBodySystem.interfaces.OneDoFJointBasics类的使用及代码示例

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

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

OneDoFJointBasics介绍

[英]Write and read interface for joints with a single degree of freedom (DoF).

The 1 DoF can either be a translation DoF, see PrismaticJoint, or a rotation DoF, see RevoluteJoint.

A 1-DoF joint is usually actuated, has limits describing the range of motion and actuator capabilities.
[中]单自由度(DoF)关节的读写接口。
1自由度可以是平移自由度,请参见棱柱点,也可以是旋转自由度,请参见旋转点。
单自由度关节通常是驱动的,其运动范围和执行器能力有限。

代码示例

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

private void updateJointAngles()
{
 for (int i = 0; i < oneDoFJoints.length; i++)
 {
   double newQ = oneDoFJoints[i].getQ() + correction.get(i, 0);
   newQ = MathTools.clamp(newQ, oneDoFJoints[i].getJointLimitLower(), oneDoFJoints[i].getJointLimitUpper());
   oneDoFJoints[i].setQ(newQ);
   oneDoFJoints[i].getFrameAfterJoint().update();
 }
}

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

@Override
public String getName()
{
 return joint.getName();
}

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

/**
* Integrates the given {@code joint}'s acceleration and velocity to update its velocity and
* configuration.
* 
* @param joint the joint to integrate the state of. The joint configuration is modified.
*/
public void doubleIntegrateFromAcceleration(OneDoFJointBasics joint)
{
 double initialQ = joint.getQ();
 double initialQd = joint.getQd();
 double qdd = joint.getQdd();
 joint.setQ(doubleIntegratePosition(qdd, initialQd, initialQ));
 joint.setQd(integrateVelocity(qdd, initialQd));
}

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

public void setJointLimits(OneDoFJointBasics joint)
{
 positionSoftUpperLimit = joint.getJointLimitUpper();
 positionSoftLowerLimit = joint.getJointLimitLower();
 velocityLimitUpper = joint.getVelocityLimitUpper();
 velocityLimitLower = joint.getVelocityLimitLower();
 torqueLimitUpper = joint.getEffortLimitUpper();
 torqueLimitLower = joint.getEffortLimitLower();
}

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

public void get(double[] buffer, int offset)
{
 buffer[offset + 0] = joint.getQ();
 buffer[offset + 1] = joint.getQd();
}

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

private static void setJointPositionToMidRange(OneDoFJointBasics joint)
{
 double jointLimitUpper = joint.getJointLimitUpper();
 double jointLimitLower = joint.getJointLimitLower();
 joint.setQ(0.5 * (jointLimitUpper + jointLimitLower));
}

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

@Override
  public void update()
  {
   joint.setQ(handle.getPosition());
   joint.setQd(handle.getVelocity());
   bl_qd.update();
   joint.setTau(handle.getEffort());

   q.set(joint.getQ());
   qd.set(joint.getQd());
   tau.set(joint.getTau());

   positionStepSizeLimiter.updateOutput(q.getDoubleValue(), q_d.getDoubleValue());
   handle.setDesiredPosition(positionStepSizeLimiter.getDoubleValue());
  }
}

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

joint.setQ(EuclidCoreRandomTools.nextDouble(random, joint.getJointLimitLower(), joint.getJointLimitUpper()));
  break;
case VELOCITY:
  joint.setQd(EuclidCoreRandomTools.nextDouble(random, joint.getVelocityLimitLower(), joint.getVelocityLimitUpper()));
  break;
case EFFORT:
  joint.setTau(EuclidCoreRandomTools.nextDouble(random, joint.getEffortLimitLower(), joint.getEffortLimitUpper()));
  break;
default:

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

/**
* Integrates the given {@code joint}'s velocity to update its configuration.
* 
* @param joint the joint to integrate the state of. The joint configuration is modified.
*/
public void integrateFromVelocity(OneDoFJointBasics joint)
{
 double initialQ = joint.getQ();
 double qd = joint.getQd();
 joint.setQ(integratePosition(qd, initialQ));
}

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

/**
* Generates a random state and update the given {@code joint} with it.
* 
* @param random the random generator to use.
* @param stateToRandomize the joint state that is to be randomized.
* @param min the minimum value for the generated random value.
* @param max the maximum value for the generated random value.
* @param joint the joints to set the state of. Modified.
*/
public static void nextState(Random random, JointStateType stateToRandomize, double min, double max, OneDoFJointBasics joint)
{
 switch (stateToRandomize)
 {
 case CONFIGURATION:
   joint.setQ(EuclidCoreRandomTools.nextDouble(random, min, max));
   break;
 case VELOCITY:
   joint.setQd(EuclidCoreRandomTools.nextDouble(random, min, max));
   break;
 case ACCELERATION:
   joint.setQdd(EuclidCoreRandomTools.nextDouble(random, min, max));
   break;
 case EFFORT:
   joint.setTau(EuclidCoreRandomTools.nextDouble(random, min, max));
   break;
 default:
   throw new RuntimeException("Unhandled state selection: " + stateToRandomize);
 }
}

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

private void getOneDoFJointStateFromSCS()
{
  for (OneDoFJointBasics joint : allOneDoFJoints)
  {
   PinJoint scsJoint = (PinJoint) robot.getJoint(joint.getName());
   joint.setQ(scsJoint.getQ());
   joint.setQd(scsJoint.getQD());
   double tau = scsJoint.getTau();
   if (scsJoint.tauDamping != null)
     tau += scsJoint.tauDamping.getValue();
   if (scsJoint.tauJointLimit != null)
     tau += scsJoint.tauJointLimit.getValue();
   if (scsJoint.tauVelocityLimit != null)
     tau += scsJoint.tauVelocityLimit.getValue();
   joint.setTau(tau);
  }
}

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

private void updatePDController(OneDoFJointBasics oneDoFJoint, double timeInCurrentState)
{
 PDController pdController = pdControllers.get(oneDoFJoint);
 double desiredPosition = desiredPositions.get(oneDoFJoint).getDoubleValue();
 double desiredVelocity = 0.0;
 double tau = pdController.compute(oneDoFJoint.getQ(), desiredPosition, oneDoFJoint.getQd(), desiredVelocity);
 DiagnosticsWhenHangingHelper diagnosticsWhenHangingHelper = helpers.get(oneDoFJoint);
 if (diagnosticsWhenHangingHelper != null)
 {
   tau = diagnosticsWhenHangingHelper.getTorqueToApply(tau, estimateTorqueOffset.getBooleanValue(), maximumTorqueOffset.getDoubleValue());
   if (hasReachedMaximumTorqueOffset.getBooleanValue()
      && Math.abs(diagnosticsWhenHangingHelper.getTorqueOffset()) == maximumTorqueOffset.getDoubleValue())
   {
    PrintTools.warn(this, "Reached maximum torque for at least one joint.");
    hasReachedMaximumTorqueOffset.set(true);
   }
 }
 double ditherTorque = ditherAmplitude.getDoubleValue() * Math.sin(2.0 * Math.PI * ditherFrequency.getDoubleValue() * timeInCurrentState);
 oneDoFJoint.setTau(tau + ditherTorque);
}

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

public static ChecksumUpdater newJointChecksumUpdater(GenericCRC32 checksum, OneDoFJointBasics joint)
{
 return () -> {
   checksum.update(joint.getQ());
   checksum.update(joint.getQd());
   checksum.update(joint.getQdd());
 };
}

代码示例来源: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-avatar-interfaces-test

public void setFullRobotModelStateRandomly(Random random, double maxJointVelocity, double maxRootJointLinearAndAngularVelocity)
{
 FloatingJointBasics rootJoint = fullRobotModel.getRootJoint();
 ReferenceFrame elevatorFrame = rootJoint.getFrameBeforeJoint();
 ReferenceFrame bodyFrame = rootJoint.getFrameAfterJoint();
 Twist bodyTwist = new Twist(bodyFrame, elevatorFrame, bodyFrame, RandomGeometry.nextVector3D(random, maxRootJointLinearAndAngularVelocity),
    RandomGeometry.nextVector3D(random, maxRootJointLinearAndAngularVelocity));
 rootJoint.setJointTwist(bodyTwist);
 rootJoint.setJointPosition(RandomGeometry.nextVector3D(random));
 double yaw = RandomNumbers.nextDouble(random, Math.PI / 20.0);
 double pitch = RandomNumbers.nextDouble(random, Math.PI / 20.0);
 double roll = RandomNumbers.nextDouble(random, Math.PI / 20.0);
 rootJoint.getJointPose().setOrientationYawPitchRoll(yaw, pitch, roll);
 ArrayList<OneDoFJointBasics> oneDoFJoints = new ArrayList<OneDoFJointBasics>();
 fullRobotModel.getOneDoFJoints(oneDoFJoints);
 for (OneDoFJointBasics oneDoFJoint : oneDoFJoints)
 {
   double lowerLimit = oneDoFJoint.getJointLimitLower();
   double upperLimit = oneDoFJoint.getJointLimitUpper();
   double delta = upperLimit - lowerLimit;
   lowerLimit = lowerLimit + 0.05 * delta;
   upperLimit = upperLimit - 0.05 * delta;
   oneDoFJoint.setQ(RandomNumbers.nextDouble(random, lowerLimit, upperLimit));
   oneDoFJoint.setQd(RandomNumbers.nextDouble(random, maxJointVelocity));
 }
}

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

private void setBestJointAngles()
{
 for (int i = 0; i < oneDoFJoints.length; i++)
 {
   oneDoFJoints[i].setQ(bestJointAngles[i]);
 }
}

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

@Override
public double getJointPositionProcessedOutput(OneDoFJointBasics oneDoFJoint)
{
 return oneDoFJoint.getQ();
}

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

jointsInFuture.get(jointIndex).setQ(q);
jointsInFuture.get(0).updateFramesRecursively();
 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

@Before
public void setUp()
{
 joint.setQ(0.0);
 joint.setQd(0.0);
 joint.setQdd(0.0);
 trajectoryTimeProvider = new ConstantDoubleProvider(timeRequired);
}

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

public JointLimit(OneDoFJointBasics oneDoFJoint)
{
 upperPositionLimit = oneDoFJoint.getJointLimitUpper();     
 lowerPositionLimit = oneDoFJoint.getJointLimitLower(); 
 rangeOfMotion = upperPositionLimit - lowerPositionLimit;
 
 softLimitPercentageOfFullRangeOfMotion = 1.0;
 softUpperPositionLimit = upperPositionLimit; 
 softLowerPositionLimit = lowerPositionLimit; 
 softLimitRangeOfMotion = softUpperPositionLimit - softLowerPositionLimit;
 
 velocityLimit = Double.POSITIVE_INFINITY;          
 torqueLimit = Double.POSITIVE_INFINITY;   
}

相关文章