Re: Correcting Garmin errors/ was Re: [lkhc] UltraCycle pages
- Hi Franz,
Here is Garmin's SDK. The FIT file is well documented. The individual Java programs aren't. Their contents will match parts of the file format, if you want to try to reprogram some of the functions. One mod could be to calculate the median for average grade rather than the mean. That would be a stronger correlation to actual climbing difficulty than the mean. because a median is more resistant to outlying data points. In college I had about 40 credits of mathematical modeling and statistics, and from that, sometimes different experimental designs give different results that each can be argued are equally correct. The type 3 error is fascinating.
Wrt calculating road grades, if we start with your basis that the bump over one bike length is too short to consider a grade measurement at that single point to be accurate, then where to draw the long end is a paradox. The road cannot be assumed to be planar, but what is the maximum surface irregularity and change in actual grade and over what length of roadway compared to the rise of the measured run at that point that would not skew the calculation within the desired accuracy? How much variation from the previous and succeeding data points should be considered an erroneous measurement? Should acceptable variation within the previous and succeeding points affect the variation we allow a point to have and still consider it valid? The opening wall on Welch Creek is a good test for proposed criteria, going from zero to >15% in a few pedal strokes.
We also need to decide what to do with an erroneous value: discard it, take an average of the previous and following points, or try to fit a curve of the N points before and after.
To use the SDK for a basic conversion of the binary FIT file to a set of spreadseets,
Check that you have Java loaded on your machine.
Unzip the SDK cile contents all into one directory.
To convert a .FIT file to csv files, use the command:
java -jar FitCSVTool.jar -b testinfile.fit testoutfile.csv
Check for output stating:
.FIT CSV Tool 188.8.131.52
.FIT binary file testinfile.fit decoded to testoutfile*.csv files.dir
There will be four resultant csv files, *_sessions, *_records, *_laps, and *.
If you want to convert back to a .FIT file, remove all rows in the *.csv file that have "unknown" in them. The FIt documentation explains how unknowns get created.
The command to create FIT from CSV is:
java -jar FitCSVTool.jar -c testinfile.csv testoutfile.FIT
General usage of FitCSVTool is:
java -jar FitCSVTool.jar
.FIT CSV Tool 184.108.40.206
Usage: java -jar FitCSVTool.jar -b|-c <INPUT FILE> <OUTPUT FILE>
-b <FIT FILE> <CSV FILE> FIT binary to CSV.
-c <CSV FILE> <FIT FILE> CSV to FIT binary.
-t Enable file verification tests.
-d Enable debug output (also enables file verification tests).
Notes: CSVTool is fickle and will spew errors til you get a CSV file its happy with.
The "Garmin FIT File Format 0.8.pdf" has examples of the record and base types the CSV file will have.
The FIT file format.xls/TYPES tab lists the base types in rows thirteen to forty two. For instance, the base type for a Record entry is 20, and File_ID is 0, matching that field the example records in the file format.pdf.
Eventually I'll make an Excel template to import the CSV into, and a macro or filtering scheme to remove all the "unknowns" automatically.
Also, MTB trails have more irregularity so could be a good test of data validity, and MTBs with suspension travel will have more up and down changes front ot rear than any road bike on pavement will encounter. I have a profile of Kennedy Trail climbing 2000 feet in four miles, a raw measure steeper than either Welch of Bohlman. Maybe we can get a few riders together on a Whine and Dine night and MTB up Kennedy Trail with Garmins to see how consistent our numbers are.