本文整理了Java中us.ihmc.robotics.math.trajectories.YoMinimumJerkTrajectory.setParams()
方法的一些代码示例,展示了YoMinimumJerkTrajectory.setParams()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YoMinimumJerkTrajectory.setParams()
方法的具体详情如下:
包路径:us.ihmc.robotics.math.trajectories.YoMinimumJerkTrajectory
类名称:YoMinimumJerkTrajectory
方法名:setParams
暂无
代码示例来源:origin: us.ihmc/IHMCWholeBodyController
private void setTransitionSplines()
{
for (int i = 0; i < oneDoFJoints.size(); i++)
{
OneDoFJoint oneDoFJoint = oneDoFJoints.get(i);
YoMinimumJerkTrajectory spline = transitionSplines.get(oneDoFJoint);
double initialPosition = initialPositions.get(oneDoFJoint).getDoubleValue();
double finalPositon = finalPositions.get(oneDoFJoint).getDoubleValue();
spline.setParams(initialPosition, 0.0, 0.0, finalPositon, 0.0, 0.0, 0.0, splineDuration.getDoubleValue());
}
}
代码示例来源:origin: us.ihmc/ihmc-whole-body-controller
private void setTransitionSplines()
{
for (int i = 0; i < oneDoFJoints.size(); i++)
{
OneDoFJointBasics oneDoFJoint = oneDoFJoints.get(i);
YoMinimumJerkTrajectory spline = transitionSplines.get(oneDoFJoint);
double initialPosition = initialPositions.get(oneDoFJoint).getDoubleValue();
double finalPositon = finalPositions.get(oneDoFJoint).getDoubleValue();
spline.setParams(initialPosition, 0.0, 0.0, finalPositon, 0.0, 0.0, 0.0, splineDuration.getDoubleValue());
}
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testZeroLength()
{
YoVariableRegistry registry = new YoVariableRegistry("TestMinimumJerkTrajectory");
YoMinimumJerkTrajectory minimumJerkTrajectory = new YoMinimumJerkTrajectory("tester", registry);
double t = 0.5e-7;
double[] vals = new double[3];
minimumJerkTrajectory.setParams(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0);
minimumJerkTrajectory.computeTrajectoryDoubles(t, vals);
if (Double.isNaN(vals[0]) || Double.isNaN(vals[1]) || Double.isNaN(vals[2]))
{
throw new RuntimeException("TestMinimumJerkTrajectory.testZeroLength: failed on zero displacement");
}
minimumJerkTrajectory.setParams(0.0, 0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0);
minimumJerkTrajectory.computeTrajectoryDoubles(t, vals);
if (Double.isNaN(vals[0]) || Double.isNaN(vals[1]) || Double.isNaN(vals[2]))
{
throw new RuntimeException("TestMinimumJerkTrajectory.testZeroLength: failed on zero time difference");
}
minimumJerkTrajectory.setParams(0.0, 0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.5);
double Tf = minimumJerkTrajectory.timeExtension(t, 0.0, 0.0, true);
System.out.println("TestMinimumJerkTrajectory.testZeroLength: Extending with maximums at 0.0: Tf = " + Tf);
System.out.flush();
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@ContinuousIntegrationTest(estimatedDuration = 0.1)
@Test(timeout = 30000)
public void testTimeExtensionRuntime()
{
YoVariableRegistry registry = new YoVariableRegistry("TestMinimumJerkTrajectory");
YoMinimumJerkTrajectory minimumJerkTrajectory = new YoMinimumJerkTrajectory("tester", registry);
long starttime, endtime;
double t = 0.0;
double maxV = 10;
double maxA = 10;
int runs = 10000;
starttime = System.nanoTime();
Random random = new Random(107L);
for (int i = 0; i < runs * 6; i++)
{
minimumJerkTrajectory.setParams(0.0, 0.0, 0.0, random.nextDouble() * 0.5 + 0.75, 0.0, 0.0, 0.0, 0.5);
minimumJerkTrajectory.timeExtension(t, maxV, maxA, true);
}
endtime = System.nanoTime();
double runtime = (endtime - starttime) / runs * 1.0e-6;
System.out.println("TestMinimumJerkTrajectory.testTimeExtensionRuntime: Execution Time = " + (runtime) + "ms per 6 calls");
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testBadInitialParams()
{
YoVariableRegistry registry = new YoVariableRegistry("TestMinimumJerkTrajectory");
YoMinimumJerkTrajectory minimumJerkTrajectory = new YoMinimumJerkTrajectory("tester", registry);
double maxV = 10;
double maxA = 50;
minimumJerkTrajectory.setParams(0.0, maxV * 1.1, 0.0, 1.0, 0.0, 0.0, 0.0, 0.05);
double newTime = minimumJerkTrajectory.timeExtension(1e-7, maxV, maxA, true);
if (newTime > 100000)
{
throw new RuntimeException("TestMinimumJerkTrajectory.testBadInitialParams: cannot find suitable time");
}
else
{
System.out.println("TestMinimumJerkTrajectory.testBadInitialParams: Tf = " + newTime);
}
}
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@ContinuousIntegrationTest(estimatedDuration = 0.0)
@Test(timeout = 30000)
public void testFindMaxVals()
{
YoVariableRegistry registry = new YoVariableRegistry("TestMinimumJerkTrajectory");
YoMinimumJerkTrajectory minimumJerkTrajectory = new YoMinimumJerkTrajectory("tester", registry);
double t = 0.0;
double[] maximums = new double[2];
double maxVexpected = 5.625;
double maxAexpected = 34.641;
double percent = 0.01;
minimumJerkTrajectory.setParams(0.0, 0.0, 0.0, 1.5, 0.0, 0.0, 0.0, 0.5);
minimumJerkTrajectory.findMaxVelocityAndAccel(t, maximums);
if (!MathTools.percentEquals(maxVexpected, maximums[0], percent))
{
throw new RuntimeException("TestMinimumJerkTrajectory.testFindMaxVals: Max velocity is wrong: expected=" + maxVexpected + ", actual=" + maximums[0]);
}
if (!MathTools.percentEquals(maxAexpected, maximums[1], percent))
{
throw new RuntimeException("TestMinimumJerkTrajectory.testFindMaxVals: Max accel is wrong: expected=" + maxAexpected + ", actual=" + maximums[1]);
}
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
@Ignore
@ContinuousIntegrationTest(estimatedDuration = 0.1, categoriesOverride = IntegrationCategory.EXCLUDE)
@Test(timeout=300000)
public void testTimeExtension()
{
YoVariableRegistry registry = new YoVariableRegistry("TestMinimumJerkTrajectory");
YoMinimumJerkTrajectory minimumJerkTrajectory = new YoMinimumJerkTrajectory("tester", registry);
double t = 0.0;
double maxV = 5.0;
double maxA = 10.0;
double expectedTime = 0.930605;
minimumJerkTrajectory.setParams(0.0, 0.0, 0.0, 1.5, 0.0, 0.0, 0.0, 0.0);
double newTime = minimumJerkTrajectory.timeExtension(t, maxV, maxA, true);
if (!MathTools.percentEquals(expectedTime, newTime, 0.01))
{
throw new RuntimeException("TestMinimumJerkTrajectory.testTimeExtension: Returned desired time= " + newTime + ", expected= " + expectedTime);
}
}
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
public void initialize(FramePoint initialPosition, FrameVector initialVelocity, FrameVector initialAcceleration, FramePoint finalDesiredPosition,
FrameVector finalDesiredVelocity)
{
timeIntoStep.set(0.0);
this.stepTime.set(stepTimeProvider.getValue());
if (stepTime.getDoubleValue() < 1e-10)
{
stepTime.set(1e-10);
}
minimumJerkTrajectory.setParams(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, stepTime.getDoubleValue());
double middleOfTrajectoryParameter = 0.5;
parabolicTrajectoryGenerator.initialize(initialPosition, finalDesiredPosition, groundClearance.getDoubleValue(), middleOfTrajectoryParameter);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
@Override
public void initialize(FramePoint3D initialPosition, FrameVector3D initialVelocity, FrameVector3D initialAcceleration, FramePoint3D finalDesiredPosition,
FrameVector3D finalDesiredVelocity)
{
timeIntoStep.set(0.0);
this.stepTime.set(stepTimeProvider.getValue());
if (stepTime.getDoubleValue() < 1e-10)
{
stepTime.set(1e-10);
}
minimumJerkTrajectory.setParams(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, stepTime.getDoubleValue());
double middleOfTrajectoryParameter = 0.5;
parabolicTrajectoryGenerator.initialize(initialPosition, finalDesiredPosition, groundClearance.getDoubleValue(), middleOfTrajectoryParameter);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public void initialize()
{
timeIntoStep.set(0.0);
this.stepTime.set(stepTimeProvider.getValue());
if (stepTime.getDoubleValue() < 1e-10)
{
stepTime.set(1e-10);
}
minimumJerkTrajectory.setParams(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, stepTime.getDoubleValue());
double middleOfTrajectoryParameter = 0.5;
FramePoint3D initialPosition = new FramePoint3D(ReferenceFrame.getWorldFrame());
initialPositionProvider.getPosition(initialPosition);
FramePoint3D finalPosition = new FramePoint3D(ReferenceFrame.getWorldFrame());
finalPositionProvider.getPosition(finalPosition);
initialPosition.changeFrame(parabolicTrajectoryGenerator.getReferenceFrame());
finalPosition.changeFrame(parabolicTrajectoryGenerator.getReferenceFrame());
double maxAnkleHeight = Math.max(initialPosition.getZ(), finalPosition.getZ());
double apexHeight = maxAnkleHeight + groundClearance.getDoubleValue();
parabolicTrajectoryGenerator.initialize(initialPosition, finalPosition, apexHeight, middleOfTrajectoryParameter);
}
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
public void initialize()
{
timeIntoStep.set(0.0);
this.stepTime.set(stepTimeProvider.getValue());
if (stepTime.getDoubleValue() < 1e-10)
{
stepTime.set(1e-10);
}
minimumJerkTrajectory.setParams(0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, stepTime.getDoubleValue());
double middleOfTrajectoryParameter = 0.5;
FramePoint initialPosition = new FramePoint(ReferenceFrame.getWorldFrame());
initialPositionProvider.getPosition(initialPosition);
FramePoint finalPosition = new FramePoint(ReferenceFrame.getWorldFrame());
finalPositionProvider.getPosition(finalPosition);
initialPosition.changeFrame(parabolicTrajectoryGenerator.getReferenceFrame());
finalPosition.changeFrame(parabolicTrajectoryGenerator.getReferenceFrame());
double maxAnkleHeight = Math.max(initialPosition.getZ(), finalPosition.getZ());
double apexHeight = maxAnkleHeight + groundClearance.getDoubleValue();
parabolicTrajectoryGenerator.initialize(initialPosition, finalPosition, apexHeight, middleOfTrajectoryParameter);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
double tf = t0 + randomBetween(0.1, 10.0);
minimumJerkTrajectory.setParams(x0, v0, a0, xf, vf, af, t0, tf);
内容来源于网络,如有侵权,请联系作者删除!