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
53278c9c
Commit
53278c9c
authored
4 years ago
by
brutzman
Browse files
Options
Downloads
Patches
Plain Diff
better formatting of output, include packet count to facilitate testing
parent
07278287
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/EspduReceiver.java
+9
-5
9 additions, 5 deletions
examples/src/OpenDis7Examples/EspduReceiver.java
with
9 additions
and
5 deletions
examples/src/OpenDis7Examples/EspduReceiver.java
+
9
−
5
View file @
53278c9c
...
@@ -35,6 +35,7 @@ public class EspduReceiver
...
@@ -35,6 +35,7 @@ public class EspduReceiver
DatagramPacket
packet
;
DatagramPacket
packet
;
InetAddress
address
;
InetAddress
address
;
PduFactory
pduFactory
=
new
PduFactory
();
PduFactory
pduFactory
=
new
PduFactory
();
int
pduCount
=
0
;
try
{
try
{
// Specify the socket to receive data
// Specify the socket to receive data
...
@@ -56,22 +57,25 @@ public class EspduReceiver
...
@@ -56,22 +57,25 @@ public class EspduReceiver
System
.
out
.
println
(
"Bundle size is "
+
pduBundle
.
size
());
System
.
out
.
println
(
"Bundle size is "
+
pduBundle
.
size
());
// end iterator loop through PDU bundle
// end iterator loop through PDU bundle
for
(
Pdu
aPdu
:
pduBundle
)
{
for
(
Pdu
aPdu
:
pduBundle
)
String
receiptMessage
=
"received PDU type "
+
aPdu
.
getPduType
().
getValue
()
+
"="
+
aPdu
.
getPduType
().
name
()
+
" "
+
aPdu
.
getClass
().
getName
();
{
pduCount
++;
String
receiptMessage
=
String
.
format
(
"%3s"
,
pduCount
)
// right justify, 3 characters
+
". received PDU type "
+
aPdu
.
getPduType
().
getValue
()
+
"="
+
aPdu
.
getPduType
().
name
()
+
" "
+
aPdu
.
getClass
().
getName
();
if
(
aPdu
instanceof
EntityStatePdu
)
if
(
aPdu
instanceof
EntityStatePdu
)
{
{
System
.
out
.
println
(
"==============="
);
System
.
out
.
println
(
"==============="
);
System
.
out
.
println
(
receiptMessage
);
System
.
out
.
println
(
receiptMessage
);
EntityID
entityID
=
((
EntityStatePdu
)
aPdu
).
getEntityID
();
EntityID
entityID
=
((
EntityStatePdu
)
aPdu
).
getEntityID
();
Vector3Double
position
=
((
EntityStatePdu
)
aPdu
).
getEntityLocation
();
Vector3Double
position
=
((
EntityStatePdu
)
aPdu
).
getEntityLocation
();
System
.
out
.
println
(
" entityID triplet: ["
+
entityID
.
getSiteID
()+
", "
+
entityID
.
getApplicationID
()+
", "
+
entityID
.
getEntityID
()+
"] "
);
System
.
out
.
println
(
"
entityID triplet: ["
+
entityID
.
getSiteID
()+
", "
+
entityID
.
getApplicationID
()+
", "
+
entityID
.
getEntityID
()+
"] "
);
System
.
out
.
println
(
" Location in DIS coordinates: ["
+
position
.
getX
()
+
", "
+
position
.
getY
()
+
", "
+
position
.
getZ
()
+
"]"
);
System
.
out
.
println
(
"
Location in DIS coordinates:
["
+
position
.
getX
()
+
", "
+
position
.
getY
()
+
", "
+
position
.
getZ
()
+
"]"
);
}
}
else
if
(
aPdu
instanceof
FirePdu
)
else
if
(
aPdu
instanceof
FirePdu
)
{
{
System
.
out
.
println
(
receiptMessage
);
System
.
out
.
println
(
receiptMessage
);
Vector3Double
position
=
((
FirePdu
)
aPdu
).
getLocationInWorldCoordinates
();
Vector3Double
position
=
((
FirePdu
)
aPdu
).
getLocationInWorldCoordinates
();
System
.
out
.
println
(
" FirePdu locationInWorldCoordinates: ["
+
position
.
getX
()
+
", "
+
position
.
getY
()
+
", "
+
position
.
getZ
()
+
"]"
);
System
.
out
.
println
(
"
FirePdu locationInWorldCoordinates: ["
+
position
.
getX
()
+
", "
+
position
.
getY
()
+
", "
+
position
.
getZ
()
+
"]"
);
}
}
else
else
...
...
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