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

652 commits

Author SHA1 Message Date
Kenneth Mitchell
f6e456cd06
Allow dyn lpf to initialize if static lpf config is 0.
Change min > max per review.

Fix missing ifdef.
2019-01-15 16:48:21 -05:00
ctzsnooze
7e3e5649e1 DTERM_CUT
This code cuts D by a specified percentage durning normal flight.

It lets D smoothly rise up to normal during rapid gyro moves like flips and rolls, and increase during prop wash events.

D should now be tuned to values the 'normal' 30-45 range.

If D is 40, a dterm_cut_percentage of 65 will cut D to 14 in normal flight, but the quad will still get full 40 of D to control bounce-back after flips and about 25 of D during strong prop wash.

The dterm_cut_percentage can be adjusted via the OSD, from the D filtering page.
Adding d_cut results in cooler motors, lower amounts of noise in motor traces and faster reactions to quick stick inputs.

Too high a dterm_cut_percentage may bring out P oscillation from lack of D.  Values of 70% are generally OK.

Input is gyro differential (delta).  Frequencies above 40hz (above propwash) are attenuated with a configurable (dterm_cut_range_hz) biquad filter.  Lower values for range can be used if the quad is very noisy or gets low frequency D resonant oscillation.  Up to 50 or 60hz may suit clean quads where prop wash control is the main priority.  Too high a range value results in D being boosted from noise in normal flight.

The boost signal is 'integrated, smoothed and delayed' with a 7hz PT1 'dterm_cut_lowpass_hz' filter.  The default of 7Hz gives about the right amount of smoothing and delay.  Higher numbers cause the boost to come on faster, with less delay. Lower values delay the boost effect and cause it to last longer.

The dterm_cut_gain amount controls the strength of the boost effect by amplifying the input to the boosting effect.  If the quad is flow gently, a higher gain value may be needed to gain full boost.

Logging with set debug_mode = D_CUT allows recording of realtime D values on roll and pitch into debug 2 and 3.  The reatime D value should reach its set maximum during rapid turns, ideally at about the time D itself peaks.  If it fails to reach the maximum, gain should be increased.

The D_Cut feature is not enabled on LUXV2RACE, OMNIBUS, SPRACINGF3NEO because there isn't enough flash space.
2019-01-12 21:09:03 -07:00
Michael Keller
a136f0b7e0
Merge pull request #7304 from joelucid/linear_pids
Thrust Linearization
2019-01-09 09:08:06 +13:00
Thorsten Laux
9ef95bb84d address code review comments 2019-01-08 09:50:26 +01:00
Thorsten Laux
998845be3e prevent divide by zero 2019-01-07 15:52:57 +01:00
Thorsten Laux
8d4ed72e13 rpm telemetry based notch filter 2019-01-07 13:36:01 +01:00
Thorsten Laux
ad253c146b add Thrust Linearization feature 2019-01-03 15:09:17 +01:00
Michael Keller
60118da63f
Merge pull request #6432 from joelucid/integrated_yaw
For discussion: Integrated yaw control
2018-12-15 18:40:00 +13:00
Thorsten Laux
906a697668 make iyaw conditional, bump pidProfile version number 2018-12-11 08:28:53 +01:00
Thorsten Laux
8bcc4dab64 fix indentation and pidProfile version number 2018-12-11 08:18:51 +01:00
Thorsten Laux
17a995e03e fix abs control refactor, make abs control cutoff configurable 2018-12-10 09:05:20 +01:00
Thorsten Laux
d4512672fe Move to pid.c, add relax to offset drag based component, make configurable 2018-12-09 14:21:44 +01:00
Kenneth Mitchell
233ac7fb3f
Allow width=0 to select single notch. Restore dyn lpf mins. 2018-12-02 10:01:51 -05:00
Kenneth Mitchell
011eae93c6
Cascaded notch filters. 2018-12-02 09:52:02 -05:00
Michael Keller
4246f06529
Merge pull request #7073 from ctzsnooze/Update-D-defaults
Set TPA default to D only, increase D about 10%
2018-11-25 13:31:29 +13:00
Bruce Luckcuck
932b8e01c8 Launch Control: Add yaw iterm windup limit
When operating in `launch_control_mode = FULL` mode (all axes), limit the yaw iterm to reduce the risk of windup.
2018-11-14 17:23:20 -05:00
ctzsnooze
51ff89ed99 Set TPA default to D only, increase D about 10% 2018-11-11 21:44:18 +11:00
Bruce Luckcuck
357d19aa05 Move parameter from PID profile to rate profile 2018-11-09 08:05:40 -05:00
Bruce Luckcuck
fc189e5850 Make TPA configurable to affect P/D or D only
Adds a new `tpa_mode` parameter that accepts `PD` (default) and `D`. Allows the user to configer to affect P/D as it always has, or switch to D-only mode.

Note: the `tpa_mode` parameter was added to the PID Profile instead of rate profiles with the other TPA parameters. This can be discussed, but I didn't think it made sense to have this be part of rate profiles as it affects PID tuning (the same argument could be made for the other TPA parameters).

Code is wrapped in `USE_TPA_MODE` so it can be disabled if needed.
2018-11-08 19:22:29 -05:00
borisbstyle
7566f81d38
Merge pull request #6911 from jflyper/bfdev-move-USE_ITERM_RELAX-to-include-USE_ABSOLUTE_CONTROL
Move USE_ITERM_RELAX up to prevent unused warning of applyAbsoluteControl
2018-11-08 11:50:13 +01:00
Michael Keller
863ee8d114
Merge pull request #7034 from etracer65/level_mode_crash_recovery_delay
Prevent crash recovery detection immediately after entering self-level or GPS Rescue modes
2018-11-04 13:38:17 +13:00
Bruce Luckcuck
13e06d6e30 Reset the crash recovery guard time whenever GPS Rescue is activated
So now the guard time will be set either:
* When changing from level-mode off to on (angle or horizon modes)
* GPS Rescue activates
2018-11-03 19:42:34 -04: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
cca3b30a77 Reduce runaway takeoff deactivate throttle to 20%
In recognition that the average quad is getting more powerful and can hover at a lower throttle.
2018-11-02 16:23:50 -04:00
Michael Keller
c0344496ca
Merge pull request #6992 from etracer65/launch_control
Launch Control
2018-11-02 00:49:42 +13: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
ctzsnooze
de8df24857 Increase default amount of I for 4.0 2018-10-30 12:14:15 +11: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
Kenneth Mitchell
ff8d1a842a
Fixes from reviews. 2018-10-25 20:34:55 -04:00
Kenneth Mitchell
ca460e842b
Implement throttle based dynamic gyro and dterm filters. 2018-10-25 19:23:14 -04:00
Steffen Windoffer
f45ab5bb0a cleanup dterm lowpass order 2018-10-20 15:12:40 +02:00
Kenneth Mitchell
641d0a2e54 Implement biquad on 2nd dterm lowpass filter. 2018-10-14 13:34:11 -04:00
jflyper
f00a8e6d0f Move USE_ITERM_RELAX to prevent unused warning of applyAbsoluteControl 2018-10-09 12:42:58 +09: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
ctzsnooze
299a2d6b8b whitspace 2018-09-15 12:28:41 +10:00
ctzsnooze
ac5d2fbb3a set default to original 40% 2018-09-15 12:20:00 +10:00
ctzsnooze
37da70c555 rebase and recheck 2018-09-15 12:19:53 +10:00
ctzsnooze
80608f5f1c camelCase fix, else added, getMotorMixRange directly 2018-09-15 11:57:47 +10:00
ctzsnooze
586e674898 get motorMixRange only when needed, default inv to 1, editorial 2018-09-15 11:57:47 +10:00
ctzsnooze
942d1bb384 add const, remove float cast 2018-09-15 11:57:47 +10:00
ctzsnooze
f545637669 defaults to improve yaw behaviour, ITermWindupPointInv already defined at zero 2018-09-15 11:57:46 +10: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
Bruce Luckcuck
9cf671b817 Change dterm_notch_cutoff default to 0
The dterm notch is disabled and dterm_notch_hz is already 0 by default. When the Configurator saves changes from the PID Tuning tab and the notch is disabled it sets both dterm_notch_hz and dterm_notch_cutoff to 0.  Since the default was left at 160, this makes dterm_notch_cutoff appear in diff outputs.  Ultimately it's just cosmetic since the dterm notch is disabled if either value is zero.  But there's no reason for the dterm_notch_cutoff to remain set to the legacy 160 value.
2018-09-10 08:07:27 -04:00
Michael Keller
c71b1cb0df
Merge pull request #6721 from betaflight/anti_windup_fix
Fix bug with antiwindup inversion
2018-09-10 20:51:15 +12:00
borisbstyle
864a2d6a2b Fix bug with antiwindup inversion 2018-09-10 09:08:36 +02:00
ctzsnooze
acbc041259 use the defined value in both places 2018-09-10 16:52:27 +10:00
Bruce Luckcuck
960442e917 Fix iterm relax interfering with crash recovery
Iterm Relax was inserted before crash recovery and this was causing the recovery to be ineffective or fail completely. The problem was that the subsequent iterm calculation was not using the calculated recovery error and instead was using the setpoint error. As such I ended up accumulating and opposing P based on recovery error. This prevented the efforts of crash recovery to level the quad and since it couldn't reach the level state crash recovery wouldn't shut off. This resulted in the pilot only having control over yaw and throttle while crash recovery was still ineffectually trying to control roll/pitch.

The fix is to move crash recovery handling ahead of the iterm relax calculations and make sure that iterm relax uses the error calculated from crash recovery if active.  This also allows crash recovery to reset the iterm accumulation as originally designed.
2018-09-02 09:58:16 -04:00
mikeller
0bce8549ee Renamed 'fc/fc_' files to remove the double 'fc'. 2018-08-26 14:07:06 +12:00