Skip to content

Commit cf7250c

Browse files
authored
Merge pull request #80 from ngjunsiang/master
Handle Damage Description records
2 parents df14e20 + e75c424 commit cf7250c

17 files changed

Lines changed: 1829 additions & 1457 deletions

examples/dis_receiver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
import socket
77
import time
8-
import sys
9-
import array
8+
from typing import cast
109

1110
from opendis.dis7 import *
1211
from opendis.RangeCoordinates import *
@@ -20,7 +19,7 @@
2019

2120
print("Listening for DIS on UDP socket {}".format(UDP_PORT))
2221

23-
gps = GPS();
22+
gps = GPS()
2423

2524
def recv():
2625
print('Reading from socket...')
@@ -31,6 +30,7 @@ def recv():
3130
pduTypeName = pdu.__class__.__name__
3231

3332
if pdu.pduType == 1: # PduTypeDecoders.EntityStatePdu:
33+
pdu = cast(EntityStatePdu, pdu) # for static checkers
3434
loc = (pdu.entityLocation.x,
3535
pdu.entityLocation.y,
3636
pdu.entityLocation.z,
@@ -42,7 +42,7 @@ def recv():
4242
body = gps.ecef2llarpy(*loc)
4343

4444
print("Received {}\n".format(pduTypeName)
45-
+ " Id : {}\n".format(pdu.entityID.entityID)
45+
+ " Id : {}\n".format(pdu.entityID.entityNumber)
4646
+ " Latitude : {:.2f} degrees\n".format(rad2deg(body[0]))
4747
+ " Longitude : {:.2f} degrees\n".format(rad2deg(body[1]))
4848
+ " Altitude : {:.0f} meters\n".format(body[2])

examples/dis_sender.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from io import BytesIO
1010

11-
from opendis.DataOutputStream import DataOutputStream
11+
from opendis.stream import DataOutputStream
1212
from opendis.dis7 import EntityStatePdu
1313
from opendis.RangeCoordinates import *
1414

@@ -23,9 +23,9 @@
2323
def send():
2424
pdu = EntityStatePdu()
2525

26-
pdu.entityID.entityID = 42
27-
pdu.entityID.siteID = 17
28-
pdu.entityID.applicationID = 23
26+
pdu.entityID.entityNumber = 42
27+
pdu.entityID.simulationAddress.site = 17
28+
pdu.entityID.simulationAddress.application = 23
2929
pdu.marking.setString('Igor3d')
3030

3131
# Entity in Monterey, CA, USA facing North, no roll or pitch

opendis/DataInputStream.py

Lines changed: 0 additions & 103 deletions
This file was deleted.

opendis/DataOutputStream.py

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)