cagnulein / qdomyos-zwift

Zwift bridge for smart treadmills and bike/cyclette
https://www.qzfitness.com/
GNU General Public License v3.0
369 stars 109 forks source link

QZ FIT file start timestamp inconsistent with Zwift #1311

Open victorypoint opened 1 year ago

victorypoint commented 1 year ago

@cagnulein, now that we have a consistent way to synchronize that start of activities between Zwift and QZ (ensure speed is 0 then increase to start FIT file recording at the same time), I'm finding a strange inconsistency with the start timestamp in the QZ FIT file. This is affecting the ability to accurately merge data between the two FIT files (e.g. latitude, longitude, elevation, power, etc).

For example, here's results of a recent test using QZ fake treadmill mode:

I've retested this several times and always arrive at a strange delayed QZ starting timestamp. Any help resolving this is greatly appreciated.

FIT files attached. test4.zip

victorypoint commented 1 year ago

@cagnulein, let me test this idea - single QZ FIT file for multiple Zwift activities and see if FIT merge works.

victorypoint commented 1 year ago

But I was thinking: is it really necesseary? I mean since the Zwift activity has an end, we can simple discard all the remaining qz activity from the zwift one (the qz activity will be probably longer than the zwift one, but we can simply cut the remaining off, isn't it?)

@cagnulein, ok I tested this theory and you're a genius! Have I ever mentioned that before? ๐Ÿคฃ๐Ÿคฃ

Here's what I did to test multiple Zwift activities/single QZ session. A typical scenario is to start on May Field, jump to a run event, then exit to main Zwift screen and perhaps do other runs, workouts, meetups while staying in Zwift with QZ running in the background.

Here are elevation graphs of resulting FIT file merges for each Zwift activity. Blue is Zwift FIT, green is Zwift/QZ/elevation merge FIT. Note that the first graph is the bike ride where Zwift FIT file always has correct terrain elevation. The remaining graphs are runs where Zwift elevation is incorrect (in blue) and need to be corrected with QZ elevation (green):

2023-03-01-19-20-13 2023-03-01-19-32-01 2023-03-01-19-40-23 2023-03-01-19-43-13 2023-03-01-19-43-33 2023-03-01-19-48-49 2023-03-01-19-57-53 2023-03-01-20-04-07 2023-03-01-20-04-28

cagnulein commented 1 year ago

so your java skills are still strong! ๐Ÿ’ช

cagnulein commented 1 year ago

so I guess we can reopen this https://github.com/cagnulein/qdomyos-zwift/pull/1369#issuecomment-1476323034

cagnulein commented 1 year ago

my idea is adding a command line argument to specify the zwift fit file directories. So qz can get the lastest one and opening it each seconds or so? what do you think?

victorypoint commented 1 year ago

my idea is adding a command line argument to specify the zwift fit file directories. So qz can get the lastest one and opening it each seconds or so? what do you think?

Incredible idea! This just after I came up with a Windows batch solution using the Java option ๐Ÿ˜‚ - https://github.com/victorypoint/RepairZwiftFIT

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

victorypoint commented 1 year ago

Keep this alive please!

cagnulein commented 1 year ago

about this @victorypoint should we proceed with opening the fit file in real time? do you think it's doable?

victorypoint commented 1 year ago

about this @victorypoint should we proceed with opening the fit file in real time? do you think it's doable?

@cagnulein, yes, I believe it's doable. The active FIT file is readable in realtime which is what we want to obtain coordinates for each timestamp.

cagnulein commented 1 year ago

@victorypoint can you attach a fit file from a workout here? I mean getting it while you're running, so i can check that the file is closed. Also how often this file is updated from zwift?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

victorypoint commented 1 year ago

@victorypoint can you attach a fit file from a workout here? I mean getting it while you're running, so i can check that the file is closed. Also how often this file is updated from zwift?

@cagnulein, so sorry for the delay on this! I've been so busy with the python stuff! ๐Ÿ˜ฎ. So I just did a workout as follows:

So it looks like my previous theory that the inProgressActivity.fit file updates in real-time is wrong - it appears to update every 10 minutes or so? However, the timestamped FIT file does update in real-time I believe every second and is readable during workouts.

cagnulein commented 8 months ago

@victorypoint are you still interested on this? now with the zwift api we can collect gps data!

cagnulein commented 8 months ago

the only issue is that for now the windows build doesn't support the zwift api (i have to find the time to add them), but if you want I can add this on the android or ios build

victorypoint commented 8 months ago

@cagnulein, yes! Absolutely! I can test on all platforms so good to go ๐Ÿ‘

cagnulein commented 8 months ago

ok i will try to do first on ios, i need to convert the X and Y from zwift to gps coordinates, i found that there is a conversion to do for the different worlds

cagnulein commented 8 months ago

@victorypoint i thought it could be easy instead i'm struggling to find information about how to translate coordinates from zwift system to the world system. https://github.com/sandermvanvliet/RoadCaptain/blob/d8ec891349212d2a8ef2691925376712680e0bc4/src/RoadCaptain/TrackPoint.cs#L256 seems to be the most update resource but his conversion doesn't match at all. Also I don't understand if this conversion is actually working on RoadCaptain. Do you have some information about this?

I have X and Y zwift coordinates in realtime but I can't transform them to real GPS coordinates

victorypoint commented 8 months ago

@cagnulein, ok I'll check it out in the next few days. I haven't used roadcaptain yet so need to study it a bit.