本文整理了Java中us.ihmc.yoVariables.variable.YoDouble
类的一些代码示例,展示了YoDouble
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YoDouble
类的具体详情如下:
包路径:us.ihmc.yoVariables.variable.YoDouble
类名称:YoDouble
[英]Double implementation of the YoVariable class.
All abstract functions of YoVariable will be implemented using double type for interpretation. Values will be interpreted, compared, and returned as doubles rather than other native types.
[中]YoVariable类的双重实现。
YoVariable的所有抽象函数都将使用双类型进行解释。值将被解释、比较和返回为双精度值,而不是其他本机类型。
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public void startTransition(double lengthOfTransitionTime)
{
transitionStartTime.set(time.getDoubleValue());
this.lengthOfTransitionTime = lengthOfTransitionTime;
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
protected AbstractPDController(String suffix, YoVariableRegistry registry)
{
positionError = new YoDouble("positionError_" + suffix, registry);
positionError.set(0.0);
rateError = new YoDouble("rateError_" + suffix, registry);
rateError.set(0.0);
actionP = new YoDouble("action_P_" + suffix, registry);
actionP.set(0.0);
actionD = new YoDouble("action_D_" + suffix, registry);
actionD.set(0.0);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public void update(double input)
{
if (!hasBeenInitialized.getBooleanValue())
initialize(input);
double positionError = input - this.getDoubleValue();
double acceleration = -velocityGain.getDoubleValue() * smoothedRate.getDoubleValue() + positionGain.getDoubleValue() * positionError;
acceleration = MathTools.clamp(acceleration, -maximumAcceleration.getDoubleValue(), maximumAcceleration.getDoubleValue());
smoothedAcceleration.set(acceleration);
smoothedRate.add(smoothedAcceleration.getDoubleValue() * dt);
smoothedRate.set(MathTools.clamp(smoothedRate.getDoubleValue(), maximumRate.getDoubleValue()));
this.add(smoothedRate.getDoubleValue() * dt);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public void enableMax()
{
max = new YoDouble(variable.getName() + "Max", registry);
max.set(Double.MIN_VALUE);
}
代码示例来源:origin: us.ihmc/ihmc-sensor-processing-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testDefaultMaximumDeflection4()
{
Random random = new Random(1561651L);
String name = "compensator";
YoVariableRegistry registry = new YoVariableRegistry("");
YoDouble stiffness = new YoDouble("stiffness", registry);
YoDouble maximumDeflection = new YoDouble("maximumDeflection", registry);
YoDouble rawJointPosition = new YoDouble("rawJointPosition", registry);
YoDouble jointTau = new YoDouble("jointTau", registry);
ElasticityCompensatorYoVariable elasticityCompensatorYoVariable = new ElasticityCompensatorYoVariable(name, stiffness, maximumDeflection, rawJointPosition, jointTau, registry);
maximumDeflection.set(0.1);
for (int i = 0; i < 10000; i++)
{
stiffness.set(RandomNumbers.nextDouble(random, 1.0, 100000.0));
rawJointPosition.set(RandomNumbers.nextDouble(random, 100.0));
jointTau.set(RandomNumbers.nextDouble(random, 10000.0));
elasticityCompensatorYoVariable.update();
double deflectedJointPosition = rawJointPosition.getDoubleValue() - MathTools.clamp(jointTau.getDoubleValue() / stiffness.getDoubleValue(), maximumDeflection.getValue());
assertEquals(deflectedJointPosition, elasticityCompensatorYoVariable.getDoubleValue(), EPSILON);
}
}
代码示例来源:origin: us.ihmc/ihmc-simulation-toolkit
@Override
public void doControl()
{
desiredLidarAngle.add(desiredLidarVelocity.getDoubleValue() * controlDT);
double lidarJointTau = lidarJointController.compute(lidarJoint.getQYoVariable().getDoubleValue(), desiredLidarAngle.getDoubleValue(), lidarJoint.getQDYoVariable()
.getDoubleValue(), desiredLidarVelocity.getDoubleValue(), controlDT) + lidarJoint.getDamping() * desiredLidarVelocity.getDoubleValue();
lidarJoint.setTau(lidarJointTau);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public DitherProducer(String namePrefix, YoVariableRegistry parentRegistry, double controlDT)
{
registry = new YoVariableRegistry(namePrefix);
desiredDitherFrequency = new YoDouble(namePrefix + "_dither_frequency_desired", registry);
desiredDitherFrequency.set(0.0);
desiredDitherFrequency.addVariableChangedListener(new VariableChangedListener()
{
@Override
public void notifyOfVariableChange(YoVariable<?> v)
{
checkFrequency();
}
});
ditherFrequency = new YoDouble(namePrefix + "_dither_frequency", registry);
ditherFrequency.set(0.0);
amplitude = new YoDouble(namePrefix + "_dither_amplitude", registry);
amplitude.set(0.0);
dither = new YoDouble(namePrefix + "_dither_output", registry);
dither.set(0.0);
maxFrequency = 1.0 / (2.0 * controlDT);
if (parentRegistry != null)
{
parentRegistry.addChild(registry);
}
}
代码示例来源:origin: us.ihmc/ihmc-graphics-description
@Override
public Artifact createArtifact()
{
MutableColor color3f = appearance.getColor();
YoDouble endPointX = new YoDouble(getName() + "ArtifactEndPointX", base.getYoX().getYoVariableRegistry());
YoDouble endPointY = new YoDouble(getName() + "ArtifactEndPointY", base.getYoY().getYoVariableRegistry());
base.getYoX().addVariableChangedListener(v -> endPointX.set(base.getX() + vector.getX()));
base.getYoY().addVariableChangedListener(v -> endPointY.set(base.getY() + vector.getY()));
vector.getYoX().addVariableChangedListener(v -> endPointX.set(base.getX() + vector.getX()));
vector.getYoY().addVariableChangedListener(v -> endPointY.set(base.getY() + vector.getY()));
return new YoArtifactLineSegment2d(getName(),
new YoFrameLineSegment2D(base.getYoX(), base.getYoY(), endPointX, endPointY, ReferenceFrame.getWorldFrame()),
color3f.get());
}
代码示例来源:origin: us.ihmc/ihmc-humanoid-behaviors
private void sendFootstepPlan()
{
FootstepPlanningToolboxOutputStatus plannerResult = this.plannerResult.getAndSet(null);
FootstepDataListMessage footstepDataListMessage = plannerResult.getFootstepDataList();
footstepDataListMessage.setDefaultSwingDuration(swingTime.getValue());
footstepDataListMessage.setDefaultTransferDuration(transferTime.getDoubleValue());
footstepDataListMessage.setDestination(PacketDestination.CONTROLLER.ordinal());
footstepPublisher.publish(footstepDataListMessage);
}
代码示例来源:origin: us.ihmc/ihmc-yovariables
@Override
public YoDouble duplicate(YoVariableRegistry newRegistry)
{
DoubleParameter newParameter = new DoubleParameter(getName(), getDescription(), newRegistry, initialValue, getManualScalingMin(), getManualScalingMax());
newParameter.value.set(value.getValue());
newParameter.loadStatus = getLoadStatus();
return newParameter.value;
}
}
代码示例来源:origin: us.ihmc/acsell
public AcsellActuatorCommand(String name, AcsellActuator actuator, YoVariableRegistry parentRegistry)
{
this.actuator = actuator;
this.currentLimit = actuator.getCurrentLimit();
this.registry = new YoVariableRegistry(name);
this.enabled = new YoBoolean(name + "Enabled", registry);
this.tauDesired = new YoDouble(name + "TauDesired", registry);
this.tauInertia = new YoDouble(name + "TauInertia", registry);
this.qddDesired = new YoDouble(name + "qdd_d", registry);
this.damping = new YoDouble(name + "Damping", registry);
//this.currentDesired = new YoDouble(name+"CurrentDesired", registry);
this.rawCurrentDesired = new YoDouble(name+"CurrentDesired", registry);
if(actuator==StepprActuator.LEFT_HIP_Z || actuator==StepprActuator.RIGHT_HIP_Z)
this.filteredCurrentDesired = new AlphaFilteredYoVariable(name+"CurrentDesired_filt", registry, 0.90, rawCurrentDesired);
else
this.filteredCurrentDesired = new AlphaFilteredYoVariable(name+"CurrentDesired_filt", registry, 0.0, rawCurrentDesired);
rawCurrentDesired.addVariableChangedListener(new VariableChangedListener()
{
@Override
public void notifyOfVariableChange(YoVariable<?> v)
{
if(v.getValueAsDouble()>currentLimit) v.setValueFromDouble(currentLimit);
if(v.getValueAsDouble()<-currentLimit) v.setValueFromDouble(-currentLimit);
}
});
parentRegistry.addChild(registry);
}
代码示例来源:origin: us.ihmc/acsell
joystickUpdater.addJoystickEventListener(new DoubleYoVariableJoystickEventListener(desiredVelX_Adjust, joystickUpdater.findComponent(Component.Identifier.Axis.Y),
-maxDesiredVelocityX_Adjust, maxDesiredVelocityX_Adjust, deadZone, false));
desiredVelX_Adjust.addVariableChangedListener(new VariableChangedListener()
desiredVelX_Setpoint.addVariableChangedListener(new VariableChangedListener()
desiredVelocityX.addVariableChangedListener(new VariableChangedListener()
desiredVelocityY.set(desiredVelocityY_Bias);
joystickUpdater.addJoystickEventListener(new DoubleYoVariableJoystickEventListener(desiredVelocityY, joystickUpdater.findComponent(Component.Identifier.Axis.X),
-0.1+desiredVelocityY_Bias, 0.1+desiredVelocityY_Bias, deadZone, false));
desiredHeadingDot.set(desiredHeadingDot_Bias);
joystickUpdater.addJoystickEventListener(new DoubleYoVariableJoystickEventListener(desiredHeadingDot, joystickUpdater.findComponent(Component.Identifier.Axis.RZ),
-0.1+desiredHeadingDot_Bias, 0.1+desiredHeadingDot_Bias, deadZone/2.0, true));
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public YoAverager(String prefix, YoVariableRegistry registry)
{
average = new YoDouble(prefix + "Average", registry);
nUpdates = new YoInteger(prefix + "AverageNUpdates", registry);
}
代码示例来源:origin: us.ihmc/ihmc-yovariables
public void add(double yaw, double pitch, double roll)
{
this.yaw.add(yaw);
this.pitch.add(pitch);
this.roll.add(roll);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public YoDoubleStatistics(YoDouble variable, YoVariableRegistry registry)
{
this.variable = variable;
this.registry = registry;
variable.addVariableChangedListener(this::update);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
@Override
public double getProportionalGain()
{
return proportionalGain.getValue();
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
@Override
public void compute(double time)
{
integratedPhaseAngle.add(2.0 * Math.PI * frequency.getValue() * controlDT);
double angle = integratedPhaseAngle.getValue();
double mult = 2.0 * Math.PI * frequency.getValue();
double alpha = 0.5 * Math.sin(angle) + 0.5;
double alphaDot = 0.5 * 2.0 * mult * Math.cos(angle);
double alphaDDot = -0.5 * 2.0 * 2.0 * mult * mult * Math.sin(angle);
limitedPointA.update();
limitedPointB.update();
position.interpolate(limitedPointA, limitedPointB, alpha);
linearVelocity.sub(limitedPointB, limitedPointA);
linearVelocity.scale(alphaDot);
linearAcceleration.sub(limitedPointB, limitedPointA);
linearAcceleration.scale(alphaDDot);
}
代码示例来源:origin: us.ihmc/ihmc-whole-body-controller
public Matrix3D createLinearAccelerationWeightMatrix()
{
Matrix3D weightMatrix = new Matrix3D();
xAccelerationWeights.addVariableChangedListener(new MatrixUpdater(0, 0, weightMatrix));
yAccelerationWeights.addVariableChangedListener(new MatrixUpdater(1, 1, weightMatrix));
zAccelerationWeight.addVariableChangedListener(new MatrixUpdater(2, 2, weightMatrix));
xAccelerationWeights.notifyVariableChangedListeners();
yAccelerationWeights.notifyVariableChangedListeners();
zAccelerationWeight.notifyVariableChangedListeners();
return weightMatrix;
}
代码示例来源:origin: us.ihmc/ihmc-sensor-processing-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testRandomMaximumDeflection4()
{
Random random = new Random(1561651L);
String name = "compensator";
YoVariableRegistry registry = new YoVariableRegistry("");
YoDouble stiffness = new YoDouble("stiffness", registry);
YoDouble maximumDeflection = new YoDouble("maximumDeflection", registry);
YoDouble rawJointPosition = new YoDouble("rawJointPosition", registry);
YoDouble jointTau = new YoDouble("jointTau", registry);
ElasticityCompensatorYoVariable elasticityCompensatorYoVariable = new ElasticityCompensatorYoVariable(name, stiffness, maximumDeflection, rawJointPosition, jointTau, registry);
maximumDeflection.set(0.1);
for (int i = 0; i < 10000; i++)
{
stiffness.set(RandomNumbers.nextDouble(random, 1.0, 100000.0));
rawJointPosition.set(RandomNumbers.nextDouble(random, 100.0));
jointTau.set(RandomNumbers.nextDouble(random, 10000.0));
maximumDeflection.set(RandomNumbers.nextDouble(random, 0.0, 10.0));
elasticityCompensatorYoVariable.update();
double deflectedJointPosition = rawJointPosition.getDoubleValue() - MathTools.clamp(jointTau.getDoubleValue() / stiffness.getDoubleValue(), maximumDeflection.getValue());
assertEquals(deflectedJointPosition, elasticityCompensatorYoVariable.getDoubleValue(), EPSILON);
}
}
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public void computeNextTick(FramePoint3D positionToPack, double deltaT)
{
timeIntoStep.add(deltaT);
compute(timeIntoStep.getDoubleValue());
getPosition(positionToPack);
}
内容来源于网络,如有侵权,请联系作者删除!