private boolean didSimulationsGetToEndTime(double simulationTime, ArrayList<SimulationConstructionSet> simulationConstructionSets) { double endTime0 = simulationConstructionSets.get(0).getRobots()[0].getTime(); double endTime1 = simulationConstructionSets.get(0).getRobots()[0].getTime(); double errorTime0 = Math.abs(simulationTime - endTime0); double errorTime1 = Math.abs(simulationTime - endTime1); // System.out.println("errorTime0 = " + errorTime0); // System.out.println("errorTime1 = " + errorTime1); if (errorTime0 > 1e-3) return false; if (errorTime1 > 1e-3) return false; return true; }
@Override public void doControl() { super.doControl(); if (robot.getTime() > lastTimeChanged + timeBetweenChanges) { lastTimeChanged = robot.getTime(); nonRegisteredVariable = nonRegisteredVariable + 1.0; // System.out.println("Changed nonRegisteredVariable to " + nonRegisteredVariable + ", time = " + robot.getTime()); } if (robot.getTime() > lastTimeUpdated.getDoubleValue() + timeBetweenUpdates) { lastTimeUpdated.set(robot.getTime()); variableTwo.set(nonRegisteredVariable); variableThree.set(3.0); variableFour.set(nonRegisteredVariable * 2); // System.out.println("Changed a bunch of variables. time = " + robot.getTime()); } } }
private double getExpectedFinalTime(SimulationConstructionSet scs) { double initialTime = scs.getRobots()[0].getTime(); double recordFreq = scs.getRecordFreq(); double DT = scs.getDT(); return initialTime + recordFreq * DT; }
@Override public void processData() { double time = robot.getTime(); variableOne.set(time); variableTwo.set(1.1); variableThree.set(9.23); } };
@Override public void doControl() { super.doControl(); if (robot.getTime() >= 1.0) { nonRegisteredVariable = nonRegisteredVariable + 1.0; variableTwo.set(nonRegisteredVariable); variableFour.set(nonRegisteredVariable * 2.0); } } }
BlockingSimulationRunner.waitForSimulationToFinish(scss.get(0), maximumClockRunTimeInSeconds, true); assertEquals("indices not the same", scss.get(0).getIndex(), scss.get(1).getIndex()); assertEquals("times not the same", scss.get(0).getRobots()[0].getTime(), scss.get(1).getRobots()[0].getTime(), epsilon); boolean result = comparer.compare(scss.get(0), scss.get(1));
@Override public void doControl() { if(firstTick) { robot.computeCOMMomentum(rootJoint, new Point3D(), initialLinearMomentum, initialAngularMomentum); firstTick = false; } Vector3D currentLinearMomentum = new Vector3D(); Vector3D currentAngularMomentum = new Vector3D(); robot.computeCOMMomentum(rootJoint, new Point3D(), currentLinearMomentum, currentAngularMomentum); EuclidCoreTestTools.assertTuple3DEquals( "Linear momentum hasn't been conserved. p(t=0)=" + EuclidCoreIOTools.getTuple3DString("%6.8f", initialLinearMomentum) + ", p(t=" + robot .getTime() + ")=" + EuclidCoreIOTools.getTuple3DString("%6.8f", currentLinearMomentum), initialLinearMomentum, currentLinearMomentum, epsilon); EuclidCoreTestTools.assertTuple3DEquals( "Angular momentum hasn't been conserved. L(t=0)=" + EuclidCoreIOTools.getTuple3DString("%6.8f", initialAngularMomentum) + ", L(t=" + robot .getTime() + ")=" + EuclidCoreIOTools.getTuple3DString("%6.8f", currentAngularMomentum), initialAngularMomentum, currentAngularMomentum, epsilon); } }
public void visualizeFootstep(ContactablePlaneBody bipedFoot, Footstep footstep) { bagOfSingleFootstepVisualizers.visualizeFootstep(footstep, bipedFoot); nullRobot.setTime(nullRobot.getTime() + scs.getDT()); FramePoint3D solePositon = new FramePoint3D(footstep.getSoleReferenceFrame()); solePositon.changeFrame(worldFrame); updateFocus(solePositon); scs.setCameraFix(focusX, focusY, 0.0); scs.setCameraPosition(focusX, focusY - 1.5, 6.0); scs.tickAndUpdate(); }
public void visualizeFootstep(ContactablePlaneBody bipedFoot, Footstep footstep) { bagOfSingleFootstepVisualizers.visualizeFootstep(footstep, bipedFoot); nullRobot.setTime(nullRobot.getTime() + scs.getDT()); FramePoint solePositon = new FramePoint(footstep.getSoleReferenceFrame()); solePositon.changeFrame(worldFrame); updateFocus(solePositon); scs.setCameraFix(focusX, focusY, 0.0); scs.setCameraPosition(focusX, focusY - 1.5, 6.0); scs.tickAndUpdate(); }
assertEquals(numberOfTicksBeforeUpdatingGraphs2, numberOfTicksBeforeUpdatingGraphsFromSCS2); double initialTime = scs.getRobots()[0].getTime(); double DT = scs.getDT(); callSCSMethodSimulateOneTimeStep(scs); double finalTime = scs.getRobots()[0].getTime(); assertEquals(initialTime + DT, finalTime, epsilon); double finalTime2 = scs.getRobots()[0].getTime(); assertEquals(expectedFinalTime2, finalTime2, epsilon); double finalTime3 = scs.getRobots()[0].getTime(); assertEquals(expectedFinalTime3, finalTime3, epsilon);
assertEquals(variableOne.getDoubleValue(), robot.getTime(), 1e-7); assertEquals(variableTwo.getDoubleValue(), 1.1, 1e-7); assertEquals(variableThree.getDoubleValue(), 9.23, 1e-7);
robot.setTime(robot.getTime() + 0.001);