1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00
Commit graph

34 commits

Author SHA1 Message Date
phobos-
8ce268d5f1 Implemented NFE Race Mode 2020-02-16 13:46:08 +01:00
Bruce Luckcuck
f584780944 Gyro native rate sampling, filtering, and scheduler restructuring 2020-02-04 18:19:35 -05:00
Michael Keller
69a3a4ac08
Merge pull request #9315 from hydra/bf-log-disarm-reason
Log disarm reason.
2020-01-17 19:30:37 +13:00
Dominic Clifton
2fead0aedf Log disarm reason. 2020-01-16 20:16:11 +01:00
Michael Keller
71661acde2 Changed 'ASSERT_' in unit tests to 'EXPECT_' for more comprehensive failure reporting. 2019-12-27 14:30:24 +13:00
Thorsten Laux
91ad2498ff ff from interpolated setpoint 2019-08-08 09:50:18 +02:00
Michael Keller
b468b94995
Merge pull request #7924 from mikeller/add_crash_recovery_disarm
Added 'disarm' option to crash recovery.
2019-04-14 21:49:05 +12:00
mikeller
760a524027 Fixed tests, added crash indication. 2019-04-05 08:39:23 +13:00
Thorsten Laux
11c21368c8 remove smart_feedforward 2019-03-08 06:49:09 +01:00
mikeller
b578801208 Fixed conditional scope.
Fix unit tests.
2019-03-08 12:46:48 +13:00
ctzsnooze
0f8c85ad0d Update unit test values for higher relax threshold
Update unit test values for higher relax threshold
2019-03-03 11:34:07 +11:00
mikeller
03dc1a1aee Fixed tests. 2019-02-28 19:52:11 +13:00
ctzsnooze
1d998ea404 iTermRelaxFactor now only attenuates amount added
The original setpoint based iTerm Relax code attenuated the amount of iTerm added per loop by a relax factor based on an HPF of setpoint.
At some point the code was re-factored and the relax factor multiplied the accumulating iterm error itself, such that almost any relax factor below 1.0 would quickly zero out iTerm.
This was bad for racing because when making sustained tight turns, I would abrubtly be zeroed when the setpoint for the starting of some relax was close to the threshold.
This was never the intent of the original proposal, which was for a smoother attenuation of iTerm, and for retention of some accumulation of iTerm during spirals around poles etc.
This PR fixes that error.
It also changes the default threshold up from 30 deg/s to 40 deg/s which better suits racing.
Also included us a form of simple cutoff independence. In the initial form, lowering cutoff would reduce the effectiveness but draw out the duration.  Now cutoff only really affects duration.
Lower cutoff values are better for quads with greater motor delay, faster values are better for quicker quads. For most of my quads a cutoff of 30 works best.
I've also removed newlines.

set to current cutoff maybe fix unit test

default cutoff set to current value

in unit test add itermRelaxSetpointThreshold as float

in unit test add itermRelaxSetpointThreshold as float, because ITERM_RELAX_SETPOINT_THRESHOLD doesn't exist any more

Move itermRelaxFactor limit, remove from fast ram

remove unncessary max, revert unit test changes, restore original defaults.

remove max from debug
restore old defaults and revert unit test changes temporarily to see if will pass unit test with defaults

whoops

lets see if unit test passes when cutoff is 20

lets see if unit test passes when cutoff is 20
2019-02-28 19:51:50 +13:00
mikeller
b5908f5bab Applied 'USE_ACC' consistently. 2019-02-08 09:51:48 +13:00
Bruce Luckcuck
3d671c7134 Use fabsf() instead of ABS() for floats
The ABS() macro doesn't handle -0 floats correctly. Also fabsf() is more efficient.
2019-01-19 14:15:54 -05:00
Thorsten Laux
b0af988a75 unit test bugs 2018-12-10 19:28:18 +01:00
Thorsten Laux
e63cb48adf unit test fix 2018-12-10 10:51:45 +01:00
Bruce Luckcuck
bb834bb126 Prevent crash recovery detection immediately after entering self-level modes
If the quad is in an extreme orientation (like upside down) the transition to self-level modes can cause enough motion to trigger crash recovery. Added a 1 second delay during which crash recovery detection is blocked immediately after entering a self-level mode.

This also addresses an issue with GPS Rescue as when it activates it enables self-level. If in the above scenario this triggered a crash recovery detection then GPS Rescue would interpret this as a crash and immediately disarm.
2018-11-02 23:43:41 -04:00
Bruce Luckcuck
b723d2976d Changes from review and add unit tests
Stylistic updates and add tests to the PID unit tests to verify launch control behavior
2018-10-30 18:14:49 -04:00
Bruce Luckcuck
e4dc93b128 Launch Control
Adds a race start assistance system that allows the pilot to pitch forward and then release the sticks with the quad holding position for the race start.
2018-10-27 11:50:37 -04:00
borisbstyle
87b2eeb2fd More isolated pid_unittests
Refactor iterm_relax to iterm_relax_axis

Isolate pidLevel test

Isolate pidHorizon tests

remove if UNIT_TEST

revert to iterm_relax from iterm_relax_axis
2018-09-19 08:15:32 +02:00
borisbstyle
afccf50d96 Add Iterm Relax unittest // refactor
Refactor PID code Iterm Relax and Absolute control

Move defines for unittest to Makefile

Fix unittest isAirmodeActivated()

Absolute control unittests + optimizations

Fix dead code absolute control // unittests

Further optimizations to absolute control switch logic
2018-09-12 08:09:21 +02:00
borisbstyle
aa44fd6bbd Change default iterm_windup 2018-09-10 23:38:40 +02:00
borisbstyle
00dbaf9fa7 Cleanup code // add unittestst for iterm windup 2018-09-10 23:38:39 +02:00
borisbstyle
864a2d6a2b Fix bug with antiwindup inversion 2018-09-10 09:08:36 +02:00
borisbstyle
a85eecf42d Add feedforward tests 2018-08-28 10:06:48 +02:00
borisbstyle
5b7209329b Add tolerance for feedforward 2018-08-28 08:44:06 +02:00
mikeller
0bce8549ee Renamed 'fc/fc_' files to remove the double 'fc'. 2018-08-26 14:07:06 +12:00
Bruce Luckcuck
17e76e48f6 PID controller feedforward
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.
2018-07-21 10:26:23 -04:00
ctzsnooze
4c917efa50 Smooth anti gravity 2018-07-21 23:49:41 +12:00
mikeller
00228427da Set yaw D default to 0 since it is unused anyway. 2018-06-30 15:25:50 +12:00
Thorsten Laux
7e12e9da18 don't link debug.c to pid unit test 2018-05-28 16:40:09 +02:00
s0up
de5fa47c4c navigation feature / reference removal 2018-05-09 10:28:36 -07:00
borisbstyle
8fab0fee11 PID controller unittest 2018-04-22 16:10:17 +02:00