qdomyos-zwift icon indicating copy to clipboard operation
qdomyos-zwift copied to clipboard

#855 Support for the Trixter X-Dream V1 bike

Open drmason789 opened this issue 2 years ago • 108 comments

#855

I've partially added the virtual device but in the wrong place. Not really sure where this is supposed to go or how to connect the bike's features to BT.

It's delivering:

  • speed
  • cadence
  • heart rate
  • steering

To use, the bike must first be enabled in Settings / Bike Options / Trixter X-Dream V1 Bike Options. From there you can turn the steering on and off, and adjust the steering calibration, which allows the user to specify which uncalibrated steering values are to be mapped to -45, dead zone left, dead zone right, +45.

drmason789 avatar Aug 14 '22 01:08 drmason789

I should squash these commits. Please wait...

drmason789 avatar Aug 14 '22 09:08 drmason789

if you want i can squash it during the merge

cagnulein avatar Aug 14 '22 10:08 cagnulein

Okay, thanks.

drmason789 avatar Aug 14 '22 10:08 drmason789

i would like to release the actual master as the official 2.11 the next week or so, so i will merge this in the 2.12 thanks!

cagnulein avatar Aug 14 '22 13:08 cagnulein

It would be nice to have the virtual device hooked up so I can get my contacts in the Trixter X-Dream v1 bike community testing builds.

drmason789 avatar Aug 14 '22 13:08 drmason789

hah ok i will check this on your branch.

cagnulein avatar Aug 14 '22 14:08 cagnulein

@drmason789 I checked your virtual bike implementation and it seems fine to me. Don't you see power over FTMS? could you show me on nrfconnect what you see from your QZ interface?

also i had an idea: why don't you use a bluetooth-serial port adapter? so you can use your module over bluetooth with an ipad or a phone for example, i guess will be more confortable than a PC ;)

cagnulein avatar Aug 14 '22 20:08 cagnulein

@cagnulein Thanks. I am running Zwift on my Android phone and when I run QZ on my PC (which has Bluetooth, but perhaps not the right version) it doesn't advertise the services. When I run QZ on my Raspberry Pi 4, it advertises the DomyosBridge, power sensor (but not speed), heart rate, cadence and controllable.

I was able to connect those 4, and I was able to start a ride. The heart rate worked, and when I pedalled, the cadence was indicated, but the power shown remained 0W, the bike didn't move, and there was no indicator of speed. No sign of how to configure steering.

Do I need my bike subclass to provide power information?

  • The bike doesn't give a power reading, but there is a table in the associated software's config that provides a mapping between cadence RPM, resistance, and power that I could incorporate. However, the solenoids can wear out, and slip away from the flywheel, so this could be inaccurate. Better than nothing I guess.

A bluetooth serial port adapter? The bike is externally USB, but it is exposed in the OS as a serial port. I'm not sure if a suitable device exists. I could possibly solder a serial to Bluetooth adapter into the internal board, but I want to provide something that anyone with one of these bikes can use.

drmason789 avatar Aug 14 '22 21:08 drmason789

Also, on the RP4 it crashed once with a "bus error".

drmason789 avatar Aug 14 '22 21:08 drmason789

Screenshot_20220815-003238_nRF Connect

Screenshot_20220815-003311_nRF Connect

Screenshot_20220815-003316_nRF Connect

drmason789 avatar Aug 14 '22 23:08 drmason789

yes you just need to populate the m_watt variable with that table output. of course will not be 100% real, but there isn't any way to do it better without using a power pedal

Il giorno lun 15 ago 2022 alle 01:36 David Mason @.***> ha scritto:

[image: Screenshot_20220815-003238_nRF Connect] https://user-images.githubusercontent.com/29954900/184559033-02dde60c-3bc3-41a1-aa90-aac816d670e0.jpg

[image: Screenshot_20220815-003311_nRF Connect] https://user-images.githubusercontent.com/29954900/184559036-068eeb70-b372-4fa9-99c6-04323285d5ec.jpg

[image: Screenshot_20220815-003316_nRF Connect] https://user-images.githubusercontent.com/29954900/184559042-b25fe84d-dd86-4ba6-88ce-c225ee67be07.jpg

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

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

cagnulein avatar Aug 15 '22 06:08 cagnulein

saw the commit. does the power work on ftms now?

cagnulein avatar Aug 15 '22 08:08 cagnulein

It detects the device and runs but doesn't advertise on my PC and my RP4 is no longer reading the USB serial port (it sees the port but times out waiting for recognisable data - log shows no bytes coming in from serial port) RP4 on same power supply (this can affect USB device AFAIK) as when it was reading the bike yesterday. I will resume this after work this evening.

drmason789 avatar Aug 15 '22 09:08 drmason789

for the pc issue use this dongle that must work https://github.com/cagnulein/qdomyos-zwift/wiki/I-can't-connect-QZ-to-Zwift#for-zwift-pc-users

cagnulein avatar Aug 15 '22 12:08 cagnulein

@cagnulein I just took a ride and got the Zwift bike to move. However, Zwift displays a speed in kph of about 1/10 or less the speed shown by QZ. Needless to say, I didn't ride very far.

drmason789 avatar Aug 15 '22 23:08 drmason789

I'm going to have to take a careful look at other bikes' power calculations.

drmason789 avatar Aug 16 '22 00:08 drmason789

@drmason789 that's right because zwift does it's own speed calculation based on power and variables in the game. so it's totally right you need to increase the resistance on your bike ;)

cagnulein avatar Aug 16 '22 05:08 cagnulein

so which is the status of this? is it working ok with zwift? also with auto resistance?

cagnulein avatar Aug 18 '22 05:08 cagnulein

Zwift is responding to it, but as for working okay, I don't really know what "okay" is as I've never used Zwift before. If my interpretation is correct, Zwift requests about 2% resistance from the bike, I pedal fast, Zwift shows the watts I expect, but the Zwift bike only moves at 1-10km/h.

I've adjusted one of the Zwift settings in QZ and this appears to alter the W that appears in Zwift, but no real improvement in the user experience. I guess I've just got to learn what the Zwift related options mean, and do some prodding and poking to figure out which options to set.

Also, it's not really clear which metrics my bike subclass needs to populate. E.g. I only found out from connecting to Zwift and asking you that I actually need to provide a power reading - I had been working on the assumption that cadence and speed would be enough. Now I wonder, do I need to populate WattKg (which I see from calculations is actually watts per kg)? I am currently using the update_metrics method inherited from the buetoothdevice class.

To assist with my prodding and poking, I've started connecting the bike's 2 brake levers which deliver values from 135 to 250 to the system to adjust items, starting with the resistance/power calculations, i.e. to squeeze a lever to see what effect the parameter has on the user experience.

drmason789 avatar Aug 18 '22 08:08 drmason789

Zwift is responding to it, but as for working okay, I don't really know what "okay" is as I've never used Zwift before. If my interpretation is correct, Zwift requests about 2% resistance from the bike, I pedal fast, Zwift shows the watts I expect, but the Zwift bike only moves at 1-10km/h.

that's because you need to adjust the zwift resistance gain to 10 or 15 in your case since you have 250 resistance levels. qz is translating inclination to resistance using the zwift inclination gain and offset.

Also, it's not really clear which metrics my bike subclass needs to populate. E.g. I only found out from connecting to Zwift and asking you that I actually need to provide a power reading - I had been working on the assumption that cadence and speed would be enough. Now I wonder, do I need to populate WattKg (which I see from calculations is actually watts per kg)?

calling the metric method update it will automatically calculate the wattkg. but zwift wants only power. cadence and heart rate are optional

I am currently using the update_metrics method inherited from the buetoothdevice class.

perfect so you already did what was necessary.

cagnulein avatar Aug 18 '22 09:08 cagnulein

Currently the bridge doesn't stay connected long enough to do anything, and looking at the debug log, it seems to be confused about a Wahoo Kicker bike that shows up in Zwift on my phone. I guess this is my neighbour's smart trainer.

I also see references to dircon in the log. I disabled dircon in the settings.

Still, the bluetooth won't stay connected long enough to do anything - it just jumps to "No Signal" very quickly. Cadence no longer advertised.

I'll continue looking another day.

drmason789 avatar Aug 18 '22 21:08 drmason789

on the raspberry? are you sure about the power supply? did you buy also the dongle that i was referring to?

Il giorno gio 18 ago 2022 alle 23:53 David Mason @.***> ha scritto:

Currently the bridge doesn't stay connected long enough to do anything, and looking at the debug log, it seems to be confused about a Wahoo Kicker bike that shows up in Zwift on my phone. I guess this is my neighbour's smart trainer.

I also see references to dircon in the log. I disabled dircon in the settings.

Still, the bluetooth won't stay connected long enough to do anything - it just jumps to "No Signal" very quickly. Cadence no longer advertised.

I'll continue looking another day.

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

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

cagnulein avatar Aug 18 '22 22:08 cagnulein

Problem is on the RP4. I did get the dongle, but it makes no difference on the PC - still doesn't advertise. Possibly interfering with the built in bluetooth - I'll have to investigate that. Development on Windows is so slow I may ditch this environment and create a Linux one in a VM.

drmason789 avatar Aug 21 '22 19:08 drmason789

@drmason789 did you try the dongle on the pc instead?

cagnulein avatar Aug 21 '22 19:08 cagnulein

@cagnulein Yes, I only used the dongle on the PC.

drmason789 avatar Aug 21 '22 20:08 drmason789

since #898 is merged now, are we waiting other tasks before merging this? @drmason789

cagnulein avatar Aug 22 '22 07:08 cagnulein

I need to find out why I can't maintain a bluetooth connection and suitable settings so I can get the Zwift bike going more than 10km/h.

drmason789 avatar Aug 22 '22 23:08 drmason789

QZ is currently crashing with

Tue Aug 23 23:27:52 2022 1661293672271 Debug:   sending notification/indication: "1b0a006402061fc00005000e000000"
qt.bluetooth.bluez: sending notification/indication: "1b0a006402061fc00005000e000000"
Tue Aug 23 23:27:52 2022 1661293672272 Debug: virtualbike.cpp void virtualbike::writeCharacteristic(QLowEnergyService*, const QLowEnergyCharacteristic&, const QByteArray&) "virtualbike::writeCharacteristic Heart Rate Heart Rate Measurement 00 00"
"virtualbike::writeCharacteristic Heart Rate Heart Rate Measurement 00 00"
Tue Aug 23 23:27:52 2022 1661293672273 Debug:   sending notification/indication: "1b14000000"
qt.bluetooth.bluez: sending notification/indication: "1b14000000"
Tue Aug 23 23:27:52 2022 1661293672374 Debug:   HCI event triggered, type: 13
qt.bluetooth.bluez: HCI event triggered, type: 13
free(): invalid pointer
Aborted

drmason789 avatar Aug 23 '22 22:08 drmason789

I connected the brake values to the watt output to boost to 250W but the resistance (with Zwift resistance gain set to 15 and 100, with Zwift Resistance offset 4) never seems to change on the bike.

drmason789 avatar Aug 24 '22 00:08 drmason789

QZ is currently crashing with

what does gdb say?

cagnulein avatar Aug 24 '22 09:08 cagnulein