wrong data from sensor / how to fix the activity ?

Hello,

I recently did a mountain bike activity with my watch (Garmin Fenix) and the cadence/speed Garmin sensor.

The sensor gave wrong data : at a point I know is 15.3km from the starting point, the distance reported was 30km. The speed sometimes went to more than 200km/h !
At this point, I removed the magnet on the wheel and the data became exact (no more cadence/speed sensor, data from the GPS of the watch only)

I managed to open the activity FIT file with the tools (converted to CSV), but if I remove the wrong data I get an error when I try to encode the file back to FIT.

Is it possible to recover this activity (I would like to keep my segment times in Strava, the elevation, etc...) ?
If yes, how ? 

Thank you

Top Replies

All Replies

  • Can you post the original FIT file here? I will check if my tool can fix the issue for you.

  • Hello Alan,

    Thank you for your help

    I didn't managed to find a way to host the file on the forum, you can get the FIT file on wetransfer. Here is the link

    link=we.tl/t-2J5ukBDNeT 

    When I open the file in CSV, I can see records from Data 1 and Data 3 sensors.
    Data3 is the speed/cadence sensor

    Data1 is the embedded GPS in the watch.

    From timestamp 1099840995 there is no more Data3 records (when ni removed the magnet from the wheel)

    I guess I need to avoid all records from Data3 

    But at the timestamp 1099840995, the distance recorded by Data1 is false (30475.96), it get it from the other sensor. It needs to be corrected (and all the next records) by minus 15200 (at this point the real distance from the starting point is 15300 meters)

    I hope this is clear enough ! Slight smile

  • I can't no longer upload image directly in the forum, so I attach the ref image as link:

    drive.google.com/.../view


    If I understand correctly, from START to THIS POINT (the red line) you are using speed/cadence sensor and it gives you wrong distance calculation (probably because of wrong wheelsize setting). It should have been 15 km but it gives you 30 km, and when you remove the sensor, the record pick up the previous distance as a pivot distance, is that correct?

    I don't know if there is ready to use program to recover this, but with a bit of programming, I think we can "recover" it.

    The simplest way is probably recalculating the whole distance using GPS points by using Haversine Formula or similar algorithm, then we update Laps and Sessions messages accordingly.

    Alternatively, we can just recalculate START to THIS POINT, then from THIS POINT to END we can just subtract it with a constant value.

  • OK. Which tool is used to encode the CSV file back to FIT?

  • I tried with this (found on the developer.garmin.com/fit/fitcsvtool/editing-files/

    Using the -c command line option, the input csv file is converted to a FIT file. Note that when using the -c option both the input and output file names need to be provided.

    java -jar FitCSVTool.jar -c ./activity.csv ./treadmillactivity.fit
  • Hi Muktihari and thank you for your help

    I confirm you understand correctly !

    It's not related to the setting of the wheel size, it's OK. it's strange, but it doesn't matter yet (maybe low battery or magnetized part on the wheel)

    Regarding your solution, no idea what is the easier way

  • OK. I see. Your original FIT file is 100% follow the FIT protocol, while my tool can only fix broken FIT files.

    One solution is, do you have a way to remove the raw data you think invalid from the FIT file, which will make a corrupt FIT file. Then my tool will be able to fix it.

    Or, if you can estimate the location of the data you think as invalid, for example, in the last 1/3 part of the file, then I can remove the last 1/3 part and then repair it with my tool to make it a valid FIT file again.

  • Try this: drive.google.com/.../view

    What I did was removing all distance and speed from the entire file, then I use my program, https://openivity.github.io , to recalculate the distance and speed using en.wikipedia.org/.../Haversine_formula. The resulting distance and speed might not exactly what you wanted since there is margin error for each GPS points calculation, but it's the best I can do right now.

    You can try it yourself when all the PRs are merged since there are still some bugs and some features were not enabled yet, tracked here: github.com/.../pulls

  • Hello Muktihari,
    That sounds very good!
    And to be honest, it has not to be perfect. I have a final distance seems to be correct, the Strava segments are preserved.
    This new file is perfect to me : my overall stats/perf are preserved and this is the most important point.

    Thank you very much!

    Just because I'm curious : how did you removed all distance and speed from the file ? Is it in the CSV file ?
    If you have intermediate steps (files to share ?) it might be very intersting.

    Have a nice day

  • Great! I’m glad to know it helps..

    You can use https://openivity.github.io as well to remove some fields, then export it. After that, reopen the file again, this will trigger the program to recalculate the speed and distance since those fields are not found.

    Originally, this feature is exist to recalculate GPX files to export it as FIT, since a GPX files only contains GPS points, now it turned out can be used for a case like this, haha I didn’t expect that tbh.

    Other than the previous program, I have another tool to manipulate FIT files in case you need it in the future: https://github.com/muktihari/fit/tree/master/cmd/fitactivity 

    Have a nice day too!