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
aa18f35a
Commit
aa18f35a
authored
3 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
debug checks of ByteBuffer marshal/unmarshall of ESPDUs
parent
b40bb9be
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/src/OpenDis7Examples/PduTrack.java
+41
-4
41 additions, 4 deletions
examples/src/OpenDis7Examples/PduTrack.java
examples/src/OpenDis7Examples/PduTrackLog.txt
+31
-1
31 additions, 1 deletion
examples/src/OpenDis7Examples/PduTrackLog.txt
with
72 additions
and
5 deletions
examples/src/OpenDis7Examples/PduTrack.java
+
41
−
4
View file @
aa18f35a
...
@@ -40,9 +40,11 @@ import edu.nps.moves.dis7.pdus.EntityStatePdu;
...
@@ -40,9 +40,11 @@ import edu.nps.moves.dis7.pdus.EntityStatePdu;
import
edu.nps.moves.dis7.pdus.EulerAngles
;
import
edu.nps.moves.dis7.pdus.EulerAngles
;
import
edu.nps.moves.dis7.pdus.Pdu
;
import
edu.nps.moves.dis7.pdus.Pdu
;
import
edu.nps.moves.dis7.pdus.Vector3Double
;
import
edu.nps.moves.dis7.pdus.Vector3Double
;
import
java.nio.ByteBuffer
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -163,10 +165,10 @@ public class PduTrack
...
@@ -163,10 +165,10 @@ public class PduTrack
{
{
EntityStatePdu
deepCopyEspdu
=
new
EntityStatePdu
();
EntityStatePdu
deepCopyEspdu
=
new
EntityStatePdu
();
deepCopyEspdu
.
setTimestamp
(((
EntityStatePdu
)
newPdu
).
getTimestamp
());
deepCopyEspdu
.
setTimestamp
(((
EntityStatePdu
)
newPdu
).
getTimestamp
());
deepCopyEspdu
.
setMarking
(((
EntityStatePdu
)
newPdu
).
getMarking
());
deepCopyEspdu
.
setEntityID
(((
EntityStatePdu
)
newPdu
).
getEntityID
());
deepCopyEspdu
.
setEntityID
(((
EntityStatePdu
)
newPdu
).
getEntityID
());
deepCopyEspdu
.
setForceId
(((
EntityStatePdu
)
newPdu
).
getForceId
());
deepCopyEspdu
.
setForceId
(((
EntityStatePdu
)
newPdu
).
getForceId
());
deepCopyEspdu
.
setEntityType
(((
EntityStatePdu
)
newPdu
).
getEntityType
());
deepCopyEspdu
.
setEntityType
(((
EntityStatePdu
)
newPdu
).
getEntityType
());
deepCopyEspdu
.
setMarking
(((
EntityStatePdu
)
newPdu
).
getMarking
());
deepCopyEspdu
.
setEntityLocation
(((
EntityStatePdu
)
newPdu
).
getEntityLocation
());
deepCopyEspdu
.
setEntityLocation
(((
EntityStatePdu
)
newPdu
).
getEntityLocation
());
deepCopyEspdu
.
setEntityOrientation
(((
EntityStatePdu
)
newPdu
).
getEntityOrientation
());
deepCopyEspdu
.
setEntityOrientation
(((
EntityStatePdu
)
newPdu
).
getEntityOrientation
());
...
@@ -717,6 +719,7 @@ public class PduTrack
...
@@ -717,6 +719,7 @@ public class PduTrack
*/
*/
public
void
selfTest
()
public
void
selfTest
()
{
{
final
int
TOTAL_PDUS
=
5
;
System
.
out
.
println
(
TRACE_PREFIX
+
"selfTest() start..."
);
System
.
out
.
println
(
TRACE_PREFIX
+
"selfTest() start..."
);
PduTrack
pduTrack
=
new
PduTrack
();
PduTrack
pduTrack
=
new
PduTrack
();
...
@@ -725,11 +728,11 @@ public class PduTrack
...
@@ -725,11 +728,11 @@ public class PduTrack
pduTrack
.
setAuthor
(
"Don Brutzman"
);
pduTrack
.
setAuthor
(
"Don Brutzman"
);
pduTrack
.
setX3dModelIdentifier
(
"https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/PduTrackInterpolation.x3d"
);
pduTrack
.
setX3dModelIdentifier
(
"https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/PduTrackInterpolation.x3d"
);
EntityStatePdu
espdu
=
new
EntityStatePdu
();
for
(
int
i
=
0
;
i
<
TOTAL_PDUS
;
i
++)
espdu
.
setMarking
(
"PduTrack"
);
for
(
int
i
=
0
;
i
<
5
;
i
++)
{
{
EntityStatePdu
espdu
=
new
EntityStatePdu
();
espdu
.
setTimestamp
(
i
);
espdu
.
setTimestamp
(
i
);
espdu
.
setMarking
(
"PduTrack "
+
i
);
espdu
.
setEntityLocation
(
i
,
i
,
i
);
espdu
.
setEntityLocation
(
i
,
i
,
i
);
espdu
.
setEntityOrientation
(
0
,
(
float
)(
45.0
*
Math
.
PI
/
180.0
),
0
);
espdu
.
setEntityOrientation
(
0
,
(
float
)(
45.0
*
Math
.
PI
/
180.0
),
0
);
pduTrack
.
addPdu
(
espdu
);
pduTrack
.
addPdu
(
espdu
);
...
@@ -742,6 +745,40 @@ public class PduTrack
...
@@ -742,6 +745,40 @@ public class PduTrack
System
.
out
.
println
(
TRACE_PREFIX
+
"getEspduCount()="
+
pduTrack
.
getEspduCount
());
System
.
out
.
println
(
TRACE_PREFIX
+
"getEspduCount()="
+
pduTrack
.
getEspduCount
());
System
.
out
.
println
(
TRACE_PREFIX
+
"getDefaultWaypointInterval()="
+
pduTrack
.
getDefaultWaypointInterval
());
System
.
out
.
println
(
TRACE_PREFIX
+
"getDefaultWaypointInterval()="
+
pduTrack
.
getDefaultWaypointInterval
());
System
.
out
.
println
(
TRACE_PREFIX
+
"getTotalDurationSeconds()="
+
pduTrack
.
getTotalDurationSeconds
());
System
.
out
.
println
(
TRACE_PREFIX
+
"getTotalDurationSeconds()="
+
pduTrack
.
getTotalDurationSeconds
());
// marshalling checks
try
{
int
BYTE_BUFFER_SIZE
=
400
;
// TODO what is expected max buffer size?
for
(
int
i
=
0
;
i
<
TOTAL_PDUS
;
i
++)
{
EntityStatePdu
espdu
=
new
EntityStatePdu
();
byte
[]
byteArray
=
new
byte
[
BYTE_BUFFER_SIZE
];
byteArray
=
espdu
.
marshal
();
// https://stackoverflow.com/questions/9655181/how-to-convert-a-byte-array-to-a-hex-string-in-java
final
char
[]
HEX_ARRAY
=
"0123456789ABCDEF"
.
toCharArray
();
char
[]
hexChars
=
new
char
[
byteArray
.
length
*
2
];
for
(
int
j
=
0
;
j
<
byteArray
.
length
;
j
++)
{
int
v
=
byteArray
[
j
]
&
0xFF
;
hexChars
[
j
*
2
]
=
HEX_ARRAY
[
v
>>>
4
];
hexChars
[
j
*
2
+
1
]
=
HEX_ARRAY
[
v
&
0x0F
];
}
System
.
out
.
println
(
"espdu.marshal(): "
+
new
String
(
hexChars
));
System
.
err
.
flush
();
System
.
out
.
flush
();
ByteBuffer
byteBuffer
=
ByteBuffer
.
allocate
(
300
);
espdu
.
marshal
(
byteBuffer
);
System
.
out
.
println
(
"espdu.marshal(byteBuffer): "
+
Arrays
.
toString
(
byteBuffer
.
array
()).
replace
(
", "
,
""
));
System
.
err
.
flush
();
System
.
out
.
flush
();
espdu
.
copy
().
marshal
(
byteBuffer
);
System
.
out
.
println
(
"espdu.copy().marshal(byteBuffer):"
+
Arrays
.
toString
(
byteBuffer
.
array
()).
replace
(
", "
,
""
));
System
.
err
.
flush
();
System
.
out
.
flush
();
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
TRACE_PREFIX
+
"Marshalling test exception: "
+
e
.
getMessage
());
}
System
.
out
.
println
(
"================================="
);
System
.
out
.
println
(
"================================="
);
pduTrack
.
setAddLineBreaksWithinKeyValues
(
true
);
pduTrack
.
setAddLineBreaksWithinKeyValues
(
true
);
System
.
out
.
println
(
pduTrack
.
createX3dModel
());
//
System
.
out
.
println
(
pduTrack
.
createX3dModel
());
//
...
...
This diff is collapsed.
Click to expand it.
examples/src/OpenDis7Examples/PduTrackLog.txt
+
31
−
1
View file @
aa18f35a
...
@@ -11,6 +11,36 @@ run-single:
...
@@ -11,6 +11,36 @@ run-single:
[PduTrack main() self test] getEspduCount()=5
[PduTrack main() self test] getEspduCount()=5
[PduTrack main() self test] getDefaultWaypointInterval()=1.0
[PduTrack main() self test] getDefaultWaypointInterval()=1.0
[PduTrack main() self test] getTotalDurationSeconds()=5.0
[PduTrack main() self test] getTotalDurationSeconds()=5.0
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.Vector3Double
espdu.marshal(): 070001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.EulerAngles
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.EntityStatePdu
espdu.marshal(byteBuffer): [701100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.Vector3Double
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.EulerAngles
espdu.copy().marshal(byteBuffer):[701100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.EntityStatePdu
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.Vector3Double
espdu.marshal(): 070001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.EulerAngles
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.EntityStatePdu
espdu.marshal(byteBuffer): [701100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.Vector3Double
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.EulerAngles
espdu.copy().marshal(byteBuffer):[701100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.EntityStatePdu
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.Vector3Double
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.EulerAngles
espdu.marshal(): 070001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
*** buffer underflow error while unmarshalling edu.nps.moves.dis7.pdus.EntityStatePdu
espdu.marshal(byteBuffer): [701100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
espdu.copy().marshal(byteBuffer):[701100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
espdu.marshal(): 070001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
espdu.marshal(byteBuffer): [701100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
espdu.copy().marshal(byteBuffer):[701100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
espdu.marshal(): 070001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
espdu.marshal(byteBuffer): [701100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
espdu.copy().marshal(byteBuffer):[701100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
=================================
=================================
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd">
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd">
...
@@ -19,7 +49,7 @@ run-single:
...
@@ -19,7 +49,7 @@ run-single:
<meta content='PduTrackInterpolation.x3d' name='title'/>
<meta content='PduTrackInterpolation.x3d' name='title'/>
<meta content='Conversion of ESPDU track into X3D animation interpolators and LineSet.' name='description'/>
<meta content='Conversion of ESPDU track into X3D animation interpolators and LineSet.' name='description'/>
<meta content='1 January 2022' name='created'/>
<meta content='1 January 2022' name='created'/>
<meta content='
5
January 2022' name='modified'/>
<meta content='
6
January 2022' name='modified'/>
<meta content='Don Brutzman' name='creator'/>
<meta content='Don Brutzman' name='creator'/>
<meta content='https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/PduTrackInterpolation.x3d' name='identifier'/>
<meta content='https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/PduTrackInterpolation.x3d' name='identifier'/>
<meta content='PduTrack utility, open-dis7-java Library https://github.com/open-dis/open-dis7-java' name='generator'/>
<meta content='PduTrack utility, open-dis7-java Library https://github.com/open-dis/open-dis7-java' name='generator'/>
...
...
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