Custom activity streams

@Dr_Robert_D_Saunders Any feedback on eGear data field?

@Inigo_Tolosa Well, on the basis of a single 5 mile test ride, it installed and worked well without any problems! Excellent.

Edit - I’m happy with the Gear Combo field provided by eTap, and I was most interested in having the gear ratio in the fit file.

1 Like

Thanks for this David, I did spend some time and parsed this data in a custom chart, got a very crude version of what I was after. A great system you have built. Thanks.

1 Like

That’s great David. If I can remember correctly this would (eventually) also make it possible to show Di2 (and other electronic shifters) gear changes. I think there’s still something that needs to happen before that can work though.

This is a small part from di2 gear shifting in the fit file:
event 694 row(s)

timestamp(s) data field 17 field 18 event event_type event_group radar_threat_level_max radar_threat_count radar_threat_avg_approach_speed(m/s) radar_threat_max_approach_speed(m/s)
1058447087 838999554 - - rear_gear_change marker - - - - -
1058447087 0 - - rider_position_change marker - - - - -
1058447088 839000577 - - rear_gear_change marker - - - - -
1058447090 838999554 - - rear_gear_change marker - - - - -
1058447090 838998787 - - rear_gear_change marker - - - - -
1058447093 570497795 - - front_gear_change marker - - - - -
1058447093 570497284 - - rear_gear_change marker - - - - -
1058447093 570496773 - - rear_gear_change marker - - - - -
1058447093 3 - - rider_position_change marker - - - - -
1058447094 0 - - rider_position_change marker - - - - -
1058447357 570496262 - - rear_gear_change marker - - - - -
1058447357 570495751 - - rear_gear_change marker - - - - -
1058447357 570495240 - - rear_gear_change marker - - - - -
1058447357 570494729 - - rear_gear_change marker - - - - -
1058447605 570495751 - - rear_gear_change marker - - - - -
1058447605 838996743 - - front_gear_change marker - - - - -
1058447608 838997254 - - rear_gear_change marker - - - - -
1058447609 838998276 - - rear_gear_change marker - - - - -
1058447609 838998787 - - rear_gear_change marker - - - - -
1058447756 838999554 - - rear_gear_change marker - - - - -
1058447759 838998787 - - rear_gear_change marker - - - - -
1058447764 838998276 - - rear_gear_change marker - - - - -
1058447779 838998787 - - rear_gear_change marker - - - - -
1058447791 838999554 - - rear_gear_change marker - - - - -

In the data field the shift is encoded, but I can’t find it anymore. I think it was in the FIT file SDK from Garmin somewhere.

How is this data being used? To see which cog is being used the most for maintenance?

Really wondering.

I’m mostly interested when analysing time trials, relating gear ratio to grade and wind resistance. I am a bit of a low gear grinder when riding time trials, something I’d like to change (but I am getting a bit long in the tooth to change much!).

1 Like

Thx Robert. This did the trick for getting de DI2 gear values indeed. The eGear+ app writes it into the FIT file, after which we can plot it using the custom streams (the currFrontGearSize and currRearGearSize fields).

Does anyone know if you can also plot the fields which have the epic name of "Field " ?
I’ve seen the stamina and potential stamina values of the Garmin devices that support this metric seem to be “Field 138” and “Field 137”. However these fields aren’t shown under the Record Field pulldown menu, and if you just type “Field 138” or just “138” there, there isn’t anything found.

How does it work from wahoo, I have the groupset connected and can change pages from the hoods but can’t find any mention of gears in the fit file.

1 Like

It is possible to dig these out now and create a stream (@Wesley_Stocker ):

1 Like

I’m also wondering how I can get the gears from a Wahoo .fit file. I see that there are events “rear_gear_change” , like this:

You need to try find out how that data field is encoded. Then you can probably generate a custom activity stream for the current gear .

Getting there…

Only had a little play but the opportunities here are amazing

{
  for (let m of icu.fit.event) {
    data.setAt(m.timestamp.value, m. rear_gear_num?.value[0])
  }
}

Questions

  1. What’s the easiest way to forward fill the nulls? i.e. it only shows changes but would like the line to continue until the next change.
  2. For multiple changes in a second does it add them? Whats’ the best way to make it either the average or just the first or last?

Could someone help me with this too please?

Code
{
 for (let m of icu.fit.device_info) {
   for (j of m){
    if (j.value == 'ELEMNT BOLT' && m.charge?.value !== undefined && m. hardware_version?.value !== undefined){
      console.log(m.timestamp.value, m.charge?.value)
      data.setAt(m.timestamp.value, m.charge?.value)
      }
    }
  }
}
Log
1062059933 100
1062060111 99
1062060471 98
1062061492 97
1062061552 96
1062062573 95
1062062633 94
1062063173 93
1062063713 92
1062064254 91
1062064795 90
1062065875 89
1062065935 88
1062066837 87
1062066897 86
1062067678 85
1062068158 84
1062068638 83
1062068698 82
1062069779 81
1062070379 80
1062070980 79
1062071040 78
1062071820 77
1062071880 76
1062072781 75
1062072841 74
1062073201 73
1062073802 72
1062074762 71
1062074822 70
1062075663 69
Error
Validation failed: Invalid stream type [null]

There aren’t any nulls so not sure what this means.

You should probably just keep the most recent non-null value in a variable and use that when you don’t get a new value. Something like this:

{
  let last = null
  for (let m of icu.fit.event) {
    let v = m.rear_gear_num?.value[0];
    if (v) last = v
    else v = last
    data.setAt(m.timestamp.value, v)
  }
}

You should probably just keep the last value.

You need to specify the name of your stream and its code before you can test scripts. I should add validation for that.

Ah, didn’t see someone was already quite far ahead with this. Posted my attempt over in the Javascript streams thread: Custom activity streams with Javascript - #15 by Jonas_H

2 Likes

Your solution works for my wahoo e-tap files…
Had to make sure gearing setup was correct in the wahoo setup for that e-tap bike - then numbers are all good :slight_smile:

2 Likes

I hope I can clearly articulate this question… I’m trying to build charts for data that is recorded on my athlete’s watch, but does not appear to be in Intervals. I expected that the available chart data attributes would be what’s come across in the file, but I can’t seem to find what I’m looking for. For instance Ground Contact Time (GCT) or Vertical Oscillation… assuming, for sake of my question, that some Garmin fields are NOT available is there a way for me to create a custom data channel? I know in WKO5 I can inspect the data stream to see available fields and then I can report on them (see below). How do I do this in Intervals?

@app4g Thanks for moving this, I did look here. Perhaps I’m missing it, but fundamentally I’m just trying to figure out how I determine what the channels are. Do I have to look into the fit file itself to see how it’s referenced in the file?

you can refer to the 1st post from David.
on a completed activity
Charts → Custom Streams → Add Stream

then the Record Dropdown

which then enables me to create my own chart using the Data I’ve written into the FIT file from my app.

4 Likes

OK now I feel silly - I’ve looked past that in the UI at least 92 times. LOL.

Much appreciation.

2 Likes