From b57b50ba044d6e0c65d3a70a6556b929cdcb2e09 Mon Sep 17 00:00:00 2001 From: Brian <Brian@Brian-Monterey> Date: Fri, 16 Mar 2018 14:00:08 -0700 Subject: [PATCH] --- .../2018March/Hanley/Entities.csv | 36 +++++++++---------- .../Hanley/HanleyOpenDisEspduSenderFP.java | 22 ++++++------ 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/projects/Assignments/FinalProjects/2018March/Hanley/Entities.csv b/projects/Assignments/FinalProjects/2018March/Hanley/Entities.csv index 46c0f4bee4..05e2b3d60b 100644 --- a/projects/Assignments/FinalProjects/2018March/Hanley/Entities.csv +++ b/projects/Assignments/FinalProjects/2018March/Hanley/Entities.csv @@ -1,18 +1,18 @@ -#exerciseID,#siteID,#entityID,#entityKind,#Country,#Domain,#Category,#Subcategory,#special,#lat,#long -1,1,66,1,225,1,1,1,2,36.5955,-121.875 -1,1,65,1,225,1,1,1,2,36.588,-121.882 -1,1,11,1,225,1,1,1,2,36.596,-121.877 -1,1,12,1,225,1,1,1,4,36.597,-121.878 -1,1,13,1,225,1,1,1,5,36.594,-121.878 -1,1,14,1,225,1,1,1,2,36.595,-121.877 -1,1,21,1,225,1,1,1,2,36.603,-121.88 -1,1,22,1,225,1,1,1,4,36.604,-121.881 -1,1,23,1,225,1,1,1,5,36.601,-121.881 -1,1,24,1,225,1,1,1,2,36.602,-121.88 -1,1,31,1,225,1,1,1,2,36.588,-121.88 -1,1,32,1,225,1,1,1,4,36.589,-121.881 -1,1,33,1,225,1,1,1,5,36.586,-121.881 -1,1,34,1,225,1,1,1,2,36.587,-121.88 -1,1,7,1,225,1,6,1,1,36.5956,-121.87701 -1,1,4,1,225,1,7,12,1,36.596,-121.878 -1,1,77,1,225,1,3,14,,36.595,-121.879 +#exerciseID,#siteID,#entityID,#entityKind,#Country,#Domain,#Category,#Subcategory,#special,#lat,#long,Marking +1,1,66,1,225,1,1,1,2,36.5955,-121.875,CoCDR +1,1,65,1,225,1,1,1,2,36.588,-121.882,CoXO +1,1,11,1,225,1,1,1,2,36.596,-121.877,1stPL +1,1,12,1,225,1,1,1,4,36.597,-121.878,1stRoller +1,1,13,1,225,1,1,1,5,36.594,-121.878,1stPlow +1,1,14,1,225,1,1,1,2,36.595,-121.877,1stPSG +1,1,21,1,225,1,1,1,2,36.603,-121.88,2ndPL +1,1,22,1,225,1,1,1,4,36.604,-121.881,2ndRoller +1,1,23,1,225,1,1,1,5,36.601,-121.881,2ndPlow +1,1,24,1,225,1,1,1,2,36.602,-121.88,2ndPSG +1,1,31,1,225,1,1,1,2,36.588,-121.88,3rdPL +1,1,32,1,225,1,1,1,4,36.589,-121.881,3rdRoller +1,1,33,1,225,1,1,1,5,36.586,-121.881,3rdPlow +1,1,34,1,225,1,1,1,2,36.587,-121.88,3rdPSG +1,1,7,1,225,1,6,1,1,36.5956,-121.87701,Co1SG +1,1,4,1,225,1,7,12,1,36.596,-121.878,CoSupSgt +1,1,77,1,225,1,3,14,0,36.595,-121.879,CoEvac diff --git a/projects/Assignments/FinalProjects/2018March/Hanley/HanleyOpenDisEspduSenderFP.java b/projects/Assignments/FinalProjects/2018March/Hanley/HanleyOpenDisEspduSenderFP.java index 95365930a5..21f9e0eebf 100644 --- a/projects/Assignments/FinalProjects/2018March/Hanley/HanleyOpenDisEspduSenderFP.java +++ b/projects/Assignments/FinalProjects/2018March/Hanley/HanleyOpenDisEspduSenderFP.java @@ -132,9 +132,6 @@ public static void main(String args[]) throws FileNotFoundException // Note that some values (such as the PDU type and PDU family) are set // automatically when you create the ESPDU. espdu.setExerciseID((short)1); -// Marking espduMarking = new Marking(); -// espduMarking.setCharactersString(portString);t -// espdu.setMarking(espduMarking); // The EID is the unique identifier for objects in the world. This // EID should match up with the ID for the object specified in the @@ -167,7 +164,7 @@ public static void main(String args[]) throws FileNotFoundException try { - + ////// for (int idx =0; idx<10; idx++){ scanner = new Scanner(inputFile); //this scanner reads from the .csv file identified by fileName @@ -178,7 +175,7 @@ public static void main(String args[]) throws FileNotFoundException scanner.nextLine(); //this section reads through the .csv and parses it to send out as an espdu. - while(scanner.hasNextLine()) { + while(scanner.hasNextLine()) { String line = scanner.nextLine(); //System.out.println(line); String[] splits; @@ -195,7 +192,8 @@ public static void main(String args[]) throws FileNotFoundException float entityLat = Float.parseFloat(splits[9]); //System.out.println(entityLat); float entityLon = Float.parseFloat(splits[10]); - //System.out.println(entityLon); + String marking = splits[11]; + //System.out.println(marking); //This section provides the ESPDU its entity specific information entityID.setEntity(bumperNumber); @@ -207,6 +205,9 @@ public static void main(String args[]) throws FileNotFoundException entityType.setSubcategory((short)subCategory); // M1 Abrams, M113, M998, or FMTV entityType.setSpec((short)special); // various for this example //System.out.println("entity ID: "+ bumperNumber); // a check built to make sure each line of the .csv was being read and parsed + Marking entityMarking = new Marking(); //creates a marking instance which can be added to the espdu + entityMarking.setCharactersString(marking); + espdu.setMarking(entityMarking); //System.out.println("Sending " + NUMBER_TO_SEND + " ESPDU packets to " + destinationIp.toString()); //for(int idx = 0; idx < NUMBER_TO_SEND; idx++) @@ -257,8 +258,8 @@ public static void main(String args[]) throws FileNotFoundException //System.out.println("lla=" + lat + "," + lon + ", 0.0"); //double direction = Math.pow((-1.0), (idx)); - lon = entityLon + (idx * 0.00002); - lat = entityLat + (idx * 0.00002); + lon = entityLon + (idx * 0.002); + lat = entityLat + (idx * 0.002); //System.out.println(lat); //System.out.println(lon); @@ -313,16 +314,17 @@ public static void main(String args[]) throws FileNotFoundException location = espdu.getEntityLocation(); - if (bumperNumber ==66){ + if (bumperNumber == 66){ System.out.println("Espdu #" + idx + " EID=[" + entityID.getSite() + "," + entityID.getApplication() + "," + entityID.getEntity() + "]"); System.out.println(" DIS coordinates location=[" + location.getX() + "," + location.getY() + "," + location.getZ() + "]"); double c[] = {location.getX(), location.getY(), location.getZ()}; double lla[] = CoordinateConversions.xyzToLatLonDegrees(c); - System.out.println(" Location (lat/lon/alt): [" + lla[0] + ", " + lla[1] + ", " + lla[2] + "]"); + System.out.printf(" Location (lat/lon/alt): [ %.4f , %.4f, %.4f] \n",lla[0],lla[1],lla[2]); } } + ////// // Send every 1 sec. Otherwise this will be all over in a fraction of a second. System.out.println("Iteration "+idx); System.out.println("Sleep Time"); -- GitLab