Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Correct Fit file?

Avatar
Rank

Total Posts: 6

Joined 0

PM

Dear forum users,

I am producing an ANT+ android application called BikeSense, that reads all ANT+ devices and presents the data in graphs and handy values [img size=800]http://www.thisisant.com/images/fbfiles/images/bikesense_on_xperia_active-72d970579a4d79c425b93e66edf5dcf2.JPG[/img] . It is close to its release date. The app produces CSV and FIT files when the user closes the application. The FitCSVTool converts the FIT files perfectly. I can read the FIT files with the OSX application Ascent and Garmins Training Center (missing the Heart rate however). Using Trailrunner my files fail completely, while as the files from my Garmin Edge 800 are read fine.
The Garmin files after being converted to CSV contain a lot of "unknown" fields though.

The question is: What am I doing wrong in my FIT files [file name=bikesense_fit_file.zip size=145465]http://www.thisisant.com/images/fbfiles/files/bikesense_fit_file.zip[/file]. Is it in the "unknown" fields of the Garmin files? Or am I missing the point somewhere?

Regards

Peter Bruinink
Plusot Biketech      
RankRankRankRank

Total Posts: 122

Joined 2010-10-25

PM

I just tried loading your file up into my app and failed. Looking at things you look to have activity data but I see no activity definition at the start of the file. That is what has caused my app trouble. I at least have a bug to fix stoping it crashing so badely with bad data....

I have attached a similar set of files to you generated from my app.

Unfortunalty I am fairly resigned to giving up on FIT as the files I generate only look to load into about 50% of the software / websites I have tried and from the error messages where I get them I think the loading software is just too hard coded to Garmin specific style rather than the spec and the style generated by the Java SDK.

I am of course interested in anything I can do to improve the situation hence the interest in your question. [file name=IpBike_fit.zip size=441215]http://www.thisisant.com/images/fbfiles/files/IpBike_fit.zip[/file]      
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

The FIT SDK download available here: http://www.thisisant.com/pages/developer-zone/fit-sdk contains a PDF file that specifies the messages that should be contained in several types of FIT files + mandatory sequence of message types, comprising activity FIT files. You should follow these guidelines to ensure that your .FIT files are recognized by FIT aware software.

Cheers,
OMB      
RankRankRankRank

Total Posts: 122

Joined 2010-10-25

PM

Looking at Peters file he has the lap, session and activity information at the end of the file and in that order rather than activity, session then lap. I don't know if this is valid but from the diagram in the doc I would not of expected it. If writing the file in real time I can understand why you do it like this though. I don't have a garmin so do not have ready access to see what there files look like.

I have tweaked my App so I can get the location information out of peters file, which is all I support so you can follow the route. lookce like nice terain Peter....

I did want to try my generated FIT files with your plugin OMB, unfortunatly I fail at the first hurdle as could not work out how to make it accept a file, as it wants to talk directly to a Garmin device which is not good for anyone else wanting to write a FIT file... it's this sort of issue rather than the file format itself that is the real difficulty.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Hi Ifor,

Thanks for your reply.

I had a look at your files. They look a lot cleaner, better and more logical than the Garmin ones do. I mimicked the Garmin ones, as those files were accepted by TrailRunner.

I write the activity and session messages at the end of the file, as I write the FIT files while the activity is in process. Garmin does exactly the same. From the FIT documentation it looks as though it is allowed to do so. See the 5th remark taken from the documentation (FIT File types ANT+ Rev 1.3):

* An activity file contains one activity message.
* Multiple Session messages may be recorded for a single activity.
* Multiple Laps may be recorded for a single session.
* Multiple Lengths may be recorded for a single lap.
* The activity, session, lap, lengths summary messages may be grouped together at the start of the file (Figure 9-2) or interleaved with record, event, hrv messages (Figure 9-1). In either case these summary messages must be in chronological order.
* Record, length and hrv messages must be in chronological order.

I do have to check the timestamp of my activity and session messages to verify chronological order.

Best regards

Peter      
Avatar
Rank

Total Posts: 6

Joined 0

PM

Hi OMB,

Thanks for your reply.

I indeed missed reading the bit on Activity files in chapter 9. I tried to mimic the working Garmin files first.
But the documentation suggests you may place the Activity / Session in any place in the file, as long as it is in chronological order. See:

ï‚· An activity file contains one activity message.
ï‚· Multiple Session messages may be recorded for a single activity.
ï‚· Multiple Laps may be recorded for a single session.
ï‚· Multiple Lengths may be recorded for a single lap.
ï‚· The activity, session, lap, lengths summary messages may be grouped together at the start of the file (Figure 9-2) or interleaved with record, event, hrv messages (Figure 9-1). In either case these summary messages must be in chronological order.
ï‚· Record, length and hrv messages must be in chronological order.

I will have a close look at my files with the documentation again though.

Thanks

Peter      
RankRankRankRank

Total Posts: 116

Joined 2008-11-21

PM

Activity files will continue to be better documented... we understand these are complicated files and want to do all we can to ensure interoperability of files between different devices, apps etc from all manufacturers/developers.

I just wanted to add that activity, session, lap, length (new and mostly for swimming applications) and record files can be interleaved as desired... the most important "rule" is that each message type is in chrono order... so records appear in chrono order with respect to each other, laps appear in chrono order with respect to each other, etc..

currently documentation states that an activity message is required; however, it has come to our attention that some devices are not following this and we may loosen this requirement... stay tuned, we are hoping to have another release with updated documentation at the end of the month...

Please continue to notify us anywhere you find our documentation unclear/lacking      
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

ifor wrote:
I did want to try my generated FIT files with your plugin OMB, unfortunatly I fail at the first hurdle as could not work out how to make it accept a file, as it wants to talk directly to a Garmin device which is not good for anyone else wanting to write a FIT file... it's this sort of issue rather than the file format itself that is the real difficulty.

Hi ifor,
are you talking about my "Garmin FIT Devices" plugin for SportTracks?
It DOES accept .FIT files as input. Simply import files (and not from device) in SportTracks and select your .FIT file. SportTracks will let you select the importer, either ST's standard import or the plugin.
The plugin should accept .FIT files regardless of message order. If I remember right, I even reorder (record) messages according to their time stamps. So the plugin should be quite tolerant.
Cheers,
OMB      
RankRankRankRank

Total Posts: 122

Joined 2010-10-25

PM

I clearly did not see that when I was trying before. The default importer gives ma an error "Missing Compressed header start time" which as I am fairly sure the Java SDK is not generating compressed headers is a bit anoying.

I have just re-installed SportsTracks and the pluging but unfortunatly I am out of time on the trail period so can not try it out now...

Ifor

old_man_biking wrote:
Hi ifor,
are you talking about my "Garmin FIT Devices" plugin for SportTracks?
It DOES accept .FIT files as input. Simply import files (and not from device) in SportTracks and select your .FIT file. SportTracks will let you select the importer, either ST's standard import or the plugin.
The plugin should accept .FIT files regardless of message order. If I remember right, I even reorder (record) messages according to their time stamps. So the plugin should be quite tolerant.
Cheers,
OMB      
RankRankRankRank

Total Posts: 116

Joined 2008-11-21

PM

if a file uses compressed timestamp headers... there must always be an initial message with a 4 byte timestamp to set the initial time...

so - there could be a record or event message with a 4 byte timestamp... the next record could use a compressed timestamp header... the decoder will look at the compressed timestamp header and can calculate a full 4 byte timestamp based on the offset in the header and the previous 4 byte timestamp... this 4 byte value shall be stored... the next record with compressed header offset will use this newer 4 byte timestamp to calc its own timestamp... and this process repeats for each compressed header.

the idea of compressed headers is that you can always generate a new, complete 4 byte timestamp header based on the last known 4 byte timestamp and the current time offset in the header... as such, there must always be an initial 4 byte timestamp in the file.      
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

ifor wrote:
...
I have just re-installed SportsTracks and the pluging but unfortunatly I am out of time on the trail period so can not try it out now...

Ifor

Of course you can, you just have to buy it. Which is a cheap investment taking into account the time that others including me "invest" to try and help you B)      
RankRankRankRank

Total Posts: 122

Joined 2010-10-25

PM

Plugin installed and used via the import option in SportsTracks.

It's one up on the standard importer in that I don't get the stupid message about compressed header start times. I get the activity summary information but none of the record information looks to be getting imported, no route and no HR data etc. No obvious error but I am not familiar enough with SportsTrack to know if there are eny logs to look at. Data comes in OK if I take the .tcx option.      
Rank

Total Posts: 13

Joined 0

PM

Did somebody already found a solution? I've got the same problem. While Garmin Connect, Strava and Golden Cheetah are parsing my Fit files without any problem.      
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

There are some comprehensive and helpful answers to your parallel post in the SportTracks forum at http://zonefivesoftware.com/sporttracks/forums/viewtopic.php?f=11&t=12989#p72897 .