I'm logging values as in https://github.com/bitcraze/crazyflie-l ... py#L75-L84, but I'd like to print (and store) the floating value of 'pm.vbat' (or pm.batteryLevel), in order to use them inside an IF to make the CF land under a certain threshold.
By the way, what threshold would you advise to set?
I have already tried as in viewtopic.php?t=1835 with
Code: Select all
import struct
import numpy as np
hexVal = hex(fp16Value)
y = struct.pack("H", int(hexVal, 16))
floatVal = np.frombuffer(y, dtype=np.float16)[0]
Code: Select all
struct.Struct('e').unpack_from(data)
I would really appreciate your help, Thanks!