WouterJD / FortiusANT

FortiusANT enables a pre-smart Tacx trainer (usb- or ANT-connected) to communicate with TrainerRoad, Rouvy or Zwift through ANT or Bluetooth LE.
GNU General Public License v3.0
154 stars 78 forks source link

Version 4.0 Communicates Much Higher Power vs. 3.8 #173

Closed clearwave1 closed 3 years ago

clearwave1 commented 3 years ago

Details:

I'm wondering whether the lack of the calibration when it starts is the issue.

I do not have a power meter so I have nothing to measure against. However, I also have a non smart Fluid 2 trainer which Zwift has the torque curve for and the FortiusAnt v3.8 felt closer to this than 4.0 does.

Let me know if there are things I can try to debug this.

Thanks for all your hard work.

WouterJD commented 3 years ago

Do you use calibration, if not why? Run with -d127 which produces a logfile; attach to response and I will check.

clearwave1 commented 3 years ago

I mentioned in my initial report that 4.0 does not let me calibrate.

I have attached two sets of log files - one from 3.8 and one from 4.0 (named in the file name). Github doesn't seem to support .json files so I added a ".log" on the end of these files.

FortiusANT-3.8.2020-12-20 22-51-55.log FortiusANT-4.0.2020-12-20 17-45-29.log FortiusANT-4.0.2020-12-20 17-45-29.json.log FortiusANT-3.8.2020-12-20 22-51-55.json.log

WouterJD commented 3 years ago

17:45:31,134: Motor Brake Unit Firmware=4103 Serial= 127 year=2005 type=T1946 Version2=3086 MotorBrake=False

Version 4.0 detects that you use a magnetic brake, version 3.8 did not and treated the magnetic as a motor-brake. The power curve for magnetic brake was incorrect; at least for most users. Version 4.0 should be better. Please read the manual to understand this and how to act and/or refer to issues #143 and #153.

switchabl commented 3 years ago

@WouterJD But T1942 is old solid blue unit and does not support magnetic brake I think? So this sounds wrong.

WouterJD commented 3 years ago

@clearwave1 did not tell what configuration he is using, so I cannot judge. Why would 1942 not support magnetic brake? In anyway, the controller does not report the Motor brake. See FortiusANT-4.0.2020-12-20 17-45-29.log

clearwave1 commented 3 years ago

I definitely have a motor brake. It is model T1946.50.

Overall, I have one of the original complete Fortius packages with the steering unit and motor brake. the motor brake says it is a 300W model - whatever that means.

switchabl commented 3 years ago

Why would 1942 not support magnetic brake?

According to @totalreverse (and my own experience), T1942 firmware mostly passes commands back and forth to the brake using a serial protocol, but the magnetic brake has no serial protocol, it is completely "analog". The T1932 is smarter and can control the magnetic brake itself, while emulating the motor brake commands so the protocol is similar.

totalreverse commented 3 years ago

Looks like you have to add the T1946 US model (60 Hz / 110V) to your list of motor brakes?

WouterJD commented 3 years ago

I have implemented NewUsb as if all equal; now it appears that only T1932 supports magnetic brake. Sorry for that, I will make a patch.

In the meantime you can use 3.8

switchabl commented 3 years ago

@WouterJD Well, we could just assume if head unit = T1942, it is always motor brake. But that's not really necessary, I think it is just this line that is the problem:

if self.MotorBrakeUnitType in (41, 42):
    self.MotorBrake = True

As @totalreverse said, the possible motor brakes are T1941 (230V) and T1946 (110V), so I think it should be (41, 46).

WouterJD commented 3 years ago

@switchable, I have checked the code and what was returned by the T1942 headunit (logfile). You're right. I will adjust if self.MotorBrakeUnitType in (41, 42): into (41, 46) in a next version (4.1).

I don't remember where the 42 comes from (typo, mix-up with headunit?).

If it is certain that only T1932 can control a magnetic brake, I could add if self.headunit != T1932: self.MotorBrake = True, so if we miss the MotorBrake message for whatever reason, we don't switch to Magnetic brake. Please suggest.

@clearwave1 I suppose the 300Watt is the powerback, not indicating the resistance of the motorbrake (ref TotalReverse search for T1946 and T1949.50)

switchabl commented 3 years ago

@WouterJD I'm quite sure T1942 can't do magnetic brakes (not without firmware hacking at least). But I have thought about it a bit: normally the check should never be necessary (unless we missed something). And if it had been there, we would not have found this error; not until someone tried to use a T1932 with the T1946 brake AND realized it is wrong. So it may be better not to have it.

I can't check what is returned with a magnetic brake right now, but I think it was all 0s or something? If that is so, it could be safer to check for 0s and assume anything else is motor brake.

WouterJD commented 3 years ago

Release 4.1 published; should solved the problem

TriScott commented 3 years ago

@WouterJD The 4.1.d Windows exe you commited seems to be bad:

Traceback (most recent call last): File "FortiusAnt.py", line 38, in File "c:\users\wouter dubbeldam\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module File "FortiusAntBody.py", line 210, in File "c:\users\wouter dubbeldam\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module File "bleDongle.py", line 15, in ModuleNotFoundError: No module named 'requests' [12340] Failed to execute script FortiusAnt

TacxBiker commented 3 years ago

@WouterJD

4.1 doesn't calibrate like in 3.8 And the output power seems to high. for the record, using a T1932 headunit and a T1941 brake

WouterJD commented 3 years ago

Please attach logfile

TacxBiker commented 3 years ago

FortiusAntGUI.2020-12-24 15-23-51.log

TacxBiker commented 3 years ago

FortiusANT.2020-12-24 15-23-50.log

TacxBiker commented 3 years ago

do you also need the .json log?

WouterJD commented 3 years ago

No thanks. I will check, but it may get after christmas

TacxBiker commented 3 years ago

Ha, no problem. Have a good one!

WouterJD commented 3 years ago
15:23:52,260: clsTacxNewUsbTrainer._ReceiveFromTrainer_MotorBrake()
15:23:52,261: Trainer recv data="array('B', [24, 21, 24, 0, 9, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 1, 0, 0, 13, 10, 0, 0, 0, 0])" (len=24)

The issue is clear: the T1932 head unit returns a short buffer; 64 bytes are expected and only 24 returned.

The solution is not clear yet:

At this moment, a short message was not an expected situation and causes FortiusANT to react as if a motor-brake is attached.

I wanted to get the analysis out-of-my head, but will create a test-solution after the weekend. Since you are running the python version, some quick test-rounds next week are possible.

WouterJD commented 3 years ago

If you want to proceed during the weekend:

edit usbTrainer.py line 237 replace False by True; then always MotorBrake is assumed. We will work on a proper fix later...

TacxBiker commented 3 years ago

Hi Wouter, that worked, thanks

if you need a test, let me know

WouterJD commented 3 years ago

Short message of 24 bytes was received; retry implemented. Branch: 4.2-Quality-upgrade; python only. Please test (I will do integration test tomorrow)

TacxBiker commented 3 years ago

I'll test this tonight

TacxBiker commented 3 years ago

@WouterJD I uses the 4.2 branch. It did ask for the first time to calibrate. Only one time. it didn't matter whether I stopped and started the program, Only unplug the USB cable and replug gave a new calibration. On the occasion the calibration didn't start the power was not right, to high. So stop the program, unplug the USB cable, plug it in again, start the program and calibrate. All things good then.

Another thing, in the 4.2 brach the red light of the head unit lighted up sometimes, rather mutch. It seem something to do with an error: FortiusANT3

evertime the error message passed the light flashed.

Unfortunately I didn't use the debug mode..

Another question tough, in the hypothetically event I can't produce the asked power there isn't a way to reduce the power temporary is there?

All in all I had a good training for more then 1,5 hour, bluetooth worked perfectly. The Sufferfest app is using its onw calculated speed, It looks like the speed isn't send out on Bluetooth. There is no speed in the sufferfest app when selected the speed direct from the trainer.

WouterJD commented 3 years ago

Well, at least we now touch the subject. Apparently the head unit does not return enough data, which is caused by either loose contacts OR too fast polling of the headunit.

Since you did not provide a trace-file, further analysis is not possible. At least do NOT use -A for pedalstroke analysis, so that the trainer is polled once/250ms (you already do so)

Provide logfile (start with -d127); just to see when short buffer occurs in relation to time.

TacxBiker commented 3 years ago

FortiusAntGUI.2020-12-29 08-00-00.log

FortiusANT.2020-12-29 07-59-58.log

the log file of a start of the program, calibration and a minute training.

WouterJD commented 3 years ago
08:00:01,574: clsTacxUsbTrainer.SendToTrainer(T=10, M=1, P=100, G=0, R=0, W=85, PE=0, S=0.0, C=0)
08:00:01,574: Trainer send data="02 00 00 00" (len=4)
08:00:01,574:                   tacx mode=10 target=0 pe=0 weight=0 cal=0

08:00:01,678: clsTacxNewUsbTrainer._ReceiveFromTrainer_MotorBrake()
08:00:01,678: Trainer recv data="array('B', [24, 21, 24, 0, 9, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 10, 0, 0, 0, 0])" (len=24)
08:00:01,678: Retry because short buffer received
08:00:01,782: Trainer recv data="array('B', [24, 21, 24, 0, 9, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 10, 0, 0, 0, 0, 3, 12, 0, 0, 4, 16, 0, 0, 53, 92, 124, 24, 28, 2, 0, 0, 17, 165, 0, 0, 0, 0, 0, 0])" (len=48)
08:00:01,782: Motor Brake Unit Firmware=4100 Serial= 3253 year=2008 type=T1941 Version2=540 MotorBrake=True

Here you see that the motorbrake message is sent/received;

This resolves the topic of this issue: since the correct brake is detected, the correct powercurve is selected.

WouterJD commented 3 years ago
08:00:03,834: Trainer recv data="array('B', [24, 21, 24, 0, 9, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 10, 0, 0, 0, 0])" (len=24)
08:00:03,834: Retry because short buffer received
08:00:03,938: Trainer recv data="array('B', [24, 21, 24, 0, 9, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 10, 0, 0, 0, 0, 3, 19, 2, 0, 0, 0, 0, 0, 0, 0, 48, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101])" (len=48)

the short buffer error occurs more often, which is recovered in one retry here

WouterJD commented 3 years ago
08:00:04,090: clsTacxNewUsbTrainer._ReceiveFromTrainer()
08:00:04,090: Trainer recv data="array('B', [24, 21, 24, 0, 9, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 10, 0, 0, 0, 0])" (len=24)
08:00:04,090: Retry because short buffer received
08:00:04,194: Trainer recv data="array('B', [24, 21, 24, 0, 9, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 10, 0, 0, 0, 0])" (len=24)
08:00:04,194: Retry because short buffer received
08:00:04,311: Trainer recv data="array('B', [24, 21, 24, 0, 9, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 10, 0, 0, 0, 0])" (len=24)
08:00:04,311: Retry because short buffer received
08:00:04,415: Trainer recv data="array('B', [24, 21, 24, 0, 9, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 10, 0, 0, 0, 0])" (len=24)
08:00:04,415: Retry because short buffer received
08:00:04,520: Trainer recv data="array('B', [24, 21, 24, 0, 9, 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 10, 0, 0, 0, 0])" (len=24)
08:00:04,520: Tacx returns insufficient data, len=24
08:00:04,520: To resolve, check all cabling for loose contacts.

but sometimes even four retries fail and then cause the error "To resolve, check all cabling for loose contacts." is given. Untill now, I have no other remedy for the short buffer message.

TacxBiker commented 3 years ago

I don't think its a large problem, everything else seems to work fine

TacxBiker commented 3 years ago

still one thing, calibration starts only once. Calibiration should start every time the programs starts. but perhaps thats a different thing

WouterJD commented 3 years ago

Calibration is done every time when Start is pressed.

TriScott commented 3 years ago

The red led on the 1932 is supposed to correspond with heartrate from a wireless monitor strap, but I notice mine flashes randomly in recent years even with TTS (i.e. not specific to FortiusANT).

Regarding the short 24 byte messages: these also come from a 1932 head unit continuously when the powerback device is powered off, suggesting they are at least sometimes correlated with a missed message from the motor brake firmware.

TacxBiker commented 3 years ago

Tried the calibration, that works everytime when pressed start.

WouterJD commented 3 years ago

the powerback device is powered off

Check all cabling, not only signal. @TriScott no you say it, I recall that a semi-loose 220V cable caused similar issues, perhaps causing some noise or so.

TriScott commented 3 years ago

There is still something fishy with the motor brake detection with 1932 Fortius headunits. I have stuck with FortiusANT 3.8 as it has been working well for me, but FortiusANT 5.0 still detects my Fortius as a magnetic brake and does not provide the "start pedaling" calibration prompt.

I do not think this is a "loose cabling" issue, but rather some sort of fickleness regarding the 1932 device. My setup works very well and very reliably using FortiusANT 3.8 + Zwift for long rides (and with TTS), yet it 100% of the time returns 24 bytes during FortiusANT initialization ("Tacx returns insufficient data") and fails to be identified as a motor brake.

TriScott commented 3 years ago

@jujroy Very likely you are experiencing this issue (as you described in your intro comment). If you don't go through the calibration procedure every time you start, your motor brake is being treated as a magnetic resistance brake and the power numbers are way off.

Until the 1932 initialization is resolved once and for all, you are best off continuing to use FortiusANT 3.8.

WouterJD commented 3 years ago

HI all, sorry for this inconvenience

3.8 works well for T1932 + motorbrake It does not work well for magnetic brake

4.0 implemented the magnetic brake AND detected which way to go, asking the T1932 headunit for type-of-brake. BUT the headunit does not always respond well; error-recovery was implemented. And still this is not enough.

This results in uncertainty what type of brake is connected when the motor-brake message is NOT returned; which results in the conclusion that it is a magnetic brake.

Therefore -t Motorbrake is implemented in version 5.1, which should solve the problem

(Alternative could have been to define Motorbrake as the default and implement -t Magneticbrake to overrule, but I did not do that)

So please test 5.1 from branch https://github.com/WouterJD/FortiusANT/tree/5.1+4.2-Quality-upgrade.

WouterJD commented 3 years ago

Please comment the latest version in pull request https://github.com/WouterJD/FortiusANT/pull/198

jujroy commented 3 years ago

Hello Wouter, thank you very much for your assistance and prompt reply on this issue. I would love to add myself to the map. I went to issue 14 and I am unable to figure out the way to do it :( Keep going around in circles. Help please. I will be out skiing today but will try to test 5.1 ASAP. Many thanks

WouterJD commented 3 years ago

Just added a comment un der #14. Sorry that the map is not clickable.

I will be out skiing today Lucky you; we're in lock-down in the Netherlands and skiiing in Austra/Italy impossible,

DoubleH63 commented 3 years ago

Hello Wouter

I am from Montreal, Canada.

First of all, thanks for giving us the possibility to use our old TACX Fortius on Zwift.

I found FortiusANT on January 1st. I had a few issues installing LibUSB since it is an unsigned driver. I had to follow the instructions for installing an unsigned driver on Win10.

I received my 2 dongles Wednesday and I was able to do a quick test on Zwift Wednesday night and it works fine.

I did a run Friday on the Richmond UCI: 17.1km in 24m40s, average speed=41,6km/h I did a run this afternoon on the Watopia road: 30.2km in 45m45s, average speed=39.6km/h

I was asked by a Zwifter if I was using a Diesel Engine or an Electric bike 😁

I see that the resistance is not exactly like it was with my TACX TTS 2.07. My average speed should be around 30-32 km/h.

In the log file with the debug option, I have this:

My problem is similar to the one reported by jujroy.

I will try version 5.1 to see if it solves the problem with -t Motorbrake

Many thanks

WouterJD commented 3 years ago

@DoubleH63 that willl work; type=T1949 is not expected to be a motor brake and therefore MotorBrake=False. I will study how to rework this brake-detection part

DoubleH63 commented 3 years ago

Hello Wouter,

I just tested version 5.1 on the same road than yesterday,

Result: 31.8km in 46m35s for an average speed of 41,0km/h

Doesn't seem to use the MotorBrake as it should,

Here is the information I have in the DOS window when I started:

  1. FortiusANT.exe -a -g -H0 -A -t Motorbrake
  2. Connected to Tacx Trainer T1932
  3. Motor Brake Unit Firmware=4103 Serial= 879 year=2008 type=T1949 Version2=1300 MotorBrake=False

The GUI shows: Fortius Antifier v5.1 test II

Is it help ?

WouterJD commented 3 years ago

Yes it helps; thanks. Working hard to get the version detection more solid

jujroy commented 3 years ago

Hello Wouter,

I just tested version 5.1 on the same road than yesterday,

Result: 31.8km in 46m35s for an average speed of 41,0km/h

Doesn't seem to use the MotorBrake as it should,

Here is the information I have in the DOS window when I started:

1. FortiusANT.exe -a -g -H0 -A -t Motorbrake

2. Connected to Tacx Trainer T1932

3. Motor Brake Unit Firmware=4103 Serial= 879 year=2008 type=T1949 Version2=1300 MotorBrake=False

The GUI shows: Fortius Antifier v5.1 test II

Is it help ?

Good evening.

I found out, by fluke, a sequence to make my system work consistently. -I turn OFF the power switch on the Power Pack; -I launch the FortiusAnt software and wait until the GUI gives me the Start Pedalling Prompt -I then power up the Power Pack, start pedalling, go thru the calibration process and guess what...I get the proper power output.

I tried this sequence 5 times and always got the right power output. Tomorrow I will Zwift with V5.1,

Hope this works for you.

Cheers

DoubleH63 commented 3 years ago

Hello Wouter, I just tested version 5.1 on the same road than yesterday, Result: 31.8km in 46m35s for an average speed of 41,0km/h Doesn't seem to use the MotorBrake as it should, Here is the information I have in the DOS window when I started:

1. FortiusANT.exe -a -g -H0 -A -t Motorbrake

2. Connected to Tacx Trainer T1932

3. Motor Brake Unit Firmware=4103 Serial= 879 year=2008 type=T1949 Version2=1300 MotorBrake=False

The GUI shows: Fortius Antifier v5.1 test II Is it help ?

Good evening.

I found out, by fluke, a sequence to make my system work consistently. -I turn OFF the power switch on the Power Pack; -I launch the FortiusAnt software and wait until the GUI gives me the Start Pedalling Prompt -I then power up the Power Pack, start pedalling, go thru the calibration process and guess what...I get the proper power output.

I tried this sequence 5 times and always got the right power output. Tomorrow I will Zwift with V5.1,

Hope this works for you.

Cheers

@jujroy I will try your sequence also tomorrow. Regards