ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

AP_Periph: add RC_SPEED parameter to RC_OUT peripherals

Open tpwrules opened this issue 1 year ago • 1 comments

Like other vehicles, RC_SPEED is used to set the PWM output rate for outputs whose functions are set to MotorN so that ESCs can be driven at a fast speed (490Hz, usually limited to 400Hz) while servos still run at normal speed (50Hz, controlled by OUT_RATE).

Tested the PWM outputs with real devices and a scope. Just checked that DShot and OneShot looked okay on the scope; I don't have real devices to test.

tpwrules avatar Jun 28 '24 00:06 tpwrules

How would issues manifest?

tpwrules avatar Jun 28 '24 13:06 tpwrules

I'm not a fan of the param name. Feels like it needs a "PWM" in it instead of RC

magicrub avatar Jul 05 '24 13:07 magicrub

It is slightly wonky but I took the name from the other vehicles. If we are changing the name I personally would call it ESC_SPEED to fit with the other parameters on periph.

tpwrules avatar Jul 05 '24 14:07 tpwrules

Rebased on top of https://github.com/ArduPilot/ardupilot/pull/27444 . It looks like the call to set_freq probably belongs before SRV_Channels::init as that function makes comments about doing late setup.

In any case, the new version has been tested in flight using both 400Hz Normal PWM and DShot600 with a BLHeli_S ESC and performed great in both cases. I also had a 50Hz servo attached to a different timer on the periph to make sure that functionality still worked. Verified the correct PWM waveforms on the scope too.

tpwrules avatar Jul 08 '24 18:07 tpwrules