BikePower not working with FIT playback?

Hi,

I am new to Connect IQ programming. I am trying to implement a data field for bike power.

I started with the DataField example generated by the VS Code Monkey C extension and implemented a very simple field with the power data from Activity.Info that gets provided in compute(). I am also trying to access the values provided by BikePower (and later maybe BikePowerListener), but that doesn't seem to work.

I exported a FIT file from my last ride that was recorded on a Fenix 6 with Rally RK200 power meter pedals connected.

When I play back the FIT file in the simulator, I can see that the power value in Activity.Info gets updated, but I don't get any data out of BikePower. What am I missing?

Here is the relevant code for reference:

class PowerView extends WatchUi.DataField {

    hidden var mValue as Numeric;
    hidden var listener as AntPlus.BikePowerListener;
    hidden var bikePower as AntPlus.BikePower;

    function initialize() {
        DataField.initialize();
        mValue = 0.0f;
        listener = new AntPlus.BikePowerListener();
        bikePower = new AntPlus.BikePower(listener);
    }

    function compute(info as Activity.Info) as Void {
        if(info.currentPower != null) {
            System.println("info.currentPower: " + info.currentPower);
            System.println("bikePower.calculatedPower: " + bikePower.getCalculatedPower());
            mValue = info.currentPower as Number;
        } else {
            mValue = 0.0f;
        }
    }
}

  • First thing I'd try is building a sideload for your device, and include a log files in the logs folder named <YourAppName>.txt and see what you get.  See https://forums.garmin.com/developer/connect-iq/w/wiki/4/new-developer-faq

    To use the sim, you may need an ANT stick and the real sensor.

  • Thanks for your reply, jim_m_58. It's not exactly what I was hoping for, but I will give the side-loading a try.

  • Some things are easier if you just use the real devices and not the sim.  With the sim, you may need an ANT stick ($50 from Garmin) and then use the actual sensors, so your bike would need to be close to your pc/mac.

  • I see. On the other hand I would like to avoid using my fenix for development purposes, but I can surely use it for some first tests. Later on I could get a used Garmin device and use that for development.

  • I've used my actual Garmin device for testing since I started with CIQ and never had an issue, and used a number of different ones over the years.  You can always just remove the sideload if you do, and in the case of a data field, just remove it from the data screen.

  • I have made some progress and now have a data field showing all BikePower data in real-time. What seems missing is wheelDistance and wheelSpeed. They never get updated in my BikePowerListener. If I instead retrieve them directly from the bikePower object, wheelDistance returns a weird large number and wheelSpeed stays 0.

    Is this expected? Is it possible to retrieve this type of data with just the RK 200s on an indoor bike?

  • If you're connecting to the BikePower directly via ANT+, you would need to calculate the speed and distance on your own. (distance can be calc using wheel circumference and rpm)

    refer to the following sections  of the ANT+  bicycle power device profile

    1. 13.6.1  Calculating Cadence

    2. 9.6 Speed and Distance Computations

  • Thanks for your pointers, Nikeow. I was able to find the BikePower ANT+ profile and studied it.

    The RK200 measures RPM at the crank, not at the wheel. Therefore I can not use it in the calculations mentioned in 9.6.

    It's just not possible to calculate a distance with the data the RK200 provides alone.

  • okay. Got it.

    So, based on your postings subject title, you're trying to replay the FIT data. So, there really are 2 components in this.

    1) replaying the FIT file from an outdoor/indoor workout that contains GPS data, speed, cadence, bikepower

    2) connecting the Rally PM to your CIQ datafield / app via direct ANT+ communication.

    for #1, you would need to do some decoding of the FIT file and then somehow inject and simulate this to feed into your ANT+ (not sure how you're going to do this, but, you could take a look at the ANT+ simulator - just a thought)

    for #2, the Pedal Power PM would only be able to supply you w/ Cadence and Power, So, yes, you won't get Distance. But, you're not going to get distance data anyways from your Pedals. Not sure what's your reason to get distance from the PM. Or basically, you're trying to achieve #1 and you think that by using the FIT file playback all would be good to test your code? I've not dabbled in this playback for some time, but last I did, I remember that sometimes things doesn't work. (which is why I switched to using the ANT+ simulator - but you need to have 2 ANT+ sticks and possibly 2 computers to do this as well)

  • I was trying to test my code with the FIT playback, exactly. But as jim_m_58 pointed out, ANT+ doesn't get replayed by the simulator (I found power data and more in the decoded FIT file).

    The reason why I wanted to calculate a distance is that by entering it in my activity, I would get a measure of (theoretical) distance travelled and an average (therotical) speed.

    I have been using my fenix for testing for now, which works well enough. Maybe I look into the ANT+ sticks later.