How to convert hexadecimal serial data into real decimal data

First of all, my hardware information is Device:OpenIMU300ZA 5020-3885-02 1.1.2 SN:1908400015,using IMU app.
Now I can print the hexadecimal information as shown in the figure below through the serial port
For example, I know 0x55557331 stands for uus1, 0xD379A13C \ 0x2C AFC73D \ 0xA9F31F41 represent the accelerations of X, y and Z respectively。As shown in the picture。

My problem is how to convert hexadecimal serial port data into real decimal data (how to convert hexadecimal serial port information into real sensor decimal information, for example 0XCAF71CC1 stands for -9.810495377)

I agree with Luken. It would be nice to know how to convert bytes to float.
There is in python int.from_bytes but no equivalent for floats.
And also, in the example from
"fmt = 'Ifffffffff'
data = struct.unpack(fmt, payload)"
give unusable results.
Thanks for your help.

Finally, struct unpack work. This is just the documentation witch is not up to date (maybe or I missed something...)
I have an OpenIMU300RI 5020-3309-01 03.01.08 SN:2003100118, Firmware: IMU_J1939 03.01.08
my packet type is 0x7331 's1', and not 0x7a31 'z1' as given

Log in to reply