-
Describe the bug
I can't send a negative speed using the ESF-MEAS message:
Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi @FSet89 According to the F9R Integration Manual, the ESF-MEAS I recommend having another look at the F9R Integration Manual for clarification of how to use the |
Beta Was this translation helpful? Give feedback.
-
Hi, you're right, however according to the application notes the speed is signed (section 6.1.2): https://content.u-blox.com/sites/default/files/documents/ZED-F9R-GettingStarted_AppNote_UBX-22035176.pdf |
Beta Was this translation helpful? Give feedback.
-
OK so clearly a discrepancy between different u-blox documentation sources! In point of fact, different ESF-MEAS
In Python terms, this is equivalent to So the following amended code snippet should work: from pyubx2 import UBXMessage, SET
value = -10
value_as_twoscomp = value & 0b111111111111111111111111
print(f"{value_as_twoscomp:024b}")
msg = UBXMessage(
"ESF",
"ESF-MEAS",
SET,
timeTag=1000,
numMeas=1,
dataField_01=value_as_twoscomp,
dataType_01=11,
)
print(msg)
|
Beta Was this translation helpful? Give feedback.
OK so clearly a discrepancy between different u-blox documentation sources!
In point of fact, different ESF-MEAS
dataTypes
have different attribute types (some are signed, some are unsigned, some use individual bitflags), so thedataField
attribute is actually implemented in pyubx2 as generic X24 (24-bit binary data). This means that, to enter a -ve number, you have to use what's known as the "two's complement" binary representation of the number, e.g. -10 in 24-bit two's complement form…