本文整理了Java中us.ihmc.robotics.math.trajectories.YoMinimumJerkTrajectory
类的一些代码示例,展示了YoMinimumJerkTrajectory
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YoMinimumJerkTrajectory
类的具体详情如下:
包路径:us.ihmc.robotics.math.trajectories.YoMinimumJerkTrajectory
类名称:YoMinimumJerkTrajectory
暂无
代码示例来源: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/IHMCRoboticsToolkit
@Deprecated
public void updateToFinalPosition(double currentTime, double Xf)
{
computeTrajectory(currentTime);
this.T0.set(currentTime);
this.Xf.set(Xf);
this.X0.set(getPosition());
this.V0.set(getVelocity());
this.A0.set(getAcceleration());
this.computeConstants();
}
代码示例来源:origin: us.ihmc/ihmc-whole-body-controller
private boolean splinesAreFinished(double timeInCurrentState)
{
for (int i = 0; i < oneDoFJoints.size(); i++)
{
YoMinimumJerkTrajectory spline = transitionSplines.get(oneDoFJoints.get(i));
if (timeInCurrentState < spline.getFinalTime())
return false;
}
return true;
}
代码示例来源: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
public void getAcceleration(FrameVector3D accelerationToPack)
{
double parameter = minimumJerkTrajectory.getPosition();
parameter = MathTools.clamp(parameter, 0.0, 1.0);
parabolicTrajectoryGenerator.getAcceleration(accelerationToPack);
accelerationToPack.scale(minimumJerkTrajectory.getVelocity() * minimumJerkTrajectory.getVelocity());
parabolicTrajectoryGenerator.getVelocity(tempVector, parameter);
tempVector.scale(minimumJerkTrajectory.getAcceleration());
accelerationToPack.add(tempVector);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit-test
YoMinimumJerkTrajectory minimumJerkTrajectory = new YoMinimumJerkTrajectory("test", registry);
double tf = t0 + randomBetween(0.1, 10.0);
minimumJerkTrajectory.setParams(x0, v0, a0, xf, vf, af, t0, tf);
minimumJerkTrajectory.computeTrajectory(randomBetween(-10.0, 10.0));
minimumJerkTrajectory.computeTrajectory(t0);
assertEquals(x0, minimumJerkTrajectory.getPosition(), epsilon);
assertEquals(v0, minimumJerkTrajectory.getVelocity(), epsilon);
assertEquals(a0, minimumJerkTrajectory.getAcceleration(), epsilon);
minimumJerkTrajectory.computeTrajectory(tf);
assertEquals(xf, minimumJerkTrajectory.getPosition(), epsilon);
assertEquals(vf, minimumJerkTrajectory.getVelocity(), epsilon);
assertEquals(af, minimumJerkTrajectory.getAcceleration(), epsilon);
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public void getVelocity(FrameVector3D velocityToPack)
{
double parameter = minimumJerkTrajectory.getPosition();
parameter = MathTools.clamp(parameter, 0.0, 1.0);
parabolicTrajectoryGenerator.getVelocity(tempVector, parameter);
velocityToPack.setIncludingFrame(tempVector);
velocityToPack.scale(minimumJerkTrajectory.getVelocity());
}
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
public void computeTrajectoryDoubles(double t, double[] vals)
{
computeTrajectory(t);
vals[0] = this.pos;
vals[1] = this.vel;
vals[2] = this.acc;
}
代码示例来源: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/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/IHMCWholeBodyController
private void createTransitionSplines()
{
for (int i = 0; i < oneDoFJoints.size(); i++)
{
OneDoFJoint oneDoFJoint = oneDoFJoints.get(i);
YoMinimumJerkTrajectory spline = new YoMinimumJerkTrajectory(oneDoFJoint.getName() + "TransitionSpline", registry);
transitionSplines.put(oneDoFJoint, spline);
// spline.setParams(initialPositions.get(oneDoFJoint), 0.0, 0.0, finalPositions.get(oneDoFJoint), 0.0, 0.0, 0.0, 3.0);
DoubleYoVariable desiredPosition = new DoubleYoVariable("q_d_" + oneDoFJoint.getName(), registry);
DoubleYoVariable desiredVelocity = new DoubleYoVariable("qd_d_" + oneDoFJoint.getName(), registry);
desiredPositions.put(oneDoFJoint, desiredPosition);
desiredVelocities.put(oneDoFJoint, desiredVelocity);
}
}
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
public void getPosition(FramePoint positionToPack)
{
double parameter = minimumJerkTrajectory.getPosition();
parameter = MathTools.clipToMinMax(parameter, 0.0, 1.0);
parabolicTrajectoryGenerator.getPosition(positionToPack, parameter);
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
@Deprecated
public void setFinalPosition(double Xf)
{
this.Xf.set(Xf);
this.computeConstants();
}
}
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
findMaxVelocityAndAccel(currentTime, maxs);
findMaxVelocityAndAccel(currentTime, maxs);
findMaxVelocityAndAccel(currentTime, maxs);
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
public void getAcceleration(FrameVector accelerationToPack)
{
double parameter = minimumJerkTrajectory.getPosition();
parameter = MathTools.clipToMinMax(parameter, 0.0, 1.0);
parabolicTrajectoryGenerator.getAcceleration(accelerationToPack);
accelerationToPack.scale(minimumJerkTrajectory.getVelocity() * minimumJerkTrajectory.getVelocity());
parabolicTrajectoryGenerator.getVelocity(tempVector, parameter);
tempVector.scale(minimumJerkTrajectory.getAcceleration());
accelerationToPack.add(tempVector);
}
代码示例来源:origin: us.ihmc/IHMCRoboticsToolkit
public void getVelocity(FrameVector velocityToPack)
{
double parameter = minimumJerkTrajectory.getPosition();
parameter = MathTools.clipToMinMax(parameter, 0.0, 1.0);
parabolicTrajectoryGenerator.getVelocity(tempVector, parameter);
velocityToPack.setIncludingFrame(tempVector);
velocityToPack.scale(minimumJerkTrajectory.getVelocity());
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public void computeTrajectoryDoubles(double t, double[] vals)
{
computeTrajectory(t);
vals[0] = this.pos;
vals[1] = this.vel;
vals[2] = this.acc;
}
代码示例来源: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-whole-body-controller
private void createTransitionSplines()
{
for (int i = 0; i < oneDoFJoints.size(); i++)
{
OneDoFJointBasics oneDoFJoint = oneDoFJoints.get(i);
YoMinimumJerkTrajectory spline = new YoMinimumJerkTrajectory(oneDoFJoint.getName() + "TransitionSpline", registry);
transitionSplines.put(oneDoFJoint, spline);
// spline.setParams(initialPositions.get(oneDoFJoint), 0.0, 0.0, finalPositions.get(oneDoFJoint), 0.0, 0.0, 0.0, 3.0);
YoDouble desiredPosition = new YoDouble("q_d_" + oneDoFJoint.getName(), registry);
YoDouble desiredVelocity = new YoDouble("qd_d_" + oneDoFJoint.getName(), registry);
desiredPositions.put(oneDoFJoint, desiredPosition);
desiredVelocities.put(oneDoFJoint, desiredVelocity);
}
}
代码示例来源:origin: us.ihmc/ihmc-robotics-toolkit
public void getPosition(FramePoint3D positionToPack)
{
double parameter = minimumJerkTrajectory.getPosition();
parameter = MathTools.clamp(parameter, 0.0, 1.0);
parabolicTrajectoryGenerator.getPosition(positionToPack, parameter);
}
内容来源于网络,如有侵权,请联系作者删除!