Skip to content

Something seems to be very off in the way the data is packed up #47

@sosukeinu

Description

@sosukeinu

I feel like I may be missing something here. I'm springboarding off the example sender like:

    pdu = EntityStatePdu()
    pdu.length = 144 #gotta figure this shit out
    pdu.exerciseID = 250
    pdu.entityID.entityID = 42
    pdu.entityID.siteID = 1
    pdu.entityID.applicationID = 11
    pdu.marking.setString('Igor3d')
    pdu.entityType.domain = 2
    pdu.entityType.country = 255
    pdu.entityType.entityKind = 1

    pdu.forceId = 1

    myLocation = [-5.482955764588357,   # longitude
                    35.198894404096315, # latitude
                    10000,               # altitude
                    0,               # roll
                    0,               # pitch
                    0                # yaw
                     ]
    pdu.entityLocation.x = myLocation[0]
    pdu.entityLocation.y = myLocation[1]
    pdu.entityLocation.z = myLocation[2]
    pdu.entityOrientation.psi = myLocation[3]
    pdu.entityOrientation.theta = myLocation[4]
    pdu.entityOrientation.phi = myLocation[5]
    
    memoryStream = BytesIO()
    outputStream = DataOutputStream(memoryStream)
    pdu.serialize(outputStream)
    data = memoryStream.getvalue()

    while True:
        udpSocket.sendto(data, (DESTINATION_ADDRESS, UDP_PORT))
        pp.pprint(vars(pdu))
        pp.pprint(vars(pdu.entityID))
        pp.pprint(vars(pdu.entityType))
        pp.pprint(vars(pdu.entityLocation))
        print("Sent {}. {} bytes to {}:{}".format(pdu.__class__.__name__, len(data), DESTINATION_ADDRESS, UDP_PORT))
        time.sleep(5)

Then, when I send the data it is printed as below:

{   'alternativeEntityType': <opendis.dis7.EntityType object at 0x7f0a18fb81c0>,
    'capabilities': 0,
    'deadReckoningParameters': <opendis.dis7.DeadReckoningParameters object at 0x7f0a18fb8bb0>,
    'entityAppearance': 0,
    'entityID': <opendis.dis7.EntityID object at 0x7f0a18fb83d0>,
    'entityLinearVelocity': <opendis.dis7.Vector3Float object at 0x7f0a18fb85e0>,
    'entityLocation': <opendis.dis7.Vector3Double object at 0x7f0a18fb86a0>,
    'entityOrientation': <opendis.dis7.EulerAngles object at 0x7f0a18fb8ca0>,
    'entityType': <opendis.dis7.EntityType object at 0x7f0a18fb8cd0>,
    'exerciseID': 250,
    'forceId': 1,
    'length': 144,
    'marking': <opendis.dis7.EntityMarking object at 0x7f0a1869f4c0>,
    'numberOfVariableParameters': 0,
    'padding': 0,
    'pduStatus': 0,
    'pduType': 1,
    'protocolFamily': 1,
    'protocolVersion': 7,
    'timestamp': 0,
    'variableParameters': []}
{'applicationID': 11, 'entityID': 42, 'siteID': 1}
{   'category': 0,
    'country': 255,
    'domain': 2,
    'entityKind': 1,
    'extra': 0,
    'specific': 0,
    'subcategory': 0}
{'x': -5.482955764588357, 'y': 35.198894404096315, 'z': 10000}

Looks great so far. HOWEVER, when I check the packet in Wireshark I get:

"dis": {
          "Header": {
            "dis.proto_ver": "7",
            "dis.exer_id": "250",
            "dis.pdu_type": "1",
            "dis.proto_fam": "1",
            "dis.timestamp": "0.000000000",
            "dis.pdu_length": "144",
            "dis.pdu_status": "0x00000000",
            "dis.pdu_status_tree": {
              "dis.pdustatus.cei": "0x00000000",
              "dis.pdustatus.lvc": "0x00000000",
              "dis.pdustatus.tei": "0x00000000"
            },
            "dis.padding": "00"
          },
          "Entity State PDU": {
            "Entity ID": {
              "dis.entity_id_site": "1",
              "dis.entity_id_application": "11",
              "dis.entity_id_entity": "42"
            },
            "dis.force_id": "1",
            "dis.num_articulation_params": "0",
            "Entity Type, (0:0:0:0:144:1:2) ": {
              "dis.entityKind": "0",
              "dis.entityDomain": "0",
              "dis.country": "0",
              "dis.category": "0",
              "dis.subcategory": "144",
              "dis.specific": "1",
              "dis.extra": "2"
            },
            "Alternative Entity Type, (0:255:0:0:0:0:0) ": {
              "dis.entityKind": "0",
              "dis.entityDomain": "255",
              "dis.country": "0",
              "dis.category": "0",
              "dis.subcategory": "0",
              "dis.specific": "0",
              "dis.extra": "0"
            },
            "Entity Linear Velocity": {
              "dis.entity_linear_velocity.x": "0",
              "dis.entity_linear_velocity.y": "0",
              "dis.entity_linear_velocity.z": "0"
            },
            "Entity Location": {
              "dis.entity_location.x": "2.42946900029516e-319",
              "dis.entity_location.y": "-3.23371005475282e+224",
              "dis.entity_location.z": "-4.9118429119158e-186"
            },
            "Entity Orientation": {
              "dis.entity_orientation.psi": "-3.85186e-34",
              "dis.entity_orientation.theta": "0",
              "dis.entity_orientation.phi": "0"
            },
            "dis.appearance": "0x00000000",
            "Dead Reckoning Parameters": {
              "dis.entity_marking_character_set": "0",
              "dis.dead_reckoning_other_parameters": "00:00:00:00:00:00:00:00:00:00:00:00:00:00:00",
              "Entity Linear Acceleration": {
                "dis.entity_linear_acceleration.x": "0",
                "dis.entity_linear_acceleration.y": "0",
                "dis.entity_linear_acceleration.z": "0"
              },
              "Entity Angular Velocity": {
                "dis.entity_angular_velocity.x": "0",
                "dis.entity_angular_velocity.y": "0",
                "dis.entity_angular_velocity.z": "0"
              }
            },
            "Entity Marking": {
              "dis.entity_marking_character_set": "0"
            },
            "dis.capabilities": "1677721600"

As you can see, the entityType and location info is ignored or changed.
Any help in understanding what I'm doing wrong would be greatly appreciated.
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions