Renamed/repurposed the "D Setpoint" adjustment to be "Pitch & Roll F Adjustment" and have it simultaneously adjust pitch and roll.
Renamed the "D Setpoint Transition" adjustment to be "Feedforward Transition" - no functionality changes.
Added adjustments for the individual Pitch, Roll and Yaw axes.
Restructures the PID controller to decouple feedforward from D.
Cleaned up the structure of the PID controller; moved some feature-based enhancements out of the main structure.
Feedforward becomes a separate component of the PID controller and there is now:
f_pitch
f_roll
f_yaw
The default values of 60 for pitch and roll matches the default setpoint weight used in BF3.4. Yaw previously had no setpoint weight capability so the default here needs to be discussed. Currently it's also set to 60 and flight testing seems positive. Feedforward on yaw adds a lot of value so I don't think we want to default to 0. Instead we need decide on the default.
All occurences of setpoint weight have been replaced by feedforward. "setpoint_relax_ratio" has been renamed to "feedforward_transition".
The pidSum now consists of P + I + D + F.
D has been added back for yaw (disabled by default with d_yaw = 0). We've found little need for D for normal quads but it may have value for other configurations - particularly tricopters.
Updated CMS menus to support adjusting the feedforward for each axis.
Changed the default for "rc_interp_ch" to be "RPYT". Need yaw to be smoothed to support feedforward.
Open issues:
Needs BFC support
- Need to add support for the axis "F" gains.
- Remove "setpoint weight" slider.
- Rename "D Setpoint transition" to "Feedforward transition"
Needs BBE support
- Header "setpoint_relaxation_ratio" has been renamed "feedforward_transition"
- Header "dterm_setpoint_weight" has been replaced with an array named "feed_forward_weight".
example: H feed_forward_weight:65,60,60 (R,P,Y)
- PID component "AXISF" has been added for all axes. Should be handled like P, I and D values.
- PidSum calculation needs to include F.
Needs LUA script support
- Support the renamed "setpoint_relax_ratio".
- Support for feedforward weight on all 3 axes.
Open code issues:
- rc_adjustments.c - support for adjusting feedforward weight for all axes. Currently only supporting roll - needs coordination with BFC.
Improves performance of the dynamic notch filter, increasing peak accuracy over a wider band of frequencies, and generally using a narrower, higher notch.
Details:
- FFT now operates on gyro data *after* gyro notches and lowpasses
- FFT bandpass Q changed from 0.707 to 0.05, to 'open up' the FFT to a greater range of incoming frequencies
- FFT centre output now ranges from about 130 to 666Hz.
- ignore the lowest couple of FFT bins going into centre frequency calculation
- analyse FFT bins from low to high, keep ignoring bins until a bin is found that exceeds its previous bin by a factor of 2; then start examining bins from the bin before that (stops the FFT from being biased low, or going to the lowest value if there is no notch at all).
- if no bin exceeds previous by more than 2 times, ie no obvious peak, smoothly go to maximum allowed notch frequency to avoid delay (might be better to bypass filter altogether?)
- dominant bin emphasised by cubing bin height before calculating mean
- maximum cutoff frequency is half the highest allowable centre frequency
- default notch width is +/-25% of centre, narrower than before most of the time
- code tidied up
- thanks to rav, Flint, UAV Tech, icr4sh, diehertz and everyone else who helped with this.
Improves performance of the dynamic notch filter, increasing peak accuracy over a wider band of frequencies, and generally using a narrower, higher notch.
Details:
- FFT now operates on gyro data *after* gyro notches and lowpasses
- FFT bandpass Q changed from 0.707 to 0.05, to 'open up' the FFT to a greater range of incoming frequencies
- FFT centre output now ranges from about 130 to 666Hz.
- ignore the lowest couple of FFT bins going into centre frequency calculation
- analyse FFT bins from low to high, keep ignoring bins until a bin is found that exceeds its previous bin by a factor of 2; then start examining bins from the bin before that (stops the FFT from being biased low, or going to the lowest value if there is no notch at all).
- if no bin exceeds previous by more than 2 times, ie no obvious peak, smoothly go to maximum allowed notch frequency to avoid delay (might be better to bypass filter altogether?)
- dominant bin emphasised by cubing bin height before calculating mean
- maximum cutoff frequency is half the highest allowable centre frequency
- default notch width is +/-25% of centre, narrower than before most of the time
- code tidied up
- thanks to rav, Flint, UAV Tech, icr4sh, diehertz and everyone else who helped with this.