Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
b374550f
Commit
b374550f
authored
3 years ago
by
justi
Browse files
Options
Downloads
Patches
Plain Diff
Frank Assignment 3
parent
15627cec
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
assignments/src/MV3500Cohort2021JulySeptember/homework3/Frank/FrankUdpServer.java
+20
-6
20 additions, 6 deletions
...hort2021JulySeptember/homework3/Frank/FrankUdpServer.java
with
20 additions
and
6 deletions
assignments/src/MV3500Cohort2021JulySeptember/homework3/Frank/FrankUdpServer.java
+
20
−
6
View file @
b374550f
package
MV3500Cohort2021JulySeptember.homework3.Frank
;
import
static
com
.
google
.
common
.
collect
.
Multimaps
.
index
;
import
edu.nps.moves.dis7.enumerations.VariableRecordType
;
import
edu.nps.moves.dis7.pdus.CommentPdu
;
import
edu.nps.moves.dis7.pdus.EntityID
;
import
edu.nps.moves.dis7.pdus.EntityStatePdu
;
import
edu.nps.moves.dis7.pdus.FirePdu
;
import
edu.nps.moves.dis7.pdus.Pdu
;
import
edu.nps.moves.dis7.pdus.Vector3Double
;
import
edu.nps.moves.dis7.utilities.CoordinateConversions
;
import
edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface
;
import
edu.nps.moves.dis7.utilities.PduFactory
;
import
edu.nps.moves.dis7.utilities.stream.PduRecorder
;
...
...
@@ -20,8 +23,6 @@ import java.util.logging.Logger;
* reporting them to the network. Default settings include PDU recording turned
* on by default.
*/
public
class
FrankUdpServer
{
/**
...
...
@@ -34,6 +35,11 @@ public class FrankUdpServer {
* methods are setup, teardown and configuration that you don't have to
* worry about.
*/
// ICBM coordinates for my office
double
latitude
=
36.595517
;
double
longitude
=
-
121.877000
;
@SuppressWarnings
(
"SleepWhileInLoop"
)
public
void
runSimulation
()
{
try
{
...
...
@@ -41,6 +47,12 @@ public class FrankUdpServer {
* seconds for real-time execution (not simulation time, which may
* or may not be the same)
*/
// ICBM coordinates for my office
double
latitude
=
36.595517
;
double
longitude
=
-
121.877000
;
final
double
LOOP_DURATION_SECONDS
=
1.0
;
final
int
MAX_LOOP_COUNT
=
10
;
// be deliberate out out there!
int
loopCount
=
0
;
// initialized at 0
...
...
@@ -61,9 +73,8 @@ public class FrankUdpServer {
// TODO simulation management PDUs for startup
// loop the simulation while allowed, programmer can set additional conditions to break out and finish
int
port
=
3000
;
MulticastSocket
socket
=
null
;
// must be i
int
port
=
3000
;
MulticastSocket
socket
=
null
;
// must be i
socket
=
new
MulticastSocket
(
port
);
while
(
loopCount
<
MAX_LOOP_COUNT
)
// are we done yet?
{
...
...
@@ -125,7 +136,7 @@ public class FrankUdpServer {
}
catch
(
InterruptedException
iex
)
// handle any exception that your code might choose to provoke!
{
Logger
.
getLogger
(
FrankUdpServer
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
iex
);
}
catch
(
Exception
ex
){
}
catch
(
Exception
ex
)
{
}
}
/* **************************** infrastructure code, modification is seldom needed ************************* */
...
...
@@ -345,9 +356,12 @@ public class FrankUdpServer {
thisProgram
.
setUpNetworkInterface
();
String
DEFAULT_OUTPUT_DIRECTORY
=
"./pduLog"
;
String
outputDirectory
=
DEFAULT_OUTPUT_DIRECTORY
;
System
.
out
.
println
(
"Beginning pdu save to directory "
+
outputDirectory
);
//System.out.println(" latitude, longitude: [" + latitude + ", " + longitude + "]");
PduRecorder
pduRecorder
=
new
PduRecorder
(
outputDirectory
,
networkAddress
,
networkPort
);
// assumes save
thisProgram
.
runSimulation
();
// ... your simulation execution code goes in there ...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment