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
30d9c459
Commit
30d9c459
authored
3 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
tuneups and troubleshooting
parent
5a850f69
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
examples/src/OpenDis7Examples/ExampleTrackInterpolation.java
+16
-11
16 additions, 11 deletions
examples/src/OpenDis7Examples/ExampleTrackInterpolation.java
with
16 additions
and
11 deletions
examples/src/OpenDis7Examples/ExampleTrackInterpolation.java
+
16
−
11
View file @
30d9c459
...
@@ -35,7 +35,7 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
...
@@ -35,7 +35,7 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
private
byte
[]
globalByteBufferForX3dInterpolators
=
null
;
private
byte
[]
globalByteBufferForX3dInterpolators
=
null
;
// -------------------- End Variables for X3D autogenerated code
// -------------------- End Variables for X3D autogenerated code
ArrayList
<
Pdu
>
pduList
=
new
ArrayList
<>();
ArrayList
<
Pdu
>
pdu
Sent
List
=
new
ArrayList
<>();
/**
/**
* This runSimulationLoops() method is a programmer-modifiable method for
* This runSimulationLoops() method is a programmer-modifiable method for
...
@@ -73,9 +73,9 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
...
@@ -73,9 +73,9 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
espdu_1
.
setEntityID
(
entityID_1
);
espdu_1
.
setEntityID
(
entityID_1
);
espdu_1
.
setForceId
(
ForceID
.
FRIENDLY
);
espdu_1
.
setForceId
(
ForceID
.
FRIENDLY
);
espdu_1
.
setEntityType
(
new
_001Poseidon
());
// note import statement above
espdu_1
.
setEntityType
(
new
_001Poseidon
());
// note import statement above
espdu_1
.
clearMarking
();
espdu_1
.
setMarking
(
"track path"
);
espdu_1
.
setMarking
(
"track path"
);
espdu_1
.
getMarkingString
();
// trace
// espdu_1.clearMarking(); // test
// espdu_1.getMarkingString(); // trace
// espdu_1.setEntityLocation(new Vector3Double().setX(0).setY(0).setZ(0)); // long form
// espdu_1.setEntityLocation(new Vector3Double().setX(0).setY(0).setZ(0)); // long form
espdu_1
.
setEntityLocation
(
0
,
0
,
0
);
// utility method
espdu_1
.
setEntityLocation
(
0
,
0
,
0
);
// utility method
...
@@ -84,7 +84,7 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
...
@@ -84,7 +84,7 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
PduTrack
pduTrack_1
=
new
PduTrack
();
PduTrack
pduTrack_1
=
new
PduTrack
();
pduTrack_1
.
setDescriptor
(
"testing 123"
);
pduTrack_1
.
setDescriptor
(
"testing 123"
);
pduTrack_1
.
setWaypointInterval
(
1.0f
);
// overrides timestamps
pduTrack_1
.
set
Default
WaypointInterval
(
1.0f
);
// overrides timestamps
pduTrack_1
.
addPdu
(
espdu_1
);
// initial location
pduTrack_1
.
addPdu
(
espdu_1
);
// initial location
// OK send initial PDUs prior to loop
// OK send initial PDUs prior to loop
...
@@ -92,10 +92,11 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
...
@@ -92,10 +92,11 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
System
.
out
.
println
(
"sending PDUs for simulation step "
+
simulationLoopCount
+
", monitor loopback to confirm sent"
);
System
.
out
.
println
(
"sending PDUs for simulation step "
+
simulationLoopCount
+
", monitor loopback to confirm sent"
);
sendSinglePdu
(
espdu_1
);
sendSinglePdu
(
espdu_1
);
// sendCommentPdu(currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3);
// sendCommentPdu(currentTimeStepComment, narrativeMessage1, narrativeMessage2, narrativeMessage3);
pduList
.
add
(
espdu_1
);
pdu
Sent
List
.
add
(
espdu_1
);
reportPdu
(
simulationLoopCount
,
espdu_1
.
getEntityLocation
(),
directionEntity_1
);
reportPdu
(
simulationLoopCount
,
espdu_1
.
getEntityLocation
(),
directionEntity_1
);
// TODO simulation management PDUs for startup, planning to design special class support
// TODO simulation management PDUs for startup, planning to design special class support
// ===================================================================================================
// loop the simulation while allowed, programmer can set additional conditions to break out and finish
// loop the simulation while allowed, programmer can set additional conditions to break out and finish
while
(
simulationLoopCount
<
SIMULATION_MAX_LOOP_COUNT
)
// are we done yet?
while
(
simulationLoopCount
<
SIMULATION_MAX_LOOP_COUNT
)
// are we done yet?
{
{
...
@@ -130,7 +131,7 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
...
@@ -130,7 +131,7 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
narrativeMessage3
=
""
;
// intentionally blank for testing
narrativeMessage3
=
""
;
// intentionally blank for testing
// your loop termination condition goes here
// your loop termination condition goes here
if
(
simulationLoopCount
>
=
40
)
// for example
if
(
simulationLoopCount
>
40
)
// for example
{
{
simulationComplete
=
true
;
simulationComplete
=
true
;
}
}
...
@@ -153,22 +154,26 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
...
@@ -153,22 +154,26 @@ public class ExampleTrackInterpolation extends ExampleSimulationProgram
sendCommentPdu
(
currentTimeStepComment
,
narrativeMessage1
,
narrativeMessage2
,
narrativeMessage3
);
sendCommentPdu
(
currentTimeStepComment
,
narrativeMessage1
,
narrativeMessage2
,
narrativeMessage3
);
if
(
pduRecorder
.
hasVerboseOutput
())
if
(
pduRecorder
.
hasVerboseOutput
())
System
.
out
.
println
(
TRACE_PREFIX
+
"PDUs successfully sent for this loop"
);
System
.
out
.
println
(
TRACE_PREFIX
+
"PDUs successfully sent for this loop"
);
pduList
.
add
(
espdu_1
);
pdu
Sent
List
.
add
(
espdu_1
);
pduTrack_1
.
addPdu
(
espdu_1
);
pduTrack_1
.
addPdu
(
espdu_1
);
Vector3Double
location
=
espdu_1
.
getEntityLocation
();
Vector3Double
location
=
espdu_1
.
getEntityLocation
();
reportPdu
(
simulationLoopCount
,
location
,
directionEntity_1
);
reportPdu
(
simulationLoopCount
,
location
,
directionEntity_1
);
// ===============================
// ===============================
// loop now finished, check whether to terminate if simulation complete, otherwise continue
//
current
loop now finished, check whether to terminate if simulation complete, otherwise continue
if
(
simulationComplete
||
(
simulationLoopCount
>
10000
))
// for example; including fail-safe condition is good
if
(
simulationComplete
||
(
simulationLoopCount
>
10000
))
// for example; including fail-safe condition is good
{
{
System
.
out
.
println
(
TRACE_PREFIX
+
"loop termination condition met, simulationComplete="
+
simulationComplete
);
// ", final loopCount=" + loopCount +
System
.
out
.
println
(
TRACE_PREFIX
+
"loop termination condition met, simulationComplete="
+
simulationComplete
);
// ", final loopCount=" + loopCount +
break
;
break
;
}
}
}
// end of simulation loop
}
// end of simulation loop
System
.
out
.
println
(
TRACE_PREFIX
+
"all PDUs successfully sent for this loop, pduList.size()="
+
pduList
.
size
());
// ===================================================================================================
System
.
out
.
println
(
TRACE_PREFIX
+
"all PDUs successfully sent for this loop (pduSentList.size()="
+
pduSentList
.
size
()
+
" total)"
);
pduTrack_1
=
pduTrack_1
.
sortPdus
().
createRawWaypoints
();
// track analysis
System
.
out
.
println
(
TRACE_PREFIX
+
"pduTrack_1 initialLocation="
+
pduTrack_1
.
getInitialLocation
()
+
", latestLocation="
+
pduTrack_1
.
getLatestLocation
());
pduTrack_1
.
sortPdus
()
.
createRawWaypoints
();
System
.
out
.
println
(
"pduTrack_1 getEspduCount()="
+
pduTrack_1
.
getEspduCount
());
System
.
out
.
println
(
"pduTrack_1 getEspduCount()="
+
pduTrack_1
.
getEspduCount
());
System
.
out
.
println
(
"pduTrack_1 duration = "
+
pduTrack_1
.
getTrackDurationSeconds
()
+
" seconds = "
+
System
.
out
.
println
(
"pduTrack_1 duration = "
+
pduTrack_1
.
getTrackDurationSeconds
()
+
" seconds = "
+
...
...
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