I was wondering if there’s interest in supporting alternative RC rates for acro mode beyond the current option of an end-stick rate and expo?
I’ve predominantly flown BF (and still do), so I’d like to keep some of my quads feeling similar.
I looked at the code for calculating the rate and it seems like something I could try adding (mainly for me is understanding how to add a PARAM value)
What rate did you have in mind?
I was thinking of starting with BF rate since it’s ubiquitous.
Ah, it’s the “Betaflight” rate. I’d need to find the exact formula. =)
There are some calculators here for various rate options available in Betaflight. All of these allow for pseudo-independent adjustments of expo curve around center stick and at the edge.
I think this is the formula for the betaflight rate:
Variable names are
rate(x) = 200*((x^4Expo)+x(1-Expo))RC_Rate/(1-(xSuper_Rate))
0 < x < 1 for stick input (if x = 1, there’s a potential for divide by zero)
Super_Rate is < 1 (otherwise formula can go negative)
Rate is <= 2.55
Expo is <= 1 (otherwise formula can go negative)
It’s traced from the formula in this calculator:
Sorry, for some reason the asterisk to show multiplication isn’t appearing in my post; any variable that comes after any ‘x’ is a multiplication.
So bear with me as I’m picking most of this up as I go. I wanted to give an interim update to make sure I’m at least on the right path.
I forked and made a branch of copter4.1 into Copter-4.1_BF_Rate rate in my github, and committed what I believe are all of the changes needed to add betaflight rates. I mostly copied the style of the code around it.
I’m still working on setting up an environment to build this into a binary (so I don’t even know if it’ll compile yet; usually I have typos to iron out). Then either try to figure out the simulator, or just play with this with my quad with props off and a log.
@andyp1per I got a working version of this now. Would you have some time to take look? The changes are pushed to my fork + branch
Tested this on my quad with acro in rate mode with props off with two different rates as I haven’t successfully got a simulator working.
I didn’t go through the entire dev guide… so please let me know of any deficiencies
Can you put up a draft PR - it makes it much easier to review
I also suggest you clean up your commit history: https://ardupilot.org/dev/docs/submitting-patches-back-to-master.html
Thanks, I squashed all of the changes and generated a PR: https://github.com/ArduPilot/ardupilot/pull/18667
My history was really messy because I was editing in windows and using git to sync the files over to WSL2 to compile. So you got to see all my typos and meandering