本文整理了Java中us.ihmc.mecano.multiBodySystem.interfaces.OneDoFJointBasics.setTau()
方法的一些代码示例,展示了OneDoFJointBasics.setTau()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OneDoFJointBasics.setTau()
方法的具体详情如下:
包路径:us.ihmc.mecano.multiBodySystem.interfaces.OneDoFJointBasics
类名称:OneDoFJointBasics
方法名:setTau
[英]Sets the current force/torque for this joint.
[中]设置此关节的当前力/扭矩。
代码示例来源:origin: us.ihmc/mecano
/** {@inheritDoc} */
@Override
default void setJointTauToZero()
{
setTau(0.0);
}
代码示例来源:origin: us.ihmc/ihmc-whole-body-controller
private void zeroAllTorques()
{
for (int i = 0; i < oneDoFJoints.size(); i++)
{
oneDoFJoints.get(i).setTau(0);
}
}
代码示例来源:origin: us.ihmc/mecano
/**
* Sets this joint force/torque from the other joint.
*
* @param other the other to get the force/torque from. Not modified.
*/
default void setJointWrench(OneDoFJointReadOnly other)
{
setTau(other.getTau());
}
代码示例来源:origin: us.ihmc/mecano
/** {@inheritDoc} */
@Override
default int setJointTau(int rowStart, DenseMatrix64F matrix)
{
setTau(matrix.get(rowStart, 0));
return rowStart + getDegreesOfFreedom();
}
代码示例来源: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-whole-body-controller
private void updatePDController(OneDoFJointBasics oneDoFJoint, double timeInCurrentState)
{
PDController pdController = pdControllers.get(oneDoFJoint);
YoMinimumJerkTrajectory transitionSpline = transitionSplines.get(oneDoFJoint);
double desiredPosition = transitionSpline.getPosition();
double desiredVelocity = transitionSpline.getVelocity();
// Setting the desired positions via SCS ui.
if (manualMode.getBooleanValue())
{
desiredPosition = desiredPositions.get(oneDoFJoint).getDoubleValue();
desiredVelocity = 0.0;
}
else
{
desiredPositions.get(oneDoFJoint).set(desiredPosition);
}
desiredVelocities.get(oneDoFJoint).set(desiredVelocity);
double tau = pdController.compute(oneDoFJoint.getQ(), desiredPosition, oneDoFJoint.getQd(), desiredVelocity);
tau = tau * diagnosticsPDMasterGain.getDoubleValue();
DiagnosticsWhenHangingHelper diagnosticsWhenHangingHelper = helpers.get(oneDoFJoint);
if (diagnosticsWhenHangingHelper != null)
{
tau = diagnosticsWhenHangingHelper.getTorqueToApply(tau, adaptTorqueOffset.getBooleanValue(), maximumTorqueOffset.getDoubleValue());
}
double ditherTorque = ditherAmplitude.getDoubleValue() * Math.sin(2.0 * Math.PI * ditherFrequency.getDoubleValue() * timeInCurrentState);
oneDoFJoint.setTau(tau + ditherTorque);
}
代码示例来源:origin: us.ihmc/ihmc-simulation-toolkit
private void readAndUpdateOneDoFJointPositionsVelocitiesAndAccelerations()
{
for (int i = 0; i < revoluteJoints.size(); i++)
{
ImmutablePair<OneDegreeOfFreedomJoint, OneDoFJointBasics> jointPair = revoluteJoints.get(i);
OneDegreeOfFreedomJoint pinJoint = jointPair.getLeft();
OneDoFJointBasics revoluteJoint = jointPair.getRight();
if (pinJoint == null) continue;
revoluteJoint.setQ(pinJoint.getQYoVariable().getDoubleValue());
revoluteJoint.setQd(pinJoint.getQDYoVariable().getDoubleValue());
revoluteJoint.setQdd(pinJoint.getQDDYoVariable().getDoubleValue());
revoluteJoint.setTau(pinJoint.getTau());
}
}
代码示例来源: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-common-walking-control-modules-test
double tau = jointTorques.get(i, 0);
yoJointTorques.get(joint).set(tau);
joint.setTau(tau);
代码示例来源:origin: us.ihmc/ihmc-common-walking-control-modules-test
double tau = jointTorques.get(i, 0);
yoJointTorques.get(joint).set(tau);
joint.setTau(tau);
代码示例来源: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/mecano
break;
case EFFORT:
joint.setTau(EuclidCoreRandomTools.nextDouble(random, joint.getEffortLimitLower(), joint.getEffortLimitUpper()));
break;
default:
代码示例来源: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/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());
}
代码示例来源: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());
double pdOutput = pdController.compute(q.getDoubleValue(), q_d.getDoubleValue(), qd.getDoubleValue(), qd_d.getDoubleValue());
jointCommand_pd.set(pdOutput);
tau_d.set(valkyrieRosControlSliderBoard.masterScaleFactor.getDoubleValue() * (jointCommand_pd.getDoubleValue() + jointCommand_function.getDoubleValue()) + tau_offset
.getDoubleValue());
handle.setDesiredEffort(tau_d.getDoubleValue());
}
}
内容来源于网络,如有侵权,请联系作者删除!