Ulog files and timestamps

Hello everybody,

I am flying with a fixed wing aircraft on which are installed Holybro Pixhawk 4 running PX4 firmware and related sensors.
At mission completion, I open QGroundControl and download the log .ulg file. I can upload it on Flight Review without problem, but I need to manipulate those data using Matlab.

I can import the .ulg in Matlab, but the timestamps are not synced the one with the others, and also acquisition rates are not consistent inside each vector. I exploited built-in Matlab function “ulogreader” to import the .ulg file. Alternatively I used pyulog to convert .ulg file in .csv, then imported in Matlab. The result is the same.

I’d like to obtain data sampled in a synchronous way, meaning for example air data and GPS data are referred to the same timestamps (as for example happens for the .csv file delivered by telemetry). This is not the case of .ulg file, because even if data should share the same sampling rate, they have an inherent time shift, sampling rates change randomly and samples often lack in the vectors I’m post-processing.

Does anybody know how to solve these issues?

Thanks!!!

Hi,

You need to resample the topics to use the same timestamps. There are many different ways of doing that but if your sample rate is high enough usually a first order hold is enough for most applications.
Regarding the missing samples in the logfile, you can improve the situation by

  1. Use a good SD card, e.g. Sandisk Extreme microSD A1
  2. Increase the log buffer in the startup script
  3. Make sure not to log way more than you need using the param SDLOG_PROFILE

I don’t have a Matlab license anymore but here is a postprocessing GUI I did a couple of years ago, maybe useful