sim- / tgy

tgy -- Open Source Firmware for ATmega-based Brushless ESCs
http://0x.ca/tgy/
688 stars 387 forks source link

Active braking feature (for multicopter) #28

Open lakeroe opened 10 years ago

lakeroe commented 10 years ago

I'm interested in an active breaking feature (for multicopter). As far as I understand COMP_PWM = 1 enables active freewheeling which helps braking a bit. You already implemented the "Enable brake during neutral/idle (MOTOR_BRAKE = 1) Feature". Do you have any plans or is it possible to extend it to "real" active breaking (not only when idle) ?

lakeroe commented 10 years ago

Answer from SimonK per mail:

Active braking described in this way would require closed loop drive within the ESC, since there would need to be a controller to apply the brakes based on timing feedback. As such, the system would have to be in a control mode by speed, since otherwise we would not know when to brake.

I have thought about adding this, but I have two concerns: The difficulty involved in properly calibrating the maximum RPM (and thus scaling of the input) with full expected load, and timing interactions with such a system and a similar loop already present in the flight controller. There would need to be tunables for the controller and the input scaling, making the system quite complicated and likely difficult to tune.

Ultimately, complementary PWM implements the complementary side of applying power and braking. The only thing that prevents it from being completely symmetric is perhaps that MOTOR_BRAKE=1 is stronger than the equivalent of what would be 0% duty cycle with COMP_PWM=1. I was thinking of adding this mode, but, in a way, it already works with the flight controller keeping the output range above idle when mixing motor outputs.

Regardless, the output of such a speed controller is effectively what the flight controller is already trying to achieve. So, I'm not yet convinced that adding an additional loop will actually help. The only difference is that such a system could reduce under/over-shoot of the motor speed before the resulting thrust can be measured, but I'm not sure this is actually what is wanted for stable flight. Perhaps it allows to work separately with the frequency response of the motor bell/propeller versus that of the frame.