diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/EspduTerminalLog.txt b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/EspduTerminalLog.txt deleted file mode 100644 index 4dba55c8530bae5461a83ec84f731824570291d1..0000000000000000000000000000000000000000 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/EspduTerminalLog.txt +++ /dev/null @@ -1,136 +0,0 @@ -Invocation instructions: -1. run/debug EspduReceiver.java (since sender does not block, first be ready to listen) -2. run/debug EspduSender.java - -Program responses, sender and receiver: - -=================================================== -run: - - -DisExamplesOpenDis7.EspduSender started... -Sending 5 sets of packets: -=============== -Create new PDUs - latitude, longitude: [36.595517, -121.87693999999999] - coordinate conversion: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -Espdu #0 entityID=[1,2,3] -Sending espdu datagram packet to /127.255.255.255 -Sending fire datagram packet to /127.255.255.255 -Sending espdu datagram packet to /172.20.221.218 -Sending fire datagram packet to /172.20.221.218 -Sending espdu datagram packet to /10.0.0.255 -Sending fire datagram packet to /10.0.0.255 -=============== -Create new PDUs - latitude, longitude: [36.595517, -121.877] - coordinate conversion: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413] -Espdu #1 entityID=[1,2,3] -Sending espdu datagram packet to /127.255.255.255 -Sending fire datagram packet to /127.255.255.255 -Sending espdu datagram packet to /172.20.221.218 -Sending fire datagram packet to /172.20.221.218 -Sending espdu datagram packet to /10.0.0.255 -Sending fire datagram packet to /10.0.0.255 -=============== -Create new PDUs - latitude, longitude: [36.595517, -121.87693999999999] - coordinate conversion: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -Espdu #2 entityID=[1,2,3] -Sending espdu datagram packet to /127.255.255.255 -Sending fire datagram packet to /127.255.255.255 -Sending espdu datagram packet to /172.20.221.218 -Sending fire datagram packet to /172.20.221.218 -Sending espdu datagram packet to /10.0.0.255 -Sending fire datagram packet to /10.0.0.255 -=============== -Create new PDUs - latitude, longitude: [36.595517, -121.877] - coordinate conversion: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413] -Espdu #3 entityID=[1,2,3] -Sending espdu datagram packet to /127.255.255.255 -Sending fire datagram packet to /127.255.255.255 -Sending espdu datagram packet to /172.20.221.218 -Sending fire datagram packet to /172.20.221.218 -Sending espdu datagram packet to /10.0.0.255 -Sending fire datagram packet to /10.0.0.255 -=============== -Create new PDUs - latitude, longitude: [36.595517, -121.87693999999999] - coordinate conversion: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -Espdu #4 entityID=[1,2,3] -Sending espdu datagram packet to /127.255.255.255 -Sending fire datagram packet to /127.255.255.255 -Sending espdu datagram packet to /172.20.221.218 -Sending fire datagram packet to /172.20.221.218 -Sending espdu datagram packet to /10.0.0.255 -Sending fire datagram packet to /10.0.0.255 -=============== -DisExamplesOpenDis7.EspduSender complete. -BUILD SUCCESSFUL (total time: 8 seconds) - -=================================================== - -DisExamplesOpenDis7.EspduReceiver started... -=============== -received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu - FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -=============== -received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu - FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -=============== -received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413] -received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu - FirePdu locationInWorldCoordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413] -=============== -received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413] -received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu - FirePdu locationInWorldCoordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413] -=============== -received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu - FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -=============== -received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu - FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -=============== -received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413] -received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu - FirePdu locationInWorldCoordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413] -=============== -received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413] -received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu - FirePdu locationInWorldCoordinates: [-2707492.9269245286, -4353663.899966802, 3781450.3202754413] -=============== -received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu - FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -=============== -received PDU type 1=ENTITY_STATE edu.nps.moves.dis7.EntityStatePdu - entityID triplet: [1, 2, 3] - Location in DIS coordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] -received PDU type 2=FIRE edu.nps.moves.dis7.FirePdu - FirePdu locationInWorldCoordinates: [-2707488.3677768684, -4353666.735244378, 3781450.3202754413] - -=================================================== \ No newline at end of file diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/PduListenerSaver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/PduListenerSaver.java deleted file mode 100644 index 4fc9370b799f10ac9eeeccf09731b83928b7ba8b..0000000000000000000000000000000000000000 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/PduListenerSaver.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) 2008-2019, MOVES Institute, Naval Postgraduate School. All rights reserved. - * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html - */ -package MV3500Cohort2019JulySeptember.homework4.Yurkovich; - -import edu.nps.moves.dis7.util.playerrecorder.Recorder; -import java.io.IOException; -import java.util.Scanner; - -/** - * PduSaver.java created on Aug 21, 2019 - * MOVES Institute Naval Postgraduate School, Monterey, CA, USA www.nps.edu - * - * @author Mike Bailey, jmbailey@nps.edu - * @version $Id$ - */ -public class PduListenerSaver -{ - private final static String DEFAULT_OUTPUTDIR = "./pduLog"; - private final static String MCAST_ADDR = "239.1.2.3"; - private final static int DIS_PORT = 3000; - - private enum mystate - { - RUNNING, - PAUSED; - } - - public static void main(String[] args) - { - String outDir = DEFAULT_OUTPUTDIR; - String mcast = MCAST_ADDR; - int port = DIS_PORT; - - switch (args.length) { - case 0: - break; - case 1: - outDir = args[0]; - break; - case 3: - outDir = args[0]; - mcast = args[1]; - port = Integer.parseInt(args[2]); - break; - default: - System.err.println("Usage: PduListener() or PduListener(\"outputdir\") or PduListener(\"outputdir\",\"multicast address\", ipPort"); - System.exit(1); - } - - System.out.println("Beginning pdu save to directory " + outDir); - try { - Recorder recorder = new Recorder(outDir, mcast, port); - - recorder.startResume(); - mystate state = mystate.RUNNING; - Scanner scan = new Scanner(System.in); - - while (true) { - System.out.println("Type p/enter to pause, r/enter to resume, q/enter to quit"); - String line = scan.nextLine(); - if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) { - recorder.stopPause(); - state = mystate.PAUSED; - } - else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) { - recorder.startResume(); - state = mystate.RUNNING; - } - else if (line.equalsIgnoreCase("q")) { - recorder.end(); - break; - } - } - System.out.println("Ending pdu save to "+recorder.getLogFile()); - } - catch (IOException ex) { - System.err.println("Exception: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); - } - } -} diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/PduReaderPlayer.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/PduReaderPlayer.java deleted file mode 100644 index 62f917bd55fb301ef7671fc1d3793c708c232eb4..0000000000000000000000000000000000000000 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/PduReaderPlayer.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) 2008-2019, MOVES Institute, Naval Postgraduate School. All rights reserved. - * This work is licensed under the BSD open source license, available at https://www.movesinstitute.org/licenses/bsd.html - */ -package MV3500Cohort2019JulySeptember.homework4.Yurkovich; - -import edu.nps.moves.dis7.util.playerrecorder.Player; -import java.io.File; -import java.io.IOException; -import java.util.Scanner; - -/** - * PduSaver.java created on Aug 21, 2019 - * MOVES Institute Naval Postgraduate School, Monterey, CA, USA www.nps.edu - * - * @author Mike Bailey, jmbailey@nps.edu - * @version $Id$ - */ -public class PduReaderPlayer -{ - private final static String DEFAULT_OUTPUTDIR = "pduLog"; - private final static String MCAST_ADDR = "239.1.2.3"; - private final static int DIS_PORT = 3000; - - private enum mystate - { - RUNNING, - PAUSED; - } - - public static void main(String[] args) - { - String outDir = DEFAULT_OUTPUTDIR; - String mcast = MCAST_ADDR; - int port = DIS_PORT; - - System.out.println("DisExamplesOpenDis7.PduReaderPlayer started..."); - - switch (args.length) { - case 0: - break; - case 1: - outDir = args[0]; - break; - case 3: - outDir = args[0]; - mcast = args[1]; - port = Integer.parseInt(args[2]); - break; - default: - System.err.println("Usage: PduReaderPlayer() or PduReaderPlayer(\"outputdir\") or PduReaderPlayer(\"outputdir\",\"multicast address\", ipPort"); - System.exit(1); - } - - System.out.println("Beginning pdu playback from directory " + outDir); - try { - Player player = new Player(mcast, port, new File(outDir).toPath()); - player.startResume(); - mystate state = mystate.RUNNING; - Scanner scan = new Scanner(System.in); - - while (true) { - System.out.println("Type p/enter to pause, r/enter to resume, q/enter to quit"); - String line = scan.nextLine(); - if (line.equalsIgnoreCase("p") && state == mystate.RUNNING) { - player.stopPause(); - state = mystate.PAUSED; - } - else if (line.equalsIgnoreCase("r") && state == mystate.PAUSED) { - player.startResume(); - state = mystate.RUNNING; - } - else if (line.equalsIgnoreCase("q")) { - player.end(); - break; - } - } - System.out.println("Ending pdu files playback for directory " + outDir); - System.out.println("DisExamplesOpenDis7.PduReaderPlayer complete."); - System.exit(0); // not sure why this is necessary with Netbeans... - } - catch (IOException ex) { - System.err.println("Exception: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); - } - } -} diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/PduReaderPlayerLog.txt b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/PduReaderPlayerLog.txt deleted file mode 100644 index 7c6a4361a8bd52edb1b201b3d1fa30f04e886f5a..0000000000000000000000000000000000000000 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/PduReaderPlayerLog.txt +++ /dev/null @@ -1,24 +0,0 @@ -Invocation instructions: - -0. check for existence of recorded files in directory, e.g. examples/pduLog/Pdusave.dislog -1. first running AllPduReceiver can confirm that DIS replay actually occurs. -2. run or debug PduReaderPlayer.java -3. Type p/enter to pause, r/enter to resume, q/enter to quit - -Program response: - -=================================================== - -DisExamplesOpenDis7.PduReaderPlayer started... -Beginning pdu playback from directory pduLog -Replaying DIS logs. -Replaying C:\x-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\Pdusave.dislog -Beginning of DIS capture file, Pdusave.dislog. -Type p/enter to pause, r/enter to resume, q/enter to quit -72 -End of replay from Pdusave.dislog -End of DIS capture file, Pdusave.dislog. -q -Ending pdu files playback for directory pduLog -DisExamplesOpenDis7.PduReaderPlayer complete. -BUILD SUCCESSFUL (total time: 20 seconds) \ No newline at end of file diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/README.md b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/README.md deleted file mode 100644 index 89d90724bc17cff98112589508dcace4ba72345a..0000000000000000000000000000000000000000 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# DIS Protocol Examples using Open-DIS-Java Library v7 - -TODO under development! - -Course examples using the [Open-DIS-Java](https://github.com/open-dis/open-dis-java) library are presented in this package. - -See [specifications](../../../specifications) directory to obtain reference copies of DIS and RPRFOM standards. diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduReceiver.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduReceiver.java index 85a551a80a517c291f756cce38514d5620be0dfb..1497c16e81cf72ea9a9f990d8d6bbbf1cee95ec8 100755 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduReceiver.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduReceiver.java @@ -73,7 +73,22 @@ public class Yurk_EspduReceiver { System.out.println(receiptMessage); Vector3Double position = ((FirePdu)aPdu).getLocationInWorldCoordinates(); - System.out.println(" FirePdu locationInWorldCoordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]"); + //Yurkovich Updated: + EntityID firingEntity = ((FirePdu)aPdu).getFiringEntityID(); + Float range = ((FirePdu)aPdu).getRange(); + int missionIndedx = ((FirePdu)aPdu).getFireMissionIndex(); + Vector3Float pVelocity = new Vector3Float(); + pVelocity.setX(1.0f); + pVelocity.setY(2.0f); + pVelocity.setZ(0.0f); + + System.out.println(" FirePdu was shot by: " + firingEntity.toString()+ + " from locationInWorldCoordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "]"); + System.out.println("The munition has a range of: "+range+" and a velocity of: [" +pVelocity.getX()+ + ","+pVelocity.getY()+","+pVelocity.getZ()+"]."); + + + //End Yurkovich Update: } else diff --git a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduSender.java b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduSender.java index a8c48acce82c22e19d19ab20c5bf4e6e90b634e7..0cc35c783fa9c57cfe7a1ec08c68d034ef742c2e 100644 --- a/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduSender.java +++ b/assignments/src/MV3500Cohort2019JulySeptember/homework4/Yurkovich/Yurk_EspduSender.java @@ -143,7 +143,7 @@ public class Yurk_EspduSender entityID.setSiteID ((short)1); // TODO utility method to allow int values entityID.setApplicationID((short)2); entityID.setEntityID ((short)3); - espdu.setEntityID(entityID); + espdu.setEntityID(entityID); // Set the entity type. SISO has a big list of enumerations, so that by // specifying various numbers we can say this is an M1A2 American tank, @@ -152,8 +152,8 @@ public class Yurk_EspduSender // enumerations in C++ and Java, but to keep things simple we just use // numbers here. - // New way using entity jar(s) - espdu.setEntityType(new edu.nps.moves.dis7.entities.usa.platform.land.M1A2()); + // New way using entity jar(s) + espdu.setEntityType(new edu.nps.moves.dis7.entities.usa.platform.land.M1A2()); // Manual way: /* @@ -256,7 +256,17 @@ public class Yurk_EspduSender byte[] espduArray = baos.toByteArray(); FirePdu firePdu = new FirePdu(); - firePdu.setLocationInWorldCoordinates(espdu.getEntityLocation()); + firePdu.setLocationInWorldCoordinates(espdu.getEntityLocation()); + firePdu.setFiringEntityID(espdu.getEntityID()); + firePdu.setRange((float) 200.00); + firePdu.setFireMissionIndex(1); + Vector3Float pVelocity = new Vector3Float(); + pVelocity.setX(1.0f); + pVelocity.setY(2.0f); + pVelocity.setZ(0.0f); + firePdu.setVelocity(pVelocity); + + byte[] fireArray = firePdu.marshal(); broadcastAddresses = getBroadcastAddresses();