Examples for encoding strength training activity files

I do the same basic strength (maintenance) workout a couple of times/week.  I use an Edge on bike rides and a Forerunner on runs but I have no device for strength workouts.

Entering these activities manually in Garmin Connect is a pain and (rather inexplicably) there appears to be no "duplicate/copy/clone this activity" capability.  I probably couldn't stomach it even if I was only adding new workouts, but I have years of journaled strength training workouts that I'd like to add to the activities that I have already uploaded to GC from my Edge and Forerunner so that I can see the whole training picture in one place.

I downloaded the FIT SDK and cobbled together a little Java app that generates (encodes) a FIT activity file that simulates my basic maintenance workout.  The activity file uploads to GC successfully, but there are some rough edges that I need help with.  For example:

  1. In GC, in the detailed view of the activity from my generated/uploaded FIT activity file, the "event type" under the event name is always "uncategorized".  I haven't figured out how to set this value.  I've tried different ActivityMesg.setType(Activity.FOO) values and generating a SportMesg with msg.setSport(Sport.TRAINING) and msg.setSubSport(SubSport.STRENGTH_TRAINING), but no luck so far.
  2. In the same detailed view, each "set" in the uploaded activity (eg: 15 sit-ups) displays the expected Exercise Name*, Time, Reps and Weight** values, but the Rest time value is always zero no matter what I've tried.  I've tried setMesg.setDuration(elapsedTime  - 15) so that duration < elapsed time, setMesg.setSetType((short) SetType.REST), RecordMesgs with corresponding workoutStepMesg.setIntensity(Intensity.REST), generating (and NOT generating) EventMesgs*** to simulate lap button start/stop events and probably several other ideas with no luck so far.
    1. * Many of the exercise names in GC (available in pull-down lists in the manual activity editor) have no direct match to ExerciseCategory and FooExerciseName constants.
    2. ** I added a UserProfileMesg to the activity file, but the "bodyweight" exercises don't use the value in it.  Adding this message had no discernible effect at all.
    3. *** EventMesgs have no discernible effect either - or at least not one that I've been able to observe.  Is that expected?
  3. GC won't display the "muscles used" visual unless I edit the activity in GC.  When I click to edit, the editor zeroes all of the weight values.  I assuming that I haven't encoded something quite right, but I'm at a loss.

I don't have a device to which GC will export a manually-entered activity and the .FIT or .TCX files that it will export for such an activity are empty, so I can't generate my own example file to reverse-engineer.

I'm really hoping there's either some documentation that I haven't found that will help with my use case for the FIT SDK or maybe an example strength training FIT activity file that someone can share.

I'm willing share the code if needed.  It's nothing special, but I'd have to clean it up first because it's rife with the artifacts of trying out so many different combinations...

Thanks.

-Jon

Top Replies

  • In GC, in the detailed view of the activity from my generated/uploaded FIT activity file, the "event type" under the event name is always "uncategorized".  I haven't figured…

All Replies

  • In GC, in the detailed view of the activity from my generated/uploaded FIT activity file, the "event type" under the event name is always "uncategorized".  I haven't figured out how to set this value

    I've had the same issue, not sure how to fix it either.

    the Rest time value is always zero

    To properly encode rest time you need to create an additional SetMesg of type REST immediately after a normal SetMesg. That worked for me.

    GC won't display the "muscles used" visual unless I edit the activity in GC.

    I don't have that issue, but I have no idea what would cause it without looking at some code.

    * Many of the exercise names in GC (available in pull-down lists in the manual activity editor) have no direct match to ExerciseCategory and FooExerciseName constants.

    True that, if somebody can provide a full list, that'd be great. Otherwise a lot of trial and error with some random integer codes might work. Maybe just generating a dummy workout with sets for all possible integer codes as category/subcategory combinations.

    *** EventMesgs have no discernible effect

    I think you're right, those don't play a role in a strength workout.

    If you're still doing that project of yours, I would be interested in sharing some knowledge. Feel free to pm me, I can send you a link to my repo.

  • Would love some assistance from Garmin (like providing a full example). 

  • Has anyone managed to encode strength training? The SDK cookbook contains no information on how to do it.

  • +1 Could really use example documentation on correctly encoding Strength activities.

  • My issue was with my Epix Pro watch not displaying custom workout step text.  After doing some detective work, I have been able to fix this and encode strength training workouts.   As mentioned in a previous post (https://forums.garmin.com/developer/fit-sdk/f/discussion/357803/custom-workout-fit-file---step-names-not-showing), I found that an extra message type, not mentioned in Garmin's docs, is required to display custom step names.  The Exercise Title message type is a lookup table for custom exercise step text.  The message info is in Profile.xlsx.  I found that the key to making custom text work is that for each step, you must use one of Garmin's exercise names such as SINGLE_ARM_DUMBBELL_BENCH_PRESS and have your code look up the int in the BenchPressExerciseName enum (it will help later if you match the Garmin exercise name to your actual step as best you can).   The Exercise Title message type will contain the mapping of that int to your custom step text.  I also use the exercise name to look up the Exercise category int, but I'm not sure if that's needed.

     So, I created an Excel file with all required data for the file ID, workout, work steps (as documented) and a list of the exercise steps with my custom step name, Garmin exercise name constant, and the other required data elements.  This works well.  I get the "muscles used" graphic, but I have to make sure that the exercise that I chose to match up with my custom exercise name is reasonably close to my actual exercise step.

     Re: event type in Connect, I also get "uncategorized" even though I included the sport and subsport in the workout message.  Not sure what is needed to get the watch to get that right in the activity file.