Skip to content
Snippets Groups Projects
Commit 7cb85aa1 authored by Royer, Nicholas (Capt)'s avatar Royer, Nicholas (Capt)
Browse files
parents 81abf346 2ba51d9a
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ package OpenDis7Examples; ...@@ -7,6 +7,7 @@ package OpenDis7Examples;
import edu.nps.moves.dis7.entities.swe.platform.surface._001Poseidon; import edu.nps.moves.dis7.entities.swe.platform.surface._001Poseidon;
import edu.nps.moves.dis7.entities.swe.platform.surface._002Triton; import edu.nps.moves.dis7.entities.swe.platform.surface._002Triton;
import edu.nps.moves.dis7.entities.usa.platform.air.CH53ESuperStallion;
import edu.nps.moves.dis7.enumerations.*; import edu.nps.moves.dis7.enumerations.*;
import edu.nps.moves.dis7.pdus.*; import edu.nps.moves.dis7.pdus.*;
import edu.nps.moves.dis7.utilities.DisChannel; import edu.nps.moves.dis7.utilities.DisChannel;
...@@ -125,7 +126,8 @@ public class ExampleSimulationProgram ...@@ -125,7 +126,8 @@ public class ExampleSimulationProgram
// Your model setup: define participants. who's who in this zoo? // Your model setup: define participants. who's who in this zoo?
// Assuming you keep track of entity objects... here is some support for for Entity 1. // Assuming you keep track of entity objects... here is some support for for Entity 1.
// PDU objects are already created, now set their values. // PDU objects are already declared and instances created, so now set their values.
// TODO better javadoc needed for site, application, entity determining the identity triplet
entityID_1.setSiteID(1).setApplicationID(2).setEntityID(3); // made-up example ID; entityID_1.setSiteID(1).setApplicationID(2).setEntityID(3); // made-up example ID;
disChannel.addEntity(entityID_1); disChannel.addEntity(entityID_1);
...@@ -135,16 +137,18 @@ public class ExampleSimulationProgram ...@@ -135,16 +137,18 @@ public class ExampleSimulationProgram
entityStatePdu_1.setEntityID(entityID_1); entityStatePdu_1.setEntityID(entityID_1);
entityStatePdu_1.setForceId(ForceID.FRIENDLY); entityStatePdu_1.setForceId(ForceID.FRIENDLY);
entityStatePdu_1.setEntityType(new _001Poseidon()); // note import statement above // entityStatePdu_1.setEntityType(new _001Poseidon()); // note import statement above
entityStatePdu_1.setMarking("Entity #1"); // entityStatePdu_1.setMarking("Entity #1");
entityStatePdu_1.getMarkingString(); // check left justified... entityStatePdu_1.setEntityType(new CH53ESuperStallion()); // note import statement at top
entityStatePdu_1.setMarking("Entity #53");
entityStatePdu_1.getMarkingString(); // use Netbeans Debug breakpoint here to check left justified...
entityStatePdu_2.setEntityID(entityID_2); entityStatePdu_2.setEntityID(entityID_2);
entityStatePdu_2.setForceId(ForceID.OPPOSING); entityStatePdu_2.setForceId(ForceID.OPPOSING);
entityStatePdu_2.setEntityType(new _002Triton()); // note import statement above entityStatePdu_2.setEntityType(new _002Triton()); // note import statement above
entityStatePdu_2.setMarking("Entity #2"); entityStatePdu_2.setMarking("Entity #2");
// TODO how should we customize this munition? what is it for your simulation? // TODO how should we customize this munition? what is it for your simulation? more is needed here...
munitionDescriptor1.setQuantity(1); munitionDescriptor1.setQuantity(1);
firePdu_1a.setDescriptor(munitionDescriptor1).setRange(1000.0f); firePdu_1a.setDescriptor(munitionDescriptor1).setRange(1000.0f);
} }
...@@ -243,11 +247,12 @@ public class ExampleSimulationProgram ...@@ -243,11 +247,12 @@ public class ExampleSimulationProgram
} // end of simulation loop } // end of simulation loop
// ===================================================================================================// =================================================================================================== // ===================================================================================================// ===================================================================================================
narrativeMessage2 = "runSimulation() completed successfully"; // all done narrativeMessage2 = "runSimulation() completed successfully"; // all done, so tell everyone else on the channel
// TODO better javadoc needs to be autogenerated for VariableRecordType enumerations
disChannel.sendCommentPdu(disChannel.narrativeCommentType, narrativeMessage1, narrativeMessage2, narrativeMessage3); disChannel.sendCommentPdu(disChannel.narrativeCommentType, narrativeMessage1, narrativeMessage2, narrativeMessage3);
System.out.println ("... [final=completion CommentPdu successfully sent for simulation]"); System.out.println ("... [final=completion CommentPdu successfully sent for simulation]");
disChannel.leave(); disChannel.leave(); // embedded SimulationManager is expected to send appropriate PDUs for entity, application shutdown
} }
catch (InterruptedException iex) // handle any exception that your code might choose to provoke! catch (InterruptedException iex) // handle any exception that your code might choose to provoke!
{ {
......
...@@ -31,8 +31,8 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram ...@@ -31,8 +31,8 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
{ {
// -------------------- Begin Variables for X3D autogenerated code // -------------------- Begin Variables for X3D autogenerated code
private X3dCreateInterpolators x3dInterpolators = new X3dCreateInterpolators(); private X3dCreateInterpolators x3dInterpolators = new X3dCreateInterpolators();
private X3dCreateLineSet x3dLineSet = new X3dCreateLineSet(); private X3dCreateLineSet x3dLineSet = new X3dCreateLineSet();
private byte[] globalByteBufferForX3dInterpolators = null; private byte[] globalByteBufferForX3dInterpolators = null;
// -------------------- End Variables for X3D autogenerated code // -------------------- End Variables for X3D autogenerated code
ArrayList<Pdu> pduSentList = new ArrayList<>(); ArrayList<Pdu> pduSentList = new ArrayList<>();
......
examples/src/OpenDis7Examples/ExampleTrackInterpolationFlowchart.png

249 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment