Refactor Feedforward Angle and RC Smoothing - mashup of 12578 and 12594 (#12605)
commit34057bfbc24c121795f0038af33c90c7952fe533
authorctzsnooze <chris.thompson@sydney.edu.au>
Sun, 23 Apr 2023 20:03:18 +0000 (24 06:03 +1000)
committerGitHub <noreply@github.com>
Sun, 23 Apr 2023 20:03:18 +0000 (23 22:03 +0200)
tree4ca4596cb6bd95ff0a1a125e1da7608376291305
parent445758f3ec351b07c1ea77e4883a7cd4804fc7ad
Refactor Feedforward Angle and RC Smoothing - mashup of 12578 and 12594 (#12605)

* Refactor Feedforward Angle and RC Smoothing

* update rc_smoothing at regular intervals

* add Earth Ref to OSD, update pid and rate PG

* Initialise filters correctly

* refactoring to improve performance

* Save 24 cycles in Horizon calculations, other optimisations

At a cost of 40 bytes

* save 25 cycles and 330 bytes in rc_smoothing

* feedforward max rate improvements

* typo fix

* Karatebrot's review suggestions  part one

* Karatebrot's excellent suggestions part 2

* more efficient if we calculate inverse at init time

Co-Authored-By: Jan Post <post@stud.tu-darmstadt.de>
* Horizon delay, to ease it in when returning sticks to centre

* fix unit tests after horizon changes

Co-Authored-By: 4712 <4712@users.noreply.github.com>
* horizon_delay_ms, default 500

* fix unit test for feedforward from setpointDelta

* Final optimisations - thanks @Karatebrot for your advice

* increase horizon level strength default to 75 now we have the delay

* restore Makefile value which allowed local make test on mac

---------

Co-authored-by: Jan Post <post@stud.tu-darmstadt.de>
Co-authored-by: 4712 <4712@users.noreply.github.com>
19 files changed:
make/source.mk
src/main/blackbox/blackbox.c
src/main/cli/cli.c
src/main/cli/settings.c
src/main/cms/cms_menu_imu.c
src/main/fc/controlrate_profile.c
src/main/fc/controlrate_profile.h
src/main/fc/parameter_names.h
src/main/fc/rc.c
src/main/fc/rc.h
src/main/fc/rc_controls.h
src/main/flight/feedforward.c [deleted file]
src/main/flight/feedforward.h [deleted file]
src/main/flight/pid.c
src/main/flight/pid.h
src/main/flight/pid_init.c
src/main/flight/pid_init.h
src/test/unit/cli_unittest.cc
src/test/unit/pid_unittest.cc