For the data chunk
data = [217, 135, 153, 12, 0, 0, 0, 0,
251, 133, 153, 12, 0, 0, 0, 0,
231, 207, 50, 49,
64, 131, 213, 36,
215, 182, 109, 50,
247, 152, 146, 50,
0, 0, 192, 127,
0, 0, 192, 127,
0, 0, 192, 127,
0, 0, 192, 127,
0, 0, 192, 127,
0, 0, 192, 127,
0, 0, 192, 127,
0, 0, 192, 127,
0, 0]
and field description
[('uint64_t', 1, 'timestamp'),
('uint64_t', 1, 'timestamp_sample'),
('float', 12, 'control'),
('uint16_t', 1, 'reversible_flags'),
('uint8_t', 6, '_padding0')]
This library only outputs the first two items from the field description in
|
println!("{} at {}: {:?}", item.name(), item.index(), item.data()); |
The extracted format from this library is
["uint64_t timestamp", "uint64_t timestamp_sample", "float[12] control", "uint16_t reversible_flags", "uint8_t[6] _padding0", ""]
Here is how I correctly parse them
import struct
timestamp = struct.unpack('<Q', bytes([217, 135, 153, 12, 0, 0, 0, 0]))[0]
timestamp_sample = struct.unpack('<Q', bytes([251, 133, 153, 12, 0, 0, 0, 0]))[0]
control_0 = struct.unpack('<f', bytes([231, 207, 50, 49]))
control_1 = struct.unpack('<f', bytes([64, 131, 213, 36]))
control_2 = struct.unpack('<f', bytes([215, 182, 109, 50]))
control_3 = struct.unpack('<f', bytes([247, 152, 146, 50]))
control_4 = np.nan
# ...
control_11 = np.nan
For the data chunk
and field description
This library only outputs the first two items from the field description in
px4-ulog-rs/examples/gps-position.rs
Line 24 in 41b5b61
The extracted format from this library is
Here is how I correctly parse them