Data from pixhawk dataflash logs format and units

I would like to take the magnetometer data that was recorded to the flash drive and plot it in ms excel or using python . I was able to download the bin file and convert it to a txt log file. Then I filtered it by the ‘MAG’ column.

Now, does anyone know what the units are for the MagX, Y, and Z as well as the time? Here is a sample of the data:

How do you recover the actual time from that 9-digit number? Also, I’m not sure what to do with the offsets. Are MagX, MagY and MagZ raw and we have to add OfsX, OfsY, and Ofsz to get the real field, or not?


The MaxX/Y/Z values are in Gauss I think.

The Ofs values are already included in the Mag values but if you wanted to get back to the raw sensor data you’d need to subtract the Ofs values. Similarly the MOfs values are the motor compensation values (aka “Compass Mot”). These are also included in the MagX/Y/Z fields so these would need to be subtracted if you wanted to get back to the raw sensor values.

The TimeUS field is microseconds (1/1000000 seconds).

Hope that helps, thanks for using AP!

Hey Rmackay9,

are any values stored in the pixhawk’s memory itself? suppose i fly without an SD card, what information can i pull from the pixhawk?


I wasn’t aware that flight without an SD card is possible, nor desirable, but if it is…

The dataflash logs are stored to the SD card. So you don’t have any of that data without the SD.

The Ardupilot parameters are stored in the onboard memory. You could use Mission Planner (or any other GCS software) to inspect their values, and probably save a copy of them to a file. So I recommend that you look through the parameters to see what information you can pull from the Pixhawk.