diff --git a/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java b/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java index d3bf1309811f6f366142355b2b42202d1413a448..afae3822486a00eef58f610f70fa5e0f2d10b58f 100644 --- a/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java +++ b/examples/src/OpenDis7Examples/ExampleTrackInterpolation.java @@ -35,7 +35,7 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram private byte[] globalByteBufferForX3dInterpolators = null; // -------------------- End Variables for X3D autogenerated code - ArrayList<Pdu> pduList = new ArrayList<>(); + ArrayList<Pdu> pduSentList = new ArrayList<>(); /** * This runSimulationLoops() method is a programmer-modifiable method for @@ -73,9 +73,9 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram espdu_1.setEntityID(entityID_1); espdu_1.setForceId(ForceID.FRIENDLY); espdu_1.setEntityType(new _001Poseidon()); // note import statement above - espdu_1.clearMarking(); espdu_1.setMarking("track path"); - espdu_1.getMarkingString(); // trace +// espdu_1.clearMarking(); // test +// espdu_1.getMarkingString(); // trace // espdu_1.setEntityLocation(new Vector3Double().setX(0).setY(0).setZ(0)); // long form espdu_1.setEntityLocation(0, 0, 0); // utility method @@ -84,7 +84,7 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram PduTrack pduTrack_1 = new PduTrack(); pduTrack_1.setDescriptor("testing 123"); - pduTrack_1.setWaypointInterval(1.0f); // overrides timestamps + pduTrack_1.setDefaultWaypointInterval(1.0f); // overrides timestamps pduTrack_1.addPdu(espdu_1); // initial location // OK send initial PDUs prior to loop @@ -92,10 +92,11 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram System.out.println("sending PDUs for simulation step " + simulationLoopCount + ", monitor loopback to confirm sent"); sendSinglePdu(espdu_1); // sendCommentPdu(currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3); - pduList.add(espdu_1); + pduSentList.add(espdu_1); reportPdu(simulationLoopCount, espdu_1.getEntityLocation(), directionEntity_1); // TODO simulation management PDUs for startup, planning to design special class support + // =================================================================================================== // loop the simulation while allowed, programmer can set additional conditions to break out and finish while (simulationLoopCount < SIMULATION_MAX_LOOP_COUNT) // are we done yet? { @@ -130,7 +131,7 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram narrativeMessage3 = ""; // intentionally blank for testing // your loop termination condition goes here - if (simulationLoopCount >= 40) // for example + if (simulationLoopCount > 40) // for example { simulationComplete = true; } @@ -153,22 +154,26 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram sendCommentPdu(currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3); if (pduRecorder.hasVerboseOutput()) System.out.println(TRACE_PREFIX + "PDUs successfully sent for this loop"); - pduList.add(espdu_1); + pduSentList.add(espdu_1); pduTrack_1.addPdu(espdu_1); Vector3Double location = espdu_1.getEntityLocation(); reportPdu(simulationLoopCount, location, directionEntity_1); // =============================== - // loop now finished, check whether to terminate if simulation complete, otherwise continue + // current loop now finished, check whether to terminate if simulation complete, otherwise continue if (simulationComplete || (simulationLoopCount > 10000)) // for example; including fail-safe condition is good { System.out.println(TRACE_PREFIX + "loop termination condition met, simulationComplete=" + simulationComplete); // ", final loopCount=" + loopCount + break; } } // end of simulation loop - System.out.println(TRACE_PREFIX + "all PDUs successfully sent for this loop, pduList.size()=" + pduList.size()); - - pduTrack_1 = pduTrack_1.sortPdus().createRawWaypoints(); + // =================================================================================================== + System.out.println(TRACE_PREFIX + "all PDUs successfully sent for this loop (pduSentList.size()=" + pduSentList.size() + " total)"); + + // track analysis + System.out.println(TRACE_PREFIX + "pduTrack_1 initialLocation=" + pduTrack_1.getInitialLocation() + ", latestLocation=" + pduTrack_1.getLatestLocation()); + pduTrack_1.sortPdus() + .createRawWaypoints(); System.out.println("pduTrack_1 getEspduCount()=" + pduTrack_1.getEspduCount()); System.out.println("pduTrack_1 duration = " + pduTrack_1.getTrackDurationSeconds() + " seconds = " +