Powered by Drupal

Hacking Garmin Training Center TCX Files

In the review I wrote, you found that I really like my Garmin Forerunner 305. I also told you that I didn't like Garmin Training Center very much.

Training Center has a few good features and at least one GREAT feature. That great feature is its data export. You see, you can export data out of Training Center as XML- text files that you can easily read so that you can perform your own analysis on the data within them. Many other devices will only give you horrible binary files or crippled summary files.

For example, I wanted to know my overall speed for laps 2,3, and 4 of my run. I don't want to include laps 1 (warmup) and I don't want to include lap 5 (cooldown), Another example is that I want to know the pace at the start of the tempo part of my tempo run and the pace at the end of the tempo part of my tempo run.

The first thing I found when I started to work with the TCX files that Training Center generates is that they can be BIG. They're big because they include everything - position, heart rate, speed, everything. This stuff is kept in a construct called a Trackpoint. Here's an example:

  <HeartRateBpm xsi:type="HeartRateInBeatsPerMinute_t">

When you don't need them, you can reduce the size of the file by eliminating all of those Trackpoints. I do that with an XML parser and save the pruned file.

I modelled the data in the pruned file and created a set of Perl modules that hold the information on Activities, Laps, and Activity Types. Then, I create tables that look like this:

     Sport|                     Type| Date of activity|    Km|     Time| Speed|  Hbts| AvHbt|    Temp|           Wind|                Desc|  Humidity|   Humidex| Windchill|
Running| 10k speed run| 100203-19:56:02| 10.08| 00:51:21| 11.77| 8884| 172|-17.8 °C| 6 km/h E| Fog| 77| | -22|
Running| Brainsport Clinic Run| 100201-18:15:50| 9.64| 01:02:33| 9.24| 9699| 155|-13.7 °C| 15 km/h S| Snow| 83| | -21|
Running| Saturday Triathlon| 100130-15:14:29| 10.15| 00:54:11| 11.24| 9098| 167|-12.0 °C| 15 km/h NNE| Mostly Cloudy| 78| | -19|
Running| Irene Howe run| 100128-12:08:55| 6.72| 00:46:08| 8.73| 6439| 139|-19.1 °C| 7 km/h SSE| Cloudy| 76| | -25|
Running| Big Mac| 100121-21:11:16| 6.27| 00:42:37| 8.83| 6306| 147| -4.4 °C| 13 km/h ESE| Snow Grains,Fog| 95| | -9|

I put special codes into the 'Notes' section of activities in Training Center. These codes are things like:

Activity Type: 10k speed run
Clothing: Sugoi Firewall, MEC Roubaix tights, touque, facemask
Temperature: Comfortable. A bit cold on the legs.
Feelings: Great Run

These comments end up in the XML and my parsing system pulls that information. Some of it ends up in the table above and other stuff (like the Clothing and Temperature information) goes into a different table.

For laps that I don't want included in the summary table, I put a special code in the 'Notes' section for the individual lap:

Ignore this lap.

I love this system. It's great. Contact me if you want to talk about it - I love to talk nerd.

© 2012 Chad Matsalla.. Drupal theme by Kiwi Themes.