Replies: 2 comments 4 replies
-
Hello, @dbircsak PS: I recommend using |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks. Do you know if there's any examples of how to make and attach a Variable Parameter such as an AttachedPart? The Wiki doesn't cover: https://sourceforge.net/p/kdis/wiki/Sending_a_Entity_State_PDU_Tutorial_Advanced/#articulation-parameters |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm trying to figure out how to use this library. I'd like to turn an Entity_State_PDU into a "JSON string" that I can write out and read from Python, however I don't know how to access several parameters, namely variableParameters. This is the code I have:
`std::string kdisHelper::to_json(const KDIS::PDU::Entity_State_PDU &pdu) {
std::stringstream ss;
ss << "{"protocolVersion": " << pdu.GetProtocolVersion();
ss << ", "exerciseID": " << (int) pdu.GetExerciseID();
ss << ", "pduType": " << pdu.GetPDUType();
ss << ", "protocolFamily": " << pdu.GetProtocolFamily();
ss << ", "timestamp": " << pdu.GetTimeStamp().GetTime();
ss << ", "length": " << pdu.GetPDULength();
ss << ", "pduStatus": " << 0;
ss << ", "padding": " << 0;
ss << ", "entityID": {"siteID": " << pdu.GetEntityIdentifier().GetSiteID();
ss << ", "applicationID": " << pdu.GetEntityIdentifier().GetApplicationID();
ss << ", "entityID": " << pdu.GetEntityIdentifier().GetEntityID();
ss << "}, "forceId": " << pdu.GetForceID();
ss << ", "numberOfVariableParameters": " << 0;
}`
I'm TRYING to turn this into something like:
{'protocolVersion': 6, 'exerciseID': 1, 'pduType': 1, 'protocolFamily': 1, 'timestamp': 1651226583, 'length': 176, 'pduStatus': 0, 'padding': 0, 'entityID': {'siteID': 25, 'applicationID': 2, 'entityID': 1}, 'forceId': 1, 'numberOfVariableParameters': 2, 'entityType': {'entityKind': 1, 'domain': 2, 'country': 225, 'category': 1, 'subcategory': 9, 'specific': 10, 'extra': 0}, 'alternativeEntityType': {'entityKind': 0, 'domain': 0, 'country': 0, 'category': 0, 'subcategory': 0, 'specific': 0, 'extra': 0}, 'entityLinearVelocity': {'x': 28.451427459716797, 'y': 53.50935363769531, 'z': 80.42235565185547}, 'entityLocation': {'x': -2397723.0428947527, 'y': -4509461.183342898, 'z': 3822916.2741852123}, 'entityOrientation': {'psi': 1.0821040868759155, 'theta': -0.9250205755233765, 'phi': 3.1415927410125732}, 'entityAppearance': 0, 'deadReckoningParameters': {'deadReckoningAlgorithm': 4, 'parameters': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'entityLinearAcceleration': {'x': 0.0, 'y': 0.0, 'z': 0.0}, 'entityAngularVelocity': {'x': 0.0, 'y': 0.0, 'z': 0.0}}, 'marking': {'characterSet': 0, 'characters': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}, 'capabilities': 0, 'variableParameters': [{'recordType': 0, 'variableParameterFields1': 7.291122019561264e-304, 'variableParameterFields2': 2354979328, 'variableParameterFields3': 0, 'variableParameterFields4': 0}, {'recordType': 0, 'variableParameterFields1': 7.291122019562091e-304, 'variableParameterFields2': 251278592, 'variableParameterFields3': 0, 'variableParameterFields4': 0}]}
But no dice. Any idea how to access variableParameters in an Entity_State_PDU?
Beta Was this translation helpful? Give feedback.
All reactions