Type of sport in activity recording session

Hello,

I'm the creator of the Badminon Score Tracker app. I am now trying to associate badminton matches to Garmin Connect activities.

I've created an activity recording session using:
session = Recording.createSession({:sport => Recording.SPORT_GENERIC, :subSport => Recording.SUB_SPORT_MATCH, :name => "Badminton"});

Full code is available on Github if needed.

At the end of a match, I show some statistics about the match such as max heart rate or elapsed distance. This works well within the simulator but not with my real Fenix 3. It never displays anything. It seems the activity info object is empty.

Then I discovered that if I change the type of sport:
session = Recording.createSession({:sport => Recording.SPORT_RUNNING, :subSport => Recording.SUB_SPORT_MATCH, :name => "Badminton"});


Everything is working fine. My stats view displays good data and the resulting activity is nicely displayed on Garmin Connect website.

First of all, it would be nice if the simulator and the watches behave the same. That's not the first time I encounter this problem.

Secondly, is this the normal behavior? Why does changing the type of sport changes the type of data that are recorded? What I am supposed to use if I want to display info such as heart rate or elapsed distance in my badminton activities? Is there a place where I can find what kind of data are recorded for each type of sport?

Thanks.
  • It seems to me that you should use the :sport and :subSport fields that match the sport that you're implementing the application for. If you're writing a running, cycling, or swimming application, then the watch can record some data for you automatically. I don't think Garmin goes out of their way to indicate which bits are going to be recorded anywhere. It really depends on the device, the firmware version, paired devices, their firmware versions, and then the activity type you are using so the resulting matrix would be huge.

    If you want to implement an badminton app, you can do that. If you want to capture things to the .fit file and display them in Garmin Connect, you can use the FitContributor APIs (see Session.createField()). There are a few details about this functionality in the Programmer's Guide that is included with the ConnectIQ SDK.

    Travis
  • Could it be the data you want is in the .fit, but what GC displays is based on the type? Have you tried changing "other" to say, "walking" in GC to see if the data is displayed differently in GC?

    And as Travis said, FitContributor will allow you to do other things.
  • I already use FitContributor to store the score of each player but I think that's not the point.

    @TRAVIS.VITEK The problem is "Badminton" is not available in Garmin SDK. The best match is "Tennis". But even when I use "Tennis" (I tried), heart rate is not recorded. I don't understand why the type of sport has an impact on what is recorded. Why would one like to have heart rate for "Running" and not for "Tennis"? In your last sentence, are you suggesting that I use the sensor API to record heart rate manually and that I use FitContributor to store these data myself?

    @jim_m_58 It's not just Garmin Connect. Even on the watch, I don't have any data if I don't choose some specific sports such as "Running".

    I really don't understand why it is so complicated. Ideally, I should be able to create a session of any type, enabling or not what kind of data I need (heart rate, cadence, elevation or elapsed distance). The kind of session should just be used to improve display of activities on Garmin Connect. And if I want something really specific, I can use the Sensor API to do whatever I need with sensors data.

    Maybe it is because the watch is able to interpret data (I don't know how they detect swim stroke or run cadence, for example), but in this case, I think it would be better if these data are exposed using the sensor API.

    Finally here are activities that I generated yesterday using different type of sports:

  • I don't understand why the type of sport has an impact on what is recorded.

    Would you expect elevation, pace, position, stride length, cadence, vertical ratio, ground contact time, distance, ... to be recorded for a badminton match or for a weight lifting session? I don't think so, and this is a good reason to not record something just because the data is available.

    I do think it makes sense for the API to somehow allow applications to register for the different data metrics. That said, I believe you will get heart rate data in the .fit file if you enable the sensor (by calling Sensor.setEnabledSensors([ Sensor.SENSOR_HEARTRATE ])), but it has been a while since I played with this bit of functionality.

    Why would one like to have heart rate for "Running" and not for "Tennis"?

    I really don't know much about tennis or badminton. I'm assuming that heart rate data for running captured automatically because we know a lot more about how to train with heart rate for running and cycling than with either of those sports.

    In your last sentence, are you suggesting that I use the sensor API to record heart rate manually and that I use FitContributor to store these data myself?

    Yes. It isn't perfect, but it does allow you to gather exactly the bits of data that you'd like. I'd do this if explicitly enabling the sensor doesn't work (as suggested above).
  • Thank you TRAVIS.VITEK for your answer.

    The point is there is more type of sports in this world than in the Connect IQ ActivityRecording class. And you never know what to expect. Maybe someone will invent a new sport called "badminton in high altitude" and you will need to record elevation (at least once). So it should really be up to the developer to choose what he wants to record (elapsed distance seems useful for badminton, as well as stride length if correctly measured). The users of my app want more data.

    I tried to manually enable the heart rate sensor as you described but it didn't work. It really seems the type of sport used to create the session drives what is recorded.

    I hope someone from the Garmin team will browse this thread to confirm what has been said before I setup the solution you suggest.
  • The point is there is more type of sports in this world than in the Connect IQ ActivityRecording class.

    Certainly. The problem is that the FIT file format enumerates sports that are supported, and that list incomplete (of course it is, as the number of possible sports are infinite).

    elapsed distance seems useful for badminton, as well as stride length if correctly measured

    It may seem useful, but neither would not be accurate given the input options that are currently available. Distance derived from GPS is not good when your direction and speed aren't reasonably consistent; quick changes in direction or not moving more than a few feet every second or so will cause problems. Distance derived from cadence is not accurate when you have a consistent stride length...

    Travis
  • Up.

    I really wish to have an answer from the Garmin team.
  • Up.

    I really wish to have an answer from the Garmin team.


    They do not really care. I have the vivoactive hr. There is an default cycling activity. When I made an activity with it, it is correctly synced to connect as cycling. As expected.
    But you can create custom activity on the vivoactive hr. For example you can add activity, chosse cycling and then road or hill which is for me suggerating road bike or mountain bike.
    But if the activity is synced it is also synced as gerneric cycling. In Connect IQ and FIT API there is defined sub_sport road and sub_sport mtb.
    I have contact to a connect iq developer. He added in his app cycling app pro the ability to explicit choose the sub sport type for road and mtb. But the vivoactive generates a fit file with sub_sport set to 0 instead of 7 for road bike for example.
    So on sync with garmin connect the activity is synced as generic cycling.
    I wrote to garmin support and to garmin developers several times, but every site is saying the other side is responsible and so no solution at all.

    API gives the ability to use other sub sports in connect iq apps but fit file ignores them. For me a severe bug and for many road bikers or mountain bikers, too.
    More severe as garmin itsself offers the ability to create a road bike activity but than handles it as a normal cycling activity.
  • @FBOEDECKER I saw your thread on the same topic. It seems the Garmin team is not aware of the problem.

    How do you browse into the content of a fit file?
  • @FBOEDECKER I saw your thread on the same topic. It seems the Garmin team is not aware of the problem.

    How do you browse into the content of a fit file?


    In the FITSDK there is FitCSVTool.jar which can convert fit to csv and vice-versa. Google for FitSDKRelease_20.03.00