ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.97k stars 17.51k forks source link

BL_HELI: Reverse throttle by RC Switch spins the motor in the wrong directions #28476

Open menschel opened 1 week ago

menschel commented 1 week ago

Bug report

Reporting a minor issue with motor direction with 3D enabled BL_HELI compatible ESCs. Observed with Bluejay and AM32 firmware, both DSHOT600 protocol. Can be fixed by changing ESC to "3D (forward/reverse) Reversed".

Issue details While following the guide for Reverse Throttle via RC_Switch https://notes.stavros.io/ardupilot/reverse-thrust/ I observed that the resulting directions are wrong. After setting the ESC to 3D (forward/reverse) via ESC-Configurator Online tool and changing the parameters according to guide, the default motor direction produces reverse thrust. After switching to Reverse Thrust followed by the GCS message that Reverse Thrust is enabled, the motor direction produces positive thrust.

Version Ardupilot 4.5.7

Platform [x] All [ ] AntennaTracker [ ] Copter [ ] Plane [ ] Rover [ ] Submarine

Airframe type

Hardware type STM32F405 based FC with

Logs The issue does not show in logs but is observed visually on the bench.

menschel commented 1 week ago

have you swapped the phase wires on the motor to change its direction?

No, I don't swap any cables in the process.

If ESC is configured "normal" direction, motor spins in the correct "forward" direction. If the ESC is configured "3D (forward/reverse)" and parameters are changed according to guide, the motor spins reverse while Ardupilot treats it as normal direction and vise versa.

I can fix the whole configuration thing if I set the ESC to "3D (forward/reverse) REVERSED". I currently don't have a PWM controlled ESC to test if it works correctly in PWM control and just wrong in DSHOT.

andyp1per commented 1 week ago

What parameters have you set?

menschel commented 1 week ago

What parameters have you set?

My latest config for the Drift SpeedyBee F405 Wing Mini + Dys XSD7A current.zip EDIT: I forgot to mention, I have reverted back to non bi-directional thrust. It was only a bench test.

Motor is on Channel1. Additional Changes have been according to guide. THR_MIN=-30 SERVO_BLH_3DMASK=1 RC5_OPTION=64 USE_REV_THRUST=0 FLTMODE1=0 FLTMODE2=0

ESC set to bidirectional non-inverted via ESC-Configurator tool.

menschel commented 1 week ago

The ARWingPro (Matek F405 Wing V2 + Holybro Tekko32 F4 45A ESC) still has this test setup.

It works in correct directions with the attached parameter file and ESC set to bi-directional + reversed. The motor direction is also correct if none of the check-boxes is selected, (i.e. not bi-directional and not reversed). AM32 20241027_ARWingPro_ReverseThrottleViaRC5Test.zip

andyp1per commented 1 week ago

Pretty sure this is a bug I fixed in 4.6, please can you try the latest?

menschel commented 1 week ago

Sorry, it is the same behavior in 4.6. I'm not sure about the scaling either. Hard to tell on the bench without a prop and it seems that ESC rpm is reported unsigned. I'll take it outside, strap it to some fixture and run it under load in both directions when the rain clears up. Will also be a good test for the folding prop, not sure if it actually can work in reverse. esc_reverse 00000004.zip

menschel commented 1 week ago

I did not observe scaling to -30% throttle. I did not go above half stick range because it was truly scary. Yet it reaches half the RPM. Fold Propeller Aeronaut CAMCarbon 9,5x5 fold_propeller Stock Propeller 8x5 (T-Motor?) stock_propeller

andyp1per commented 5 days ago

I think you are getting bitten by SERVO_DSHOT_ESC - you have configured this and so AP will send the dshot commands to reverse, so given that you have already reversed in the configurator the setup will be inverted. Remove the static setting from the configurator

menschel commented 4 days ago

I think you are getting bitten by SERVO_DSHOT_ESC - you have configured this and so AP will send the dshot commands to reverse, so given that you have already reversed in the configurator the setup will be inverted. Remove the static setting from the configurator

For the test with AP 4.6, I did not reverse the ESC via Configurator. I'm seeing the same issue as before. If ESC is configured normal, then direction is forward. If ESC is configured bi-directional and not reversed, then direction is backwards without reverse-thrust and vice-versa.

The dshot esc is for propeller efficiency measurements and with AM32 I can't go back to PWM controlled modes anyways.

Can I debug this DSHOT stuff somehow via logs?

andyp1per commented 10 hours ago

The ARWingPro (Matek F405 Wing V2 + Holybro Tekko32 F4 45A ESC) still has this test setup.

It works in correct directions with the attached parameter file and ESC set to bi-directional + reversed. The motor direction is also correct if none of the check-boxes is selected, (i.e. not bi-directional and not reversed). AM32 20241027_ARWingPro_ReverseThrottleViaRC5Test.zip

So wait, it works on this setup but not the other?

andyp1per commented 10 hours ago

SpeedyBee F405 Wing Mini

I don't think this supports bdshot, I am not sure what the implication for 3D is. Should work but who knows. Other possibility is that dshot commands are not working properly.

menschel commented 8 hours ago

So wait, it works on this setup but not the other?

Yes the ARWingPro with the ESC set to bi-directional and reversed has a correct working Reverse Thrust. So there is one "reverse" too much in the chain. I assume it's a split throttle range in general and some reverse thrust command working against each other, so one reverse comes from the throttle range and the other likely comes from some command to switch directions. EDIT: I'm not sure about the scaling to -30% reverse thrust though.

I don't think this supports bdshot, I am not sure what the implication for 3D is. Should work but who knows. Other possibility is that dshot commands are not working properly.

Observation tells, no implications, it just does not evaluate the ESC telemetry.