cagnulein / qdomyos-zwift

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

[BUG] Zwift Treadmill Auto Workout doesn't work correctly, speed was set way to low on treadmill #2042

Closed afitz85 closed 3 months ago

afitz85 commented 4 months ago

Describe the bug Enabled "Zwift Treadmill Auto Workout" but the speed that was sent to the treadmill doesn't match the spped it should. The speed of the treadmill was always sent way too low... 1.5 km/h instead of 12.5 km/h for example. And the speed was only decreased, never increased. So when the speed on the treadmill was very low on 1.5 km/h it never gets higher when zwift says 12.5 km/h. But i tried it several times, and - i don't know why - the speed also was sometimes set correct, but that was only once, and in the next workout step it was totally wrong again.

I have a Horizon Paragon X Treadmill.

Desktop (please complete the following information):

debug-Mi__Jän_24_17_31_25_2024.log

cagnulein commented 4 months ago

@victorypoint i need your help here. it seems that sometimes the paddle ocr returns some strange values

Mi. Jän 24 17:32:20 2024 1706113940227 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "python << OUT 30.0;None\r\n"
_thread::runPython(QString) run >>  "zwift-workout.py"
Mi. Jän 24 17:32:20 2024 1706113940233 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "python << ERR "
Mi. Jän 24 17:32:20 2024 1706113940235 Debug: bluetooth.cpp void bluetooth::debug(const QString&) "windows_zwift_workout_paddleocr_thread onInclination None\r\n onSpeed \u001E"
Mi. Jän 24 17:32:20 2024 1706113940239 Debug: treadmill.cpp virtual void treadmill::changeSpeed(double) changeSpeed 30.55 true 1 0 30

do you suggest to use the ai server instead?

victorypoint commented 4 months ago

@afitz85, I'd like to test with the exact same workout as you to eliminate a few things. What is the workout - provided with Zwift or a custom one?

afitz85 commented 4 months ago

I tried 3 different zwift workouts, no custom ones.

victorypoint commented 4 months ago

I tried 3 different zwift workouts, no custom ones.

Ok, can you tell me which ones?

afitz85 commented 4 months ago

Screenshot_20240124_203008_com zwift zwiftgame

I think this was one of them.

victorypoint commented 4 months ago

Screenshot_20240124_203008_com zwift zwiftgame

I think this was one of them.

Ok thanks. I'll give this a test tonight when I get home.

afitz85 commented 4 months ago

I didn't really run today, just wanted to test how it works with qz and automatic treadmill workouts, so i just picked some to try it out. So i'm not 100% sure which ones i tested. But the one above was definitly one of them.

afitz85 commented 4 months ago

Screenshot_20240124_203008_com zwift zwiftgame I think this was one of them.

Ok thanks. I'll give this a test tonight when I get home.

Thank you!

victorypoint commented 4 months ago

@afitz85, can you confirm which QZ Windows package you're using? Zip file you downloaded?

victorypoint commented 4 months ago

@cagnulein, @afitz85, I know what the issue is. I only tested the code to work with specific workout instructions such as: zwift-20-36-18-crop

Unfortunately, most regular Zwift workouts begin with a warmup instruction and rarely have incline, such as: zwift-20-41-38-crop

So I have to revise the python code to accomodate these types of workouts. The OCR conversion is working fine. I'll find time to do this on the weekend.

cagnulein commented 4 months ago

awesome!

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno gio 25 gen 2024 alle 04:00 Al Udell @.***> ha scritto:

@cagnulein https://github.com/cagnulein, @afitz85 https://github.com/afitz85, I know what the issue is. I only tested the code to work with specific workout instructions such as: zwift-20-36-18-crop.png (view on web) https://github.com/cagnulein/qdomyos-zwift/assets/63697253/f71bfa00-9aeb-452a-85d6-5196ce19850b

Unfortunately, most regular Zwift workouts begin with a warmup instruction and rarely have incline, such as: zwift-20-41-38-crop.png (view on web) https://github.com/cagnulein/qdomyos-zwift/assets/63697253/453849e9-8fee-43ae-9ee7-9e962f08dd8b

So I have to revise the python code to accomodate these types of workouts. The OCR conversion is working fine. I'll find time to do this on the weekend.

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2042#issuecomment-1909265255, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWE56OQQ3LKZ5J5BNATYQHDGDAVCNFSM6AAAAABCJCLUHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBZGI3DKMRVGU . You are receiving this because you were mentioned.Message ID: @.***>

afitz85 commented 4 months ago

Good to hear 👍🏻 I used the windows-binary of this version Screenshot_20240125_054247_com android chrome

So workouts with constant speed, without warm-up or cool-down ramps will work so far?

afitz85 commented 4 months ago

+++ maybe a little bit off topic, but is there a way to add my set speed_offset in qz (-0.55 km/h in my case) to the workout speed zwift sends to the treadmill? Otherwise the "right" speed is always 0.55 km/h to low when the speed_offset is ignored?

cagnulein commented 4 months ago

yes just copy and paste that value in the speed offset setting

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno gio 25 gen 2024 alle 05:54 afitz85 @.***> ha scritto:

+++ maybe a little bit off topic, but is there a way to add my set speed_offset in qz (-0.55 km/h in my case) to the workout speed zwift sends to the treadmill? Otherwise the "right" speed is always 0.55 km/h to low when the speed_offset is ignored?

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2042#issuecomment-1909353468, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWHI4Y2O5KOZTBNW4YLYQHQQJAVCNFSM6AAAAABCJCLUHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBZGM2TGNBWHA . You are receiving this because you were mentioned.Message ID: @.***>

afitz85 commented 4 months ago

Sorry, where i have to copy it? I set the speed_offset here... Screenshot_20240125_064855

Just to be clear... This works so far, when i set the treadmill to 10.6km/h, zwift speed is about 10km/h (speed offset works). But when zwift says the workout step is 10km/h, the treadmill runs at 10km/h, and ignores the speed_offset of 0.55km/h (it should run at 10.6km/h to match the "real" 10km/h for me. Is this possible?

cagnulein commented 4 months ago

hah sorry got it now! yes i can apply it to the training too! let me do this today! thanks for the feedback!

afitz85 commented 4 months ago

Great to hear 👍🏻🥳 Thanks

cagnulein commented 4 months ago

actually @afitz85 I already did for your last ticket #2012 are you using the last version?

afitz85 commented 4 months ago

i downloaded the latest version yesterday (windows binary) https://github.com/cagnulein/qdomyos-zwift/actions/runs/7641451863 yes.

In the Ticket #2012 there was a problem if i tried to increase the speed on android in the qz app with the + button, then the treadmill speed decreased heavily (think from 8km/h to 1.5km/h or so) 1

cagnulein commented 4 months ago

yes it's the same thing, now, when the parsing from zwift will be correct, qz will use the same approach to change the speed. so it will use the speed offset as it does when you are using the plus button (it's the same internal function).

did you already have an evidence that this is not working?

afitz85 commented 4 months ago

ok that's good to hear.

Due to the generally incorrect values transmitted by Zwift, I'm a bit unsure now, I thought it didn't work, but before you do anything I'll check it again in the evening

cagnulein commented 4 months ago

Perfect!

afitz85 commented 4 months ago

2024-01-26_15-24-57_1 2024-01-26_15-21-48_0 debug-Fr__Jän_26_15_21_17_2024.log

i tried a custom workout now (without ramps, just constant speed), because i can't find any zwift workout with constant speed, all have a warm-up ramp at the beginning. So unfortunately it doesn't work at all... none of the speeds of the workout was transmitted to the treadmill...

afitz85 commented 4 months ago

the settings i made are correct? or have i to do anything else? Unbenannt

victorypoint commented 4 months ago

@afitz85, I will have a solution to this soon. Thanks for testing 👍

afitz85 commented 4 months ago

Perfect, looking forward to this 👍🏻 thanks.

victorypoint commented 4 months ago

@afitz85, please try the attached custom workout. It will go through a series of quick speed and incline changes - 5 changes in total for 30 seconds each.

QZ Test.zip

afitz85 commented 4 months ago

debug-Fr__Jän_26_16_12_24_2024.log

ok so that looks better now but...

PS: How do you make workouts with incline? Thats cool :)

cagnulein commented 4 months ago

@afitz85 if you change the speed from the qz tile are you able to do it without changing the inclination too?

afitz85 commented 4 months ago

yes, when i change the speed from the qz tile, i can increase the speed without changing inclination

i tried the workout once again and i can say, the treadmill is starting automatically and the incline is set correctly. but the speed stays as it is (jumped not to the workout speed)

when the secound workout step started the speed doesn't change immediately, it took about 2 seconds then the incline changes, and then did the speed change

afitz85 commented 4 months ago

but maybe it just took a while (2 to 3 seconds) till changes where applied, and speed will also change automatically without incline change!?

cagnulein commented 4 months ago

i guess i got it, it's because i'm sending a ftms frame to start the simulation 2 times and probably the treadmill refuses it (i did this for a technogym treadmill)

let me try a branch to remove this

afitz85 commented 4 months ago

ok.

tried my custom workouts again (they are without incline) and there the workout neither starts by itself nor does the speed change

cagnulein commented 4 months ago

@afitz85 done https://github.com/cagnulein/qdomyos-zwift/actions/runs/7670262351

cagnulein commented 4 months ago

@afitz85 wait there is a major issue on your settings! the speed force setting in the treadmill section is disabled!

afitz85 commented 4 months ago

This one? Unbenannt

yes it was disabled. i enabled it, restarted the qz app, but nothing changes

afitz85 commented 4 months ago

@afitz85 done https://github.com/cagnulein/qdomyos-zwift/actions/runs/7670262351

when it's ready i try the windows binary there?

cagnulein commented 4 months ago

@afitz85 done https://github.com/cagnulein/qdomyos-zwift/actions/runs/7670262351

when it's ready i try the windows binary there?

yes

cagnulein commented 4 months ago

This one? Unbenannt

yes it was disabled. i enabled it, restarted the qz app, but nothing changes

so you tried a zwo file with only speed changes and it doesn't work with this enabled? share a debug log plz

afitz85 commented 4 months ago

debug-Fr__Jän_26_16_57_25_2024.log

yes, nothing changed i tried my workout without incline, and the one with incline

cagnulein commented 4 months ago

oki will check the log asap

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno ven 26 gen 2024 alle 17:03 afitz85 @.***> ha scritto:

debug-Fr__Jän_26_16_57_25_2024.log https://github.com/cagnulein/qdomyos-zwift/files/14066922/debug-Fr__Jan_26_16_57_25_2024.log

yes, nothing changed

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2042#issuecomment-1912303833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWD5JPKVAZZ5EPKGT5DYQPHWVAVCNFSM6AAAAABCJCLUHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJSGMYDGOBTGM . You are receiving this because you were mentioned.Message ID: @.***>

afitz85 commented 4 months ago

@afitz85 done https://github.com/cagnulein/qdomyos-zwift/actions/runs/7670262351

when it's ready i try the windows binary there?

yes

I'm sorry, but now nothing is working, no incline and no speed (tried both, workout with and without incline) debug-Fr__Jän_26_17_31_28_2024.log

cagnulein commented 4 months ago

ok so i will check it thanks

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno ven 26 gen 2024 alle 17:39 afitz85 @.***> ha scritto:

@afitz85 https://github.com/afitz85 done https://github.com/cagnulein/qdomyos-zwift/actions/runs/7670262351

when it's ready i try the windows binary there?

yes

I'm sorry, but now nothing is working, no incline and no speed (tried both, workout with and without incline) debug-Fr__Jän_26_17_31_28_2024.log https://github.com/cagnulein/qdomyos-zwift/files/14067252/debug-Fr__Jan_26_17_31_28_2024.log

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2042#issuecomment-1912356038, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWEJZGFJ46STPWROCA3YQPL3FAVCNFSM6AAAAABCJCLUHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJSGM2TMMBTHA . You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 4 months ago

So resume the working version now

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno ven 26 gen 2024 alle 18:45 cagnulein @.***> ha scritto:

ok so i will check it thanks

Roberto Viola Software engineer and open source enthusiast http://robertoviola.cloud

Il giorno ven 26 gen 2024 alle 17:39 afitz85 @.***> ha scritto:

@afitz85 https://github.com/afitz85 done https://github.com/cagnulein/qdomyos-zwift/actions/runs/7670262351

when it's ready i try the windows binary there?

yes

I'm sorry, but now nothing is working, no incline and no speed (tried both, workout with and without incline) debug-Fr__Jän_26_17_31_28_2024.log https://github.com/cagnulein/qdomyos-zwift/files/14067252/debug-Fr__Jan_26_17_31_28_2024.log

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2042#issuecomment-1912356038, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWEJZGFJ46STPWROCA3YQPL3FAVCNFSM6AAAAABCJCLUHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJSGM2TMMBTHA . You are receiving this because you were mentioned.Message ID: @.***>

victorypoint commented 4 months ago

@afitz85, when you get things working again, I have a fix for the workout speed and incline for you to test please. Download the attached, unzip, and copy the zwift-workout.py file inside your QZ folder overwriting the old one. Test a workout and let us know!

zwift-workout.zip

cagnulein commented 4 months ago

debug-Fr__Jän_26_16_57_25_2024.log

yes, nothing changed i tried my workout without incline, and the one with incline

@afitz85 i checked this log and the speed is changing when qz asks it. i saw also, and maybe it's the issue that you are referring to, that when you set speed 0 qz can't control it, but that's quite usual for all the treadmills. can you try a session without setting the speed to 0 manually?

afitz85 commented 4 months ago

Should i tty these things going back to an earlier version than https://github.com/cagnulein/qdomyos-zwift/actions/runs/7670262351?

I can't set my tteadmill to 0 speed, the lowest possible is 0.8km/h. The 0 speed you see must be when i stop (pause) the treadmill!?

When it is in pause mode the workout automatically started with the test workout of @victorypoint, my custom workouts haven't done.

cagnulein commented 4 months ago

Should i tty these things going back to an earlier version than https://github.com/cagnulein/qdomyos-zwift/actions/runs/7670262351?

yes

I can't set my tteadmill to 0 speed, the lowest possible is 0.8km/h. The 0 speed you see must be when i stop (pause) the treadmill!?

yes i guess so. in that case we need to handle a start, but let's put one problem in the fire at one time :)

When it is in pause mode the workout automatically started with the test workout of @victorypoint, my custom workouts haven't done.

ok but if you don't press pause or stop on the treadmill, is the custom workout executed correctly? if not can you share a debug log with only a simple custom workout with only speed changes that doesn't work?

afitz85 commented 4 months ago

ok, now i get an older version and workouts are still working the same as they did yesterday.

debug-Sa__Jän_27_08_19_59_2024.log

now my treadmill was running at 3.5km/h and i started my custom workout without incline, there nothing happens, no speed changes. Then i startet (while the treadmill was sill running) the Test Workout of @victorypoint from yesterday and it worked the same as it did yesterday. speed was just changed when the incline was changed. But in the second workout step just the incline changes, no speed was changed!? The next steps worked then again.

BUT i haven't tried the new zwift-workout.py file yet... that's im gona do now.

cagnulein commented 4 months ago

@afitz85 i guess there is some confusion in the terms :D when i'm talking about custom workouts, i'm talking about loading a zwo file directly in qz. Instead, in this log, I see that you are using zwift OCR for the workout, isn't it?

So in order to address the speed issue, just load a simple zwo file that you can create from http://80.211.67.253:8081/training.htm?fbclid=IwAR07s1MGtk-xjNPZDj_vsE89PEUqv6D5ycffYmNxDUqax8rD0bbdMFpqDLg

so i can understand if there is any issue with the speed at all in your treadmill.

also another question: which is the minium speed step that your treadmill can change? 0.5km/h? 0.1 km/h?