本文整理了Java中us.ihmc.robotics.alphaToAlpha.YoVariableRampUpAndDownAlphaToAlpha
类的一些代码示例,展示了YoVariableRampUpAndDownAlphaToAlpha
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YoVariableRampUpAndDownAlphaToAlpha
类的具体详情如下:
包路径:us.ihmc.robotics.alphaToAlpha.YoVariableRampUpAndDownAlphaToAlpha
类名称:YoVariableRampUpAndDownAlphaToAlpha
[英]Created by Peter on 9/9/2016.
[中]彼得于2016年9月9日创作。
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
YoVariableRampUpAndDownAlphaToAlpha yoVariableRampUpAndDownAlphaToAlpha = new YoVariableRampUpAndDownAlphaToAlpha(startOfRampUp, endOfRamp, startOfRampDown, endOfRampDown);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.1);
assertEquals(value, 0.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.2);
assertEquals(value, 0.5, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.3);
assertEquals(value, 1.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.4);
assertEquals(value, 1.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.5);
assertEquals(value, 1.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.6);
assertEquals(value, 0.5, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.7);
assertEquals(value, 0.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.8);
assertEquals(value, 0.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.1);
assertEquals(value, 0.0, EPSILON);
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
@Override public double getAlphaPrime(double alpha)
{
if (!areVariablesInIncreasingOrderAndLessThanOne())
return 0.0;
if (alpha < startOfRampUp.getDoubleValue())
{
return 0.0;
}
else if(alpha < endOfRamp.getDoubleValue())
{
return (alpha - startOfRampUp.getDoubleValue())/(endOfRamp.getDoubleValue() - startOfRampUp.getDoubleValue());
}
else if(alpha < startOfRampDown.getDoubleValue())
{
return 1.0;
}
else if(alpha < endOfRampDown.getDoubleValue())
{
return 1.0 - (alpha - startOfRampDown.getDoubleValue())/(endOfRampDown.getDoubleValue() - startOfRampDown.getDoubleValue());
}
else
return 0.0;
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
private void testRangeOfAlphas(double expectedValue, YoVariableRampUpAndDownAlphaToAlpha yoVariableRampUpAndDownAlphaToAlpha)
{
for(double alpha = -1.0; alpha < 2.0 ; alpha = alpha + 0.001)
{
double value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(alpha);
assertEquals(value, expectedValue, EPSILON);
}
}
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testInvalidYoVariables()
{
YoVariableRegistry registry = new YoVariableRegistry("dummy");
YoDouble startOfRampUp = new YoDouble("startOfRampUp", registry);
YoDouble endOfRamp = new YoDouble("endOfRamp", registry);
YoDouble startOfRampDown = new YoDouble("startOfRampDown", registry);
YoDouble endOfRampDown = new YoDouble("endOfRampDown", registry);
YoVariableRampUpAndDownAlphaToAlpha yoVariableRampUpAndDownAlphaToAlpha = new YoVariableRampUpAndDownAlphaToAlpha(startOfRampUp, endOfRamp, startOfRampDown, endOfRampDown);
testRangeOfAlphas(0.0, yoVariableRampUpAndDownAlphaToAlpha);
startOfRampUp.set(0.1);
testRangeOfAlphas(0.0, yoVariableRampUpAndDownAlphaToAlpha);
endOfRamp.set(0.2);
testRangeOfAlphas(0.0, yoVariableRampUpAndDownAlphaToAlpha);
startOfRampDown.set(0.3);
testRangeOfAlphas(0.0, yoVariableRampUpAndDownAlphaToAlpha);
endOfRampDown.set(1.0);
testRangeOfAlphas(0.0, yoVariableRampUpAndDownAlphaToAlpha);
endOfRampDown.set(0.9);
startOfRampDown.set(0.95);
testRangeOfAlphas(0.0, yoVariableRampUpAndDownAlphaToAlpha);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
@Override public double getAlphaPrime(double alpha)
{
if (!areVariablesInIncreasingOrderAndLessThanOne())
return 0.0;
if (alpha < startOfRampUp.getDoubleValue())
{
return 0.0;
}
else if(alpha < endOfRamp.getDoubleValue())
{
return (alpha - startOfRampUp.getDoubleValue())/(endOfRamp.getDoubleValue() - startOfRampUp.getDoubleValue());
}
else if(alpha < startOfRampDown.getDoubleValue())
{
return 1.0;
}
else if(alpha < endOfRampDown.getDoubleValue())
{
return 1.0 - (alpha - startOfRampDown.getDoubleValue())/(endOfRampDown.getDoubleValue() - startOfRampDown.getDoubleValue());
}
else
return 0.0;
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
YoVariableRampUpAndDownAlphaToAlpha yoVariableRampUpAndDownAlphaToAlpha = new YoVariableRampUpAndDownAlphaToAlpha(startOfRampUp, endOfRamp, startOfRampDown, endOfRampDown);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.1);
assertEquals(value, 0.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.15);
assertEquals(value, 0.25, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.25);
assertEquals(value, 0.75, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.3);
assertEquals(value, 1.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.4);
assertEquals(value, 1.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.5);
assertEquals(value, 1.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.55);
assertEquals(value, 0.75, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.65);
assertEquals(value, 0.25, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.7);
assertEquals(value, 0.0, EPSILON);
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testSmallDifferences()
{
YoVariableRegistry registry = new YoVariableRegistry("dummy");
YoDouble startOfRampUp = new YoDouble("startOfRampUp", registry);
YoDouble endOfRamp = new YoDouble("endOfRamp", registry);
YoDouble startOfRampDown = new YoDouble("startOfRampDown", registry);
YoDouble endOfRampDown = new YoDouble("endOfRampDown", registry);
YoVariableRampUpAndDownAlphaToAlpha yoVariableRampUpAndDownAlphaToAlpha = new YoVariableRampUpAndDownAlphaToAlpha(startOfRampUp, endOfRamp, startOfRampDown, endOfRampDown);
startOfRampUp.set(0.1);
endOfRamp.set(startOfRampUp.getDoubleValue() + EPSILON);
startOfRampDown.set(0.5);
endOfRampDown.set(startOfRampDown.getDoubleValue() + EPSILON);
double value;
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.1);
assertEquals(value, 0.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.1 + EPSILON/2.0);
assertEquals(value, 0.5, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.3);
assertEquals(value, 1.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.5);
assertEquals(value, 1.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.5 + EPSILON/2.0);
assertEquals(value, 0.5, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.7);
assertEquals(value, 0.0, EPSILON);
value = yoVariableRampUpAndDownAlphaToAlpha.getAlphaPrime(0.8);
assertEquals(value, 0.0, EPSILON);
}
内容来源于网络,如有侵权,请联系作者删除!