1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 00:35:39 +03:00
Commit graph

67 commits

Author SHA1 Message Date
ctzsnooze
254da8f460
Altitude hold for 4.6 (#13816) 2024-09-04 20:29:03 +10:00
ctzsnooze
f2bd6e69b2
Feedforward improvements for 4.6 (#13576)
* feedforward update for 4.6

improve jitter reduction method
don't interpolate CRSF protocol
replace 'boost' with highpass element for yaw FF
make yaw highpass element CLI adjustable
add yaw feedforward sustain params to CLI and BBE
refactoring and unit test fix

* implement review suggestions, start on the filter struct

* Attempt PT1 filter init method

* fix silly error, scale time constant correctly

improve gain linearisation at shorter time constants

* fix averaging init

* Review suggestions from PL

* Improve filter initialisation

much better :-)

* re-name prevPacketDuplicate to prevPacketWasADuplicate

* Add review comments - thanks Jan and Mark!

* cast gyro.gyroDebugAxis to int

* A better fix than int cast

* implement review comments from PL

also hopefully improved some comments.

* increase PG to 10, expecting the Disarm PR to use 9

* two always win against one ;-)

* remove inappropriate comment, remove space

* update comments and review suggestions from PL
2024-08-25 09:34:27 +02:00
tbolin
ae71256da7
Throttlebased EzLanding (#12094)
* ezLanding

* Add ez_landing throttle mode

* Correct EzLanding scaling of motorMixRange

* Correct mixer_type switch bracing style

* Remove motor value cliping ez landing mode

- rename mixer type cli setting to EZLANDING from EZLANDING_THROTTLE
- remove EZLANDING_CLIP cli setting
- double default ez_landing_threshold
- halve default ez_landing_limit
- check  and  limits in cli settings
- remove mixer type dependent settings in mixer_init
- remove clip based code in mixer.c

* Change ez_landing setting values and refactoring

- Halve defaul ez_landing_threshold setting and double in init instead.
  Now stick deflection equal to ez_landing_threshold should give approimately full authority.
  Previously it was the point where the mixer was allowed to raise the throttle to 100 % (which wouuld never be required)
- Increase ez_landing_threshold maximum to 200 (from 100) to allow settings that increase authority by a little at full stick deflection
- Increase ez_landing_limit maximum to 75 which is the point where EzLanding should act identical to the Legacy mixer with airmode on
- remove throttle percent from
- simplify calculation of , since throttle stick deflection is no longer involved
- update/remove outdated comments

* Remove old EZLANDING entries in mixerType enum

* Add mixer_type setting to blackbox log header

---------

Co-authored-by: ctzsnooze <chris.thompson@sydney.edu.au>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2023-12-09 02:36:41 +01:00
ctzsnooze
34057bfbc2
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>
2023-04-23 22:03:18 +02:00
ctzsnooze
241e9a9b94
Angle and Horizon Mode improvements (#12231)
* Angle and Horizon Update for 4.5

* BugFix FF noise Angle Mode on yaw and in level _race mode

* use time constant in ms for angle feedforward smoothing

* refactor to remove unnecessary definition

---------

Co-authored-by: ChrisRosser <chrisrosser91@gmail.com>
2023-03-15 09:46:24 +11:00
ctzsnooze
4528fc2b70 use PWM_RANGE consistently 2022-10-23 21:52:36 +11:00
haslinghuis
7e441b5f4f
Merge pull request #11887 from KarateBrot/styledef
Remove old style definitions
2022-10-16 00:22:02 +02:00
Mathias Rasmussen
34ee2f67c9 Use lrintf to round floats to integers 2022-10-14 02:28:30 +02:00
KarateBrot
ddf1d46549 Remove old style definitions 2022-10-13 03:33:54 +02:00
Mathias Rasmussen
61ded491cd Use std abs() instead of ABS() macro
Changes uses of ABS() macro to <stdlib.h> abs() and <math.h> fabsf()
2022-10-12 19:49:03 +02:00
Mathias Rasmussen
9957ceb275 Fix function brace style 2022-10-12 16:31:55 +02:00
Hugo Chiang
0088eb5f21 switch case cleanup
Co-Authored-By: Petr Ledvina <ledvinap@gmail.com>
Co-Authored-By: haslinghuis <mark@numloq.nl>
2022-08-30 07:04:55 +08:00
ctzsnooze
6aaaf727ff update antigravity for 4.4, no boost on yaw
Update to anti-gravity, including removal of the old Step mode, ability to adjust the P contribution (thanks @Limon), PT2 smoothed derivative model, inherent limiting of P boost during extremely fast stick travels to minimise P oscillations, less I during the middle of a throttle up, no I boost on yaw, add hz to cutoff labels

No antigravity on yaw, fix longstanding typo

h
2022-07-25 11:37:07 +10:00
J Blackman
00cd0e52e6
Merge pull request #11126 from mathiasvr/pr-int-exp
Use macros for power with integer exponents
2022-06-28 15:28:35 +10:00
Steve Evans
07f6bea174 Fix failsafe timings and behaviour to match Failsafe.md 2022-03-30 18:29:21 +01:00
Štěpán Dalecký
d296853797 Fix compilation without RC smoothing enabled 2022-03-14 19:33:40 +01:00
ctzsnooze
2262dfc60e use Throttle Setpoint, not rcDATA(throttle), for TPA 2022-01-25 18:37:01 +11:00
Mathias Rasmussen
1b95e3c20f Use macros for power with integer exponents 2021-12-14 11:53:09 +01:00
Štěpán Dalecký
564421ce1c Debug modes cleanup 2021-12-04 18:43:05 +01:00
Michael Keller
760e08e7cd
Merge pull request #10832 from daleckystepan/rx_lower_rates 2021-09-10 02:24:52 +12:00
ctzsnooze
4ef02928e0 smoothing fix level mode 2021-09-01 11:22:11 +10:00
Štěpán Dalecký
ad4ea581fc Suport for long range RC links with refresh rate lower than 33Hz down to 16Hz 2021-08-31 17:55:56 +02:00
Michael Keller
6aa40c1272
Merge pull request #10805 from ctzsnooze/feedforward-fix-at-centre-and-renaming 2021-08-04 12:59:41 +12:00
ctzsnooze
45ff9ea1e5 fixes for feedforward for 4.3 2021-08-03 23:32:34 +10:00
Michael Keller
4019ee5130
Merge pull request #10848 from knoopx/fix-compile-no-feedforward
fix: compile error when USE_FEEDFORWARD is undefined
2021-08-04 00:59:31 +12:00
ctzsnooze
271bcf9d55 fix feedforward when fpv camera angle set 2021-07-26 14:53:56 +10:00
Victor Martinez
95eca6abdb fix: compile error when USE_FEEDFORWARD is undefined 2021-07-21 13:20:02 +02:00
ctzsnooze
636d563abe major rc changes ctzsnooze 2021 2021-05-07 14:40:43 +10:00
Michael Keller
a53f2a60a5
Merge pull request #10711 from mikeller/remove_powerf
Remove unneeded library function 'powerf()'.
2021-04-28 01:28:43 +12:00
ctzsnooze
d4f0ec2d0a feed forward jitter improvements 2021-04-27 12:47:06 +10:00
Michael Keller
3ae7e917b7
Merge pull request #10707 from klutvott123/rc-data-float 2021-04-27 01:48:20 +12:00
Hans Christian Olaussen
8c28533c69 Preserve resolution of RC input 2021-04-26 15:14:58 +02:00
mikeller
6b87b3685c Remove unneeded library function 'powerf()'. 2021-04-26 16:50:54 +12:00
ctzsnooze
a096c99664 PT2 and PT3 filter maths PT3 for RC smoothing 2021-04-26 14:12:54 +12:00
ctzsnooze
34096c50f0 remove non-required parameters, simplify calling FF recalculation 2021-03-22 18:24:56 +11:00
Nicola De Pasquale
979dabf637 added option for expo on rc command 2020-10-29 18:07:32 +01:00
Sam Lane
4c99ad743d Rename FAST_RAM to FAST_DATA 2020-08-23 08:49:26 +01:00
Bruce Luckcuck
c06106e2d1 Split initialization from pid.c for flash savings
Move low performance requirements initialization code into pid_init.c and optimize that for size.

Saves 2688 bytes for target STM32F7X2.
2020-05-03 13:58:55 -04:00
Nicola De Pasquale
cfe7272050 moved some variables 2020-03-13 23:40:02 +01:00
Nicola De Pasquale
57a5fd937a precalculate divisors in initRcProcessing 2020-03-13 20:18:16 +01:00
Nicola De Pasquale
04e5e3bf24 max rate independent of deadband 2020-03-13 20:15:05 +01:00
mikeller
1852d65106 Generalised frame rate calculation. 2020-03-11 12:47:27 +13:00
mikeller
d13e83b91b Cleaned up the RX handler some. 2020-03-10 00:55:52 +13:00
Nicola De Pasquale
fbcdeb5be6 quick rates 2020-03-04 13:45:56 +01:00
ctzsnooze
19694902fe SEnsitivity to 10 deg/s on both 2020-02-25 12:45:09 +11:00
ctzsnooze
b61d641bfc Set actual rates in deg/s, independently of each other
Each parameter is independent.
Set actual centre sensitivity and actual max rates.
For:
Centre sensitivity of 200 = rcRate of 1.0; enter as 2.0 in Config, 200 CLI
Max Rate of 800, enter sRate as 0.8 in Config, 80 in CLI
Expo enter as usual, 0.5 approximates no expo, 0 is flatter, 1 is about the same as 0.5 expo usually, but won't change centre sensitivity.
2020-02-22 11:31:15 +11:00
jflyper
ff16686893 White space tidy 2020-02-17 23:54:57 +13:00
Bruce Luckcuck
653fe308cb Add "auto" mode to yaw spin recovery
Changes yaw spin recovery from a simple on/off to on/off/auto. In auto mode the triggering threshold is automatically calculated based on the user's current max yaw rate.

So `yaw_spin_recovery` has the following options:
`OFF`: Feature is disabled
`ON`: Feature is enabled with a manually configured `yaw_spin_threshold`
`AUTO`: Feature is enabled and the trigger threshold is automatically calculated.

The auto calculation of the trigger threshold is:
```
MAX(yawRate * 0.25, 200)
```
The 25% of the user's rate is to provide a buffer for yaw overshoots during normal flight. Overall the threshold is constrained between 500 - 1950 to match the manual selection.

The default is changed from `ON` to `AUTO` so that users will get protection without needing to configure the threshold manually.

In `AUTO` mode the threshold is calculated dynamically so rate changes in flight (like rateprofile change) will set a new trigger threshold.
2020-02-05 23:55:31 -05:00
Nicola De Pasquale
54f46c9327 antigravity gain decoupled from Iterm 2020-01-19 13:28:06 +01:00
Bruce Luckcuck
b2a50819a3 Update RC smoothing "auto" settings to consider interpolated feedforward
Allows default settings for RC smoothing to work seamlessly regardless of the feedforward type selected ("classic" vs. interpolated).

Adds a new "AUTO" setting for the derivative filter type that will select based on whether interpolated feedforward is enabled (use PT1) or not (use BIQUAD). The derivative filter cutoff if set to auto (0) will also use a fixed cutoff calculated from a 100hz base if interpolated feedforward is enabled. Otherwise if classic FF is active then it will default to the previous method of calculating the cutoff based on the RX frame rate.
2019-11-30 19:06:44 -05:00