I would like to create some plots in matlab referencing to my flightlogs and my rosbags.
So to get .csv files is quite easy and loading them in my matlab workspace is a piece of cake.
But to compare these different data-sets is challenging. The rosdata and the ulogdata have different timestamps - so I thought maybe I can compare the arming-state in ROS/mavros/state and start when arming to look at the ulogs (which start to auto record on arming) but the ulog time was in my case around 20.6sec while the ros time (starting with arming up to disarming) was only 19.013sec - so yeah I know it is not as bad but it is still not the same and while the record frequency is so diverging I have no better idea how to improve (reduce the time offset)…
Does anyone of you validate their data via matlab for specific checks/plots - and can help? Flight Review is nice but to get some more data plots would be quite useful.
Or does there any mavros command exist to trigger the ulog-generation? That would help for any new measurements, if I can create some kind of launch-file to start rosbag and the ulog simultaneously.
I had some spare time and decided to look a bit more precisely into the datasets. I wrote some matlab Code to read multiple csv-files and searched in the different topics for arming states - because these determine the start of my ulog.
First I thought about the state (mavros/state or ulog_vehicle_status) but these were a bit unreliable as I mentioned lest week.
On the other hand the rc-inputs should determine the arm-commands too and are recorded at a much faster frequency - to use these improved the duration difference a lot and it is now more consistent (0.3-0.45sec). So I will go on with some test plots …
Still this is just a workaround - it would be amazing to use the same timestamps nativly for px4 and ros.
Is there maybe some some kind of possibility to see the ulog_timestamps in ros? Then it could be achieved with some c++ Code… or to to sync the px4 with the timestamps of incoming measurements (like vision_pose)?
Below are some of my evaluated datasets - if anyone is interested:
duration_mavros duration_ulog duration_diff
Overall I feel like I did not too bad with my attempt to sync the datasets. I tracked the mavros/rc/in arm_channel and used a static Offset correction of (mavros.time-0.25)~approx~ulog.time.
As you can see below it is working quite well - of course if I zoom it Looks not as good as in the overview right now.
(The image shows the x-position of my drone according to the logfile and rosbag during Position mode)
Recently I wanted to have a look at the Motor Outputs and Keep track of them via mavros - which seems to be working while I track the mavros/rc/out Topic - But I would like to know About the value differences between the logfiles and the rosdata (see my current Topic - link at the end of this post …). I know Maybe the datasets are not perfectly alligned on the time axis but even though the y-values of the Graphs = Motor Outputs are not the same.
Anything new about correctly syncing rosbag and ulog?
What is the issue for the value differences? data_conversion? noise? And can they be improved?
If the internal uOrb Topic is saved in the uLog and also transferred via mavlink to mavros/rc/out is there a known delay or do I need the evaluate this on my own by tracking a Signal - and which one would you recommend? An arm command via an offboard command and calc the difference between ros time stamp of the start command and the ros timestamp of Motor value changes?