本文整理了Java中us.ihmc.simulationconstructionset.SimulationConstructionSet.getTime()
方法的一些代码示例,展示了SimulationConstructionSet.getTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimulationConstructionSet.getTime()
方法的具体详情如下:
包路径:us.ihmc.simulationconstructionset.SimulationConstructionSet
类名称:SimulationConstructionSet
方法名:getTime
暂无
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
public void simulateAndBlock(int simulationTicks) throws SimulationExceededMaximumTimeException, ControllerFailureException
{
double startTime = scs.getTime();
scs.simulate(simulationTicks);
BlockingSimulationRunner.waitForSimulationToFinish(scs, 600, true);
if (hasControllerFailed.get())
{
throw new ControllerFailureException("Controller failure has been detected.");
}
double endTime = scs.getTime();
double elapsedTime = endTime - startTime;
if (Math.abs(elapsedTime - scs.getDT() * simulationTicks) > 0.01)
{
throw new SimulationExceededMaximumTimeException("Elapsed time didn't equal requested. Sim probably crashed");
}
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools-test
public boolean verifySimRunsSameWayTwice(double maxPercentDifference, ArrayList<String> stringsToIgnore) throws BlockingSimulationRunner.SimulationExceededMaximumTimeException, ControllerFailureException
{
boolean firstSimDone, secondSimDone;
firstSimDone = secondSimDone = false;
initiateMotion(scsOne, standingTimeDuration, blockingSimulationRunnerOne);
initiateMotion(scsTwo, standingTimeDuration, blockingSimulationRunnerTwo);
while(!firstSimDone && !secondSimDone)
{
blockingSimulationRunnerOne.simulateAndBlock(1.0);
blockingSimulationRunnerTwo.simulateAndBlock(1.0);
if (!compareSCSInstances(maxPercentDifference, stringsToIgnore))
{
System.err.println("Mismatch in sim states!");
return false;
}
firstSimDone = (scsOne.getTime() - standingTimeDuration) >= walkingTimeDuration;
secondSimDone = (scsTwo.getTime() - standingTimeDuration) >= walkingTimeDuration;
if(firstSimDone != secondSimDone)
{
System.err.println("Sims did not finish at the same time!");
return false;
}
}
return true;
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
@Override
public void run()
{
while (running())
{
try
{
Thread.sleep(900);
pelvisTransform.set(pelvis.getJointTransform3D());
long timeStamp = Conversions.secondsToNanoseconds(simulationConstructionSet.getTime());
Thread.sleep((int) (random.nextDouble() * 200));
TimeStampedTransform3D timeStampedTransform = new TimeStampedTransform3D(pelvisTransform, timeStamp);
StampedPosePacket posePacket = HumanoidMessageTools.createStampedPosePacket("/pelvis", timeStampedTransform, 1.0);
externalPelvisPoseCreator.setNewestPose(posePacket);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
};
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
public void addPlanarRegionsList(PlanarRegionsList planarRegions, AppearanceDefinition... appearances)
{
Graphics3DObject graphics3DObject = new Graphics3DObject();
Graphics3DObjectTools.addPlanarRegionsList(graphics3DObject, planarRegions, appearances);
scs.addStaticLinkGraphics(graphics3DObject);
scs.setTime(scs.getTime() + 1.0);
scs.tickAndUpdate();
}
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
public void addPolygon(RigidBodyTransform transform, ConvexPolygon2D polygon, AppearanceDefinition appearance)
{
Graphics3DObject graphics3DObject = new Graphics3DObject();
graphics3DObject.transform(transform);
graphics3DObject.addPolygon(polygon, appearance);
scs.addStaticLinkGraphics(graphics3DObject);
scs.setTime(scs.getTime() + 1.0);
scs.tickAndUpdate();
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
private boolean yawBigInDoubleSupport(ExternalPelvisPoseCreator externalPelvisPoseCreator) throws SimulationExceededMaximumTimeException
{
long timeStamp = Conversions.secondsToNanoseconds(simulationConstructionSet.getTime());
RigidBodyTransform yawTransform = TransformTools.createTransformFromTranslationAndEulerAngles(1, 1, 0.8, 0, 0, Math.PI);
TimeStampedTransform3D timeStampedTransform = new TimeStampedTransform3D(yawTransform, timeStamp);
StampedPosePacket posePacket = HumanoidMessageTools.createStampedPosePacket("/pelvis", timeStampedTransform, 1.0);
drcSimulationTestHelper.simulateAndBlockAndCatchExceptions(1);
externalPelvisPoseCreator.setNewestPose(posePacket);
return drcSimulationTestHelper.simulateAndBlockAndCatchExceptions(10);
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
private void update(double dt)
{
solePose.setFromReferenceFrame(swingOverPlanarRegionsTrajectoryExpander.getSolePoseReferenceFrame());
for (SwingOverPlanarRegionsTrajectoryCollisionType swingOverPlanarRegionsTrajectoryCollisionType : SwingOverPlanarRegionsTrajectoryCollisionType.values())
{
intersectionMap.get(swingOverPlanarRegionsTrajectoryCollisionType)
.setPosition(swingOverPlanarRegionsTrajectoryExpander.getClosestPolygonPoint(swingOverPlanarRegionsTrajectoryCollisionType));
}
double sphereRadius = swingOverPlanarRegionsTrajectoryExpander.getSphereRadius();
collisionSphere.setRadii(new Vector3D(sphereRadius, sphereRadius, sphereRadius));
collisionSphere.update();
scs.tickAndUpdate(scs.getTime() + dt);
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
private boolean yawBigInSingleSupport(ExternalPelvisPoseCreator externalPelvisPoseCreator) throws SimulationExceededMaximumTimeException
{
// FootPosePacket packet = new FootPosePacket(RobotSide.RIGHT, new Point3D(1, 1, 0.3), new Quat4d(), 0.6);
// drcSimulationTestHelper.send(packet);
drcSimulationTestHelper.simulateAndBlockAndCatchExceptions(2);
long timeStamp = Conversions.secondsToNanoseconds(simulationConstructionSet.getTime());
RigidBodyTransform yawTransform = TransformTools.createTransformFromTranslationAndEulerAngles(1, 1, 0.8, 0, 0, Math.PI);
TimeStampedTransform3D timeStampedTransform = new TimeStampedTransform3D(yawTransform, timeStamp);
StampedPosePacket posePacket = HumanoidMessageTools.createStampedPosePacket("/pelvis", timeStampedTransform, 1.0);
drcSimulationTestHelper.simulateAndBlockAndCatchExceptions(1);
externalPelvisPoseCreator.setNewestPose(posePacket);
return drcSimulationTestHelper.simulateAndBlockAndCatchExceptions(10);
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
private boolean localizeOutsideOfFootInSingleSupport(ExternalPelvisPoseCreator externalPelvisPoseCreator) throws SimulationExceededMaximumTimeException
{
// FootPosePacket packet = new FootPosePacket(RobotSide.RIGHT, new Point3D(1.0, 1.0, 0.3), new Quat4d(), 0.6);
// drcSimulationTestHelper.send(packet);
drcSimulationTestHelper.simulateAndBlockAndCatchExceptions(2.0);
long timeStamp = Conversions.secondsToNanoseconds(simulationConstructionSet.getTime());
RigidBodyTransform outsideOfFootTransform = TransformTools.createTransformFromTranslationAndEulerAngles(1.5, 1.0, 0.8, 0.0, 0.0, 0.0);
TimeStampedTransform3D timeStampedTransform = new TimeStampedTransform3D(outsideOfFootTransform, timeStamp);
StampedPosePacket posePacket = HumanoidMessageTools.createStampedPosePacket("/pelvis", timeStampedTransform, 1.0);
drcSimulationTestHelper.simulateAndBlockAndCatchExceptions(1.0);
externalPelvisPoseCreator.setNewestPose(posePacket);
return drcSimulationTestHelper.simulateAndBlockAndCatchExceptions(10.0);
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
@Override
public void doControl()
{
refFrame.update();
sixDofPelvisJoint.setJointConfiguration(robotPose);
pelvisPoseHistoryCorrection.doControl(Conversions.secondsToNanoseconds(scs.getTime()));
floatingJoint.setQuaternion(sixDofPelvisJoint.getJointPose().getOrientation());
floatingJoint.setPosition(sixDofPelvisJoint.getJointPose().getPosition());
}
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
while (scs.getTime() - standingTimeDuration < walkingTimeDuration)
fail("Math.abs(comError.getDoubleValue()) > 0.09: " + comError.getDoubleValue() + " at t = " + scs.getTime());
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
long timeStamp = Conversions.secondsToNanoseconds(simulationConstructionSet.getTime());
TimeStampedTransform3D timeStampedTransform = new TimeStampedTransform3D(targets[i], timeStamp);
StampedPosePacket posePacket = HumanoidMessageTools.createStampedPosePacket("/pelvis", timeStampedTransform, 1.0);
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
target.setXYZ(targetTranslation.getX(), targetTranslation.getY(), targetTranslation.getZ());
long timeStamp = Conversions.secondsToNanoseconds(simulationConstructionSet.getTime());
TimeStampedTransform3D timeStampedTransform = new TimeStampedTransform3D(targets[i], timeStamp);
StampedPosePacket posePacket = HumanoidMessageTools.createStampedPosePacket("/pelvis", timeStampedTransform, 1.0);
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
while (scs.getTime() - standingTimeDuration < defaultWalkingTimeDuration)
fail("Math.abs(comError.getDoubleValue()) > 0.06: " + comError.getDoubleValue() + " at t = " + scs.getTime());
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
long timeStamp = Conversions.secondsToNanoseconds(simulationConstructionSet.getTime());
TimeStampedTransform3D timeStampedTransform = new TimeStampedTransform3D(targets[i], timeStamp);
StampedPosePacket posePacket = HumanoidMessageTools.createStampedPosePacket("/pelvis", timeStampedTransform, 1.0);
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
error.set(targetTranslation.getX(), targetTranslation.getY(), targetTranslation.getZ(), targetYaw);
long timeStamp = Conversions.secondsToNanoseconds(simulationConstructionSet.getTime());
TimeStampedTransform3D timeStampedTransform = new TimeStampedTransform3D(targets[i], timeStamp);
StampedPosePacket posePacket = HumanoidMessageTools.createStampedPosePacket("/pelvis", timeStampedTransform, 1.0);
代码示例来源:origin: us.ihmc/simulation-construction-set-test
@Test// timeout = 30000
public void testTimingMethods() throws AWTException
{
scs.setDT(simulateDT, recordFrequency);
double simulateDTFromSCS = scs.getDT();
assertEquals(simulateDT, simulateDTFromSCS, epsilon);
scs.setRecordDT(recordDT);
double recordFreqFromSCS = scs.getRecordFreq();
assertEquals(recordFreq, recordFreqFromSCS, epsilon);
scs.setPlaybackRealTimeRate(realTimeRate);
double realTimeRateFromSCS = scs.getPlaybackRealTimeRate();
assertEquals(realTimeRate, realTimeRateFromSCS, epsilon);
scs.setPlaybackDesiredFrameRate(frameRate);
double frameRateFromSCS = scs.getPlaybackFrameRate();
assertEquals(recomputedSecondsPerFrameRate, frameRateFromSCS, epsilon);
int ticksPerCycle = computeTicksPerPlayCycle(simulateDT, recordFreq, realTimeRate, frameRate);
double ticksPerCycleFromSCS = scs.getTicksPerPlayCycle();
assertEquals(ticksPerCycle, ticksPerCycleFromSCS, epsilon);
scs.setTime(Math.PI);
double timeFromSCS = scs.getTime();
assertEquals(Math.PI, timeFromSCS, epsilon);
}
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
if (scs.getTime() > standingTimeDuration + maximumWalkTime)
done = true;
if (q_x.getDoubleValue() > rampEndX)
代码示例来源:origin: us.ihmc/ihmc-avatar-interfaces-test
if (scs.getTime() > standingTimeDuration + maximumWalkTime)
done = true;
if (q_x.getDoubleValue() > rampEndX)
代码示例来源:origin: us.ihmc/ihmc-footstep-planning-test
scs.setTime(scs.getTime() + 1.0);
scs.tickAndUpdate();
内容来源于网络,如有侵权,请联系作者删除!