Extracting data from tlog files for plotting in Excel

I wanted to analyze some data from a tlog file and figured that Excel would be the most flexible  way so I created a little utility to extract the data I was interested in and save it as a comma separated value (CSV) file. Each selected parameter is in a separate column, and Excel can open  the csv directly.

Note that it can't open the tlog file directly. You must use the Mission Planner to convert it to txt format. so:
1. From the APM Mission Planner Flight Data page select "Telemetry Logs", then "Tlog > Kml or Graph", then "Convert to Text". 

2. Select the tlog file you are interested in, and the Mission Planner will create a txt file in its log folder. 

3. Open the txt file in this program and it will parse the file and list the available parameters in the left tree control. Double click on the parameters you are interested in and they will be selected and displayed in the right tree control. If you want to remove a parameter from the selected list, double click it.

4."Save As" and provide an output file name. This will produce the csv file that you can open in Excel and plot as desired. The file will look like this, where each row was produced from one packet in the input file that contained at least one of the selected parameters.

If you want to re-use the list of parameters you can save and re-load them from the "configure" menu. These are simple text files you can edit directly if you like.

I am not familiar with the deloyment process for C# programs, so I have placed the entire project folder here

Views: 17298

Comment by Andrew Fernie on December 21, 2015 at 11:48am

There may be others, but I found these three time parameters:

1. mavlink_system_time_t.time_boot_ms

2. mavlink_gps_raw_int_t.time_usec

3. mavlink_global_position_int_t.time_boot_ms

I checked one of my own tlog files and the three values looked consistent to me, although the middle one (GPS) is scaled in microseconds, not milliseconds. Note that this one is is valid only once the GPS has a lock, and that while it is scaled in microseconds it comes from a millisecond value that was multiplied by 1000, so the last three digits are always zero.

When I last looked at this a couple of years ago even the value being returned in the GPS field was being generated based on the "millis()" function which gives the number of milliseconds system since the system was booted rather than truly being GPS time. So, at the end of the day, the three time values above have the same source - all are time since the system was booted, with two being scalled in milliseconds and one in microseconds..

 mavlink_system_time_t.time_boot_ms  mavlink_gps_raw_int_t.time_usec  mavlink_gps_raw_int_t.satellites_visible  mavlink_global_position_int_t.time_boot_ms
Comment by Rizki Wahyu Pratama on December 21, 2015 at 1:57pm

oke, thanks for your information andrew. 

Comment by Jeff Zirpoli on August 22, 2017 at 12:36pm




when using the tlog extractor program to extract mission data from Mission Planner the default date and time columns extracted by tlog extractor program are 4 seconds behind the mavlink_system_time_t.time_unix_usec. 


why is there a discrepancy in the time?

where does the default time and date data from the tlog extractor come from? what is the source? GPStime? Universal Coordinate time? Time from the internet (which is usually Universal Coordinated time).


thanks in advance. 


Jeff Z


You need to be a member of DIY Drones to add comments!

Join DIY Drones


Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2018   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service