Skip to content
Snippets Groups Projects
Commit bd8b65dd authored by codyt's avatar codyt
Browse files

Tackett Assignment 3 Upload

parent 21b21d16
No related branches found
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ import edu.nps.moves.disutil.DisTime; ...@@ -15,7 +15,7 @@ import edu.nps.moves.disutil.DisTime;
*/ */
public class Tackett_Assignment3_OpenDisEspduSender public class Tackett_Assignment3_OpenDisEspduSender
{ {
public static final int NUMBER_TO_SEND = 5000; public static final int NUMBER_TO_SEND = 10;
public enum NetworkMode{UNICAST, MULTICAST, BROADCAST}; public enum NetworkMode{UNICAST, MULTICAST, BROADCAST};
...@@ -25,6 +25,8 @@ public class Tackett_Assignment3_OpenDisEspduSender ...@@ -25,6 +25,8 @@ public class Tackett_Assignment3_OpenDisEspduSender
/** Default port we send on */ /** Default port we send on */
public static final int DIS_DESTINATION_PORT = 3000; public static final int DIS_DESTINATION_PORT = 3000;
private static final ArrayList <Float[]> track_coordinates = new ArrayList<>();
/** Possible system properties, passed in via -Dattr=val /** Possible system properties, passed in via -Dattr=val
* networkMode: unicast, broadcast, multicast * networkMode: unicast, broadcast, multicast
* destinationIp: where to send the packet. If in multicast mode, this can be multicast. * destinationIp: where to send the packet. If in multicast mode, this can be multicast.
...@@ -42,9 +44,9 @@ public static void main(String args[]) ...@@ -42,9 +44,9 @@ public static void main(String args[])
DisTime disTime = DisTime.getInstance(); // TODO explain DisTime disTime = DisTime.getInstance(); // TODO explain
int alternator = -1; int alternator = -1;
// ICBM coordinates for my office // Lat/Lon coordinates
double lat = 36.595517; // double lat = 36.616366;
double lon = -121.877000; // double lon = -121.913065;
// Default settings. These are used if no system properties are set. // Default settings. These are used if no system properties are set.
// If system properties are passed in, these are over ridden. // If system properties are passed in, these are over ridden.
...@@ -149,9 +151,51 @@ public static void main(String args[]) ...@@ -149,9 +151,51 @@ public static void main(String args[])
// Loop through sending N ESPDUs // Loop through sending N ESPDUs
try try
{ {
System.out.println("Sending " + NUMBER_TO_SEND + " ESPDU packets to " + destinationIp.toString()); Float[] TrackCoor1 = new Float [2];
TrackCoor1[0] = 36.585657f;
TrackCoor1[1] = -121.879920f;
track_coordinates.add(TrackCoor1);
Float[] TrackCoor2 = new Float [2];
TrackCoor2[0] = 36.584853f;
TrackCoor2[1] = -121.880024f;
track_coordinates.add(TrackCoor2);
Float[] TrackCoor3 = new Float [2];
TrackCoor3[0] = 36.583500f;
TrackCoor3[1] = -121.879615f;
track_coordinates.add(TrackCoor3);
Float[] TrackCoor4 = new Float [2];
TrackCoor4[0] = 36.586307f;
TrackCoor4[1] = -121.874582f;
track_coordinates.add(TrackCoor4);
Float[] TrackCoor5 = new Float [2];
TrackCoor5[0] = 36.588670f;
TrackCoor5[1] = -121.877928f;
track_coordinates.add(TrackCoor5);
Float[] TrackCoor6 = new Float [2];
TrackCoor6[0] = 36.591124f;
TrackCoor6[1] = -121.880074f;
track_coordinates.add(TrackCoor6);
Float[] TrackCoor7 = new Float [2];
TrackCoor7[0] = 36.592827f;
TrackCoor7[1] = -121.877149f;
track_coordinates.add(TrackCoor7);
Float[] TrackCoor8 = new Float [2];
TrackCoor8[0] = 36.594051f;
TrackCoor8[1] = -121.877452f;
track_coordinates.add(TrackCoor8);
Float[] TrackCoor9 = new Float [2];
TrackCoor9[0] = 36.594245f;
TrackCoor9[1] = -121.876477f;
track_coordinates.add(TrackCoor9);
Float[] TrackCoor10 = new Float [2];
TrackCoor10[0] = 36.595230f;
TrackCoor10[1] = -121.877537f;
track_coordinates.add(TrackCoor10);
//System.out.println("Sending " + NUMBER_TO_SEND + " ESPDU packets to " + destinationIp.toString());
for(int idx = 0; idx < NUMBER_TO_SEND; idx++) for(int idx = 0; idx < NUMBER_TO_SEND; idx++)
{ {
System.out.println("Sending espdu packet" + idx + " to " + destinationIp.toString());
// DIS time is a pain in the ass. DIS time units are 2^31-1 units per // DIS time is a pain in the ass. DIS time units are 2^31-1 units per
// hour, and time is set to DIS time units from the top of the hour. // hour, and time is set to DIS time units from the top of the hour.
// This means that if you start sending just before the top of the hour // This means that if you start sending just before the top of the hour
...@@ -197,9 +241,12 @@ public static void main(String args[]) ...@@ -197,9 +241,12 @@ public static void main(String args[])
//lon = lon + (double)((double)idx / 100000.0); //lon = lon + (double)((double)idx / 100000.0);
//System.out.println("lla=" + lat + "," + lon + ", 0.0"); //System.out.println("lla=" + lat + "," + lon + ", 0.0");
double direction = Math.pow((double)(-1.0), (double)(idx)); // double direction = Math.pow((double)(-1.0), (double)(idx));
lon = lon + (direction * 0.00006); // lon = lon + (direction * 0.00006);
System.out.println(lon); // System.out.println(lon);
Float lat = track_coordinates.get(idx)[0];
Float lon = track_coordinates.get(idx)[1];
double disCoordinates[] = CoordinateConversions.getXYZfromLatLonDegrees(lat, lon, 1.0); double disCoordinates[] = CoordinateConversions.getXYZfromLatLonDegrees(lat, lon, 1.0);
Vector3Double location = espdu.getEntityLocation(); Vector3Double location = espdu.getEntityLocation();
...@@ -243,8 +290,8 @@ public static void main(String args[]) ...@@ -243,8 +290,8 @@ public static void main(String args[])
DatagramPacket packet = new DatagramPacket(data, data.length, broadcast, 3000); DatagramPacket packet = new DatagramPacket(data, data.length, broadcast, 3000);
socket.send(packet); socket.send(packet);
// TODO experiment with these! 8) // TODO experiment with these! 8)
packet = new DatagramPacket(fireArray, fireArray.length, broadcast, 3000); // alternate // packet = new DatagramPacket(fireArray, fireArray.length, broadcast, 3000); // alternate
socket.send(packet); // socket.send(packet);
} }
// Send every 1 sec. Otherwise this will be all over in a fraction of a second. // Send every 1 sec. Otherwise this will be all over in a fraction of a second.
......
...@@ -7,18 +7,22 @@ ...@@ -7,18 +7,22 @@
1. [x] Otherwise just inspect files of interest from 1. [x] Otherwise just inspect files of interest from
[edu.nps.moves.examples](https://github.com/open-dis/open-dis-java/tree/master/src/main/java/edu/nps/moves/examples) [edu.nps.moves.examples](https://github.com/open-dis/open-dis-java/tree/master/src/main/java/edu/nps/moves/examples)
1. [ ] Copy README.md and create YournameREADME.md documentation file... 1. [x] Copy README.md and create YournameREADME.md documentation file...
1. [ ] Plan a track of interest, described in YournameREADME.md documentation file... 1. [x] Plan a track of interest, described in YournameREADME.md documentation file...
1. [ ] Copy, then Refactor/Rename example file OpenDisEspduSender.java or OpenDisPduSender.java as YourNameSomething.java Track of interest is a sample from a run route I did recently.
1. [ ] Modify your example file to produce track PDUs (and be cool) 1. [x] Copy, then Refactor/Rename example file OpenDisEspduSender.java or OpenDisPduSender.java as YourNameSomething.java
1. [ ] Generate PDUs... 1. [x] Modify your example file to produce track PDUs (and be cool)
1. [ ] Test PDU reading using Wireshark... 1. [x] Generate PDUs...
1. [ ] Record PDU file using X3D-Edit... 1. [x] Test PDU reading using Wireshark...
1. [ ] Playback PDU file using X3D-Edit... IP address for my machine is 172.20.148.166
1. [x] Record PDU file using X3D-Edit...
1. [x] Playback PDU file using X3D-Edit...
File added
File added
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