Closed thesoulpole closed 2 years ago
Hi. I mostly work on golden cheetah but bear with me this is relevant. We recently reimplemented drivers for tacx fortius, which is a device that only receives instructions to set 'brake force'. I initially attempted to model gradient mode using power and result was like you describe here. If you try to run a gradient mode using power then device will simply lower its brake as you pedal faster.
Realization was that we should simply provide force in newtons to trainer and then everything works perfectly since when rider pedals harder more watts are produced. That is what zwift wants, I'm sure.
On golden cheetah we have a sim that simply sends computed newtons, so we don't need to run a sim inside the trainer, but for a case where you must model zwift's gradient mode the driver the driver must model kinetic energy and then convert to brake force. There is an implementation in the fortius pr.
https://github.com/GoldenCheetah/GoldenCheetah/pull/3725
What I'm wondering is if the owner of this project might be interested in adding support for gradient mode to golden cheetah? Needs a programmer with a device to do the work and test it. For gc it should simply be a matter of converting the newtons of resistance into whatever command the kettler wants.
The golden cheetah kettler drivers are here:
https://github.com/GoldenCheetah/GoldenCheetah/blob/master/src/Train/KettlerConnection.cpp
Currently it only speaks watts but hopefully there's a way to set force instead?
Hello
Let me have a look. Kinetic energy is an interesting approach.
Emmanuel
Hello
Let me have a look. Kinetic energy is an interesting approach.
Emmanuel
Remember that Zwift 'n all are only consuming the watts you report and then computing their own speed independent of trainer, so functionality-wise it is only important that you model 'a' speed to power curve.
It is not so important that you implement the exact correct resistance, correct resistance just wins you bonus points.
The force equation from gradient (that gc is not using) starts on line 530 of fortius.cpp:
https://github.com/GoldenCheetah/GoldenCheetah/pull/3725/files
Hi all,
just read the comments and thought that this could help in this discussion: https://github.com/weinzmi/daumUSB2BLE/blob/master/daumSIM.js
It works for me with my DAUM Ergobike, still there is room for improvements, e.g.: acceleration, but due to the physical fly wheel of such an ergometer, there will be a difference compared to the new smart trainers like a KICKR. Tried to do my best to comment the functions.
Michael
so what I did here
receiving the terrain and environmental information from ZWIFT via BLE:
starting at line 128
https://github.com/weinzmi/daumUSB2BLE/blob/master/BLE/fitness-control-point-characteristic.js
var windspeed = data.readInt16LE(1) * 0.001 var grade = data.readInt16LE(3) * 0.01 var crr = data.readUInt8(5) * 0.0001 var cw = data.readUInt8(6) * 0.01
combining it with the riders physics: https://github.com/weinzmi/daumUSB2BLE/blob/master/daumSIM.js
using the actual speed your ergometer sends via RS232 to calculate the power
send it back to ZWIFT via BLE - starting at line 212 https://github.com/weinzmi/daumUSB2BLE/blob/master/server.js
so what I did here
- receiving the terrain and environmental information from ZWIFT via BLE: starting at line 128 https://github.com/weinzmi/daumUSB2BLE/blob/master/BLE/fitness-control-point-characteristic.js
var windspeed = data.readInt16LE(1) * 0.001 var grade = data.readInt16LE(3) * 0.01 var crr = data.readUInt8(5) * 0.0001 var cw = data.readUInt8(6) * 0.01
- combining it with the riders physics: https://github.com/weinzmi/daumUSB2BLE/blob/master/daumSIM.js
- weight
- bike weight
- hight
- using the actual speed your ergometer sends via RS232 to calculate the power
- send it back to ZWIFT via BLE - starting at line 212 https://github.com/weinzmi/daumUSB2BLE/blob/master/server.js
Oh! I missed that you had access to device speed. So you use device speed instead of zwift speed to compute load, then set that load to device. Seems like this should work and not do what @thesoulpole says it is doing.
Hello
I did some fixes on the control caracteristic. don't forget to update your code as it seems to have the same pb
Emmanuel
Hi, some more questions;) I have my Kettler FX1 working in Zwift in Workout mode (which I understand is ERG mode). Whatever Zwift workout sets as the Watts ina given segemnt appears on the Kettler, if I turn the pedals faster the Watts stay the same. All perfectly sensible. (btw - I do not see the rpm on the Zwift - is that expected?) BUT If I want to "ride" in Zwift, things are much worse. I cannot speed up. If I turn pedals faster, nothing much happens. (but when I start pedaling from a full stop, Zwift knows I started and shows it on screen, and if I stop completely, the screen avatar also stops). So it seems Zwift detects my motion to some extent, but then... what? Do you know what is happening? Is the SIM mode simply not implemented? (I thought about the differences in the algo for ERG and SIM, and can see that interacting Kettler-Zwift in SIM is more complex.)