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

652 commits

Author SHA1 Message Date
Michael Keller
9ae3845919
Merge pull request #9705 from ctzsnooze/Increase-default-yaw-P
Increase default Yaw P to 45
2020-04-20 01:10:37 +12:00
ctzsnooze
a3091751fe Enables expo on the D lowpass filter at 5
Most people who have tested IllusionFPV's expo on the dynamic D lowpass filter have found it to improve propwash without adverse effects.

It achieves this reducing D lowpass delay more quickly on throttling up.

This allows us to retain, at idle, the strong lowpass filtering we currently have, but quickly reduce lowpass delay and improve propwash by mid throttle.

A value of 5-7 is OK I'm proposing 5 as a conservative start.

I know this is a new feature but it is really good .  It would be great if it could be made active by default, if possible, in 4.2.
2020-04-15 10:28:29 +10:00
ctzsnooze
9c99eed602 Default Yaw P to 45 2020-04-14 17:38:57 +10:00
Bruce Luckcuck
fb034c22e7 Revise pid_process_denom default logic - 2nd try
Now with the motor protocol defaulting to DISABLED we can reimplement this.

Remove dependence on gyro type and base on MCU type.

The previous logic was based on expecting an 8K sampling gyro and would set an inappropriate loop time for other gyro types.

Change the logic to be based on the capabilities of the MCU which is more appropriate. We set the pid_process_denom default to the maximum recommended value for a given MCU.

The `pid_process_denom` will be defaulted as follows (assuming a 8khz gyro) based on MCU type:

MCU	`pid_process_denom`
F1:	8 (1khz)
F3:	4 (2khz)
F411:	2 (4khz)
Others:	1 (8khz)

Of course the final PID loop rate will be based on the native sample rate of the gyro.
2020-04-11 20:23:43 -04:00
ctzsnooze
8f7db49515 increase dMin values 20,22 to 23,25 2020-04-06 18:07:59 +10:00
ctzsnooze
6f198b84ab Increase D_Min gain to improve D behaviour on most quads 2020-04-01 10:33:54 +11:00
ctzsnooze
d63ba914c6 motor output scale
First draft

Change method to percentage compensation

fast sag filter with fast battery updates

Renaming, moving factors to init where possible

Names changed, display update frequency reverted to 50hz as it was

50Hz ESC Voltage sampling, battery sag lowpass for PID compensation.

increment PG_PID_PROFILE, element added to end of batteryConfig_t

all HZ_TO_INTERVALs set back to 200 to match battery task frequency of 200hz.

Add a flag to control vbat comp

Flag vbat_sag_comp_enabled allows battery compensation to be enabled or
disabled from the CLI. When disabled the battery voltage task is run at
50Hz and the battery compensation code is not run. When enabled the
voltage task is run at 200Hz and the compensation code runs. Constants
for the fast and slow rates are added to tasks.h. The default value for
vbat_sag_compensation is changed to 100 as we no longer need to use it
to disable the feature.

Fixed variable task frequency setting.

Added config validation to disable sag compensation unless ADC is used as the voltage data source.

Added conditionals, fixed naming.

Fixed build.
2020-03-22 17:15:08 +13:00
Bruce Luckcuck
e76fd50421 Change iterm_windup to only apply to yaw
Except for when Launch Control is active - then apply to all axes.
2020-03-15 13:03:02 -04:00
Michael Keller
ea4f30c3ac
Revert "apply iterm_windup to yaw only" 2020-03-16 02:00:50 +13:00
ctzsnooze
269fdd0a24 might work
improve

remove const
2020-03-14 10:19:30 +13:00
Bruce Luckcuck
6c5b78951a Revise pid_process_denom default logic - second try
This is a revision and partial revert of #9545.

While the previous version improved the behavior for non-8K gyros, it had some unfortunate side effects on the defaults and how they affected the output of the `diff`. Basically the problem is that in most cases the default value will end up getting adjusted during the first boot to work with the default low-speed motor protocol ONESHOT125. So if an appropriate default was originally set (like in the other PR) it shows up changed in the `diff` with default settings. The only workaround is to set the default to be the expected "corrected" value when ONESHOT125 is taken into account. This unfortunately reverts to the not so great behavior for gyros that have a sample rate < 8K, but that's unavoidable.

The inappropriate logic based on the `USE_` for various gyros being defined is still removed. This makes no sense in the unified targets context and was trying to determine if there's an SPI-connected gyro so that means it's going to run at 8K, but if not then it's going to be I2C and 2K, etc. This no longer makes sense.
2020-03-07 14:03:16 -05:00
Bruce Luckcuck
46e6c7cab9 Revise pid_process_denom default logic
Remove dependence on gyro type and base on MCU type.
2020-03-05 16:58:16 -05:00
Michael Keller
dc1bf7e372
Merge pull request #9491 from mikeller/improve_level_mode_code
Improved code to apply level modes.
2020-02-19 00:45:52 +13:00
mikeller
1036b29a58 Improved code to apply level modes. 2020-02-18 00:29:32 +13:00
Michael Keller
6bb7dbbba9
Merge pull request #9485 from jflyper/bfdev-white-space-tidy
White space tidy
2020-02-18 00:24:24 +13:00
Michael Keller
17e620f997
Merge pull request #9486 from IllusionFpv/updated-dlpf-curve
Updated DLPF curve
2020-02-17 23:57:49 +13:00
jflyper
ff16686893 White space tidy 2020-02-17 23:54:57 +13:00
Michael Keller
c984107291
Merge pull request #9482 from ctzsnooze/Revert-iTerm-Relax
Restore proper behaviour of iterm_relax_cutoff in setpoint mode
2020-02-17 08:11:26 +13:00
Michael Keller
b96649ef76
Merge pull request #9481 from phobos-/nfe-racemode
NFE Race Mode
2020-02-17 08:08:59 +13:00
phobos-
8ce268d5f1 Implemented NFE Race Mode 2020-02-16 13:46:08 +01:00
Nicola De Pasquale
2e9516bb63 updated dlpf curve math, now it goes from straight to positive 2020-02-15 23:49:16 +01:00
mikeller
bc4701aebf Simplified the calculations, fixed tests. 2020-02-16 10:34:31 +13:00
ctzsnooze
2bbe525853 Fix iterm_relax at low cutoff values
Doesn't adjust threshold upwards when cutoff is reduced below default.
This reverts to original setpoint code behaviour.

Probably better to go back entirely to the original code.

Add changed max on iterm_relax_cutoff to CMS

Restore ITERM_RELAX_SETPOINT_THRESHOLD to float to fix Travis error
2020-02-16 10:17:06 +13:00
ctzsnooze
2922f06f40 ff_interpolated should default to AVERAGED_2
Identified by OCrap
2020-02-12 18:24:44 +11:00
Bruce Luckcuck
f584780944 Gyro native rate sampling, filtering, and scheduler restructuring 2020-02-04 18:19:35 -05:00
mikeller
ab025b76a8 Fixed missing spaces after 'if'. 2020-01-26 13:16:01 +13:00
Nicola De Pasquale
dd81e49b75 simplify iterm calculation 2020-01-19 15:47:53 +01:00
Nicola De Pasquale
31d08f1515 fix fast ram variables 2020-01-19 14:59:18 +01:00
Nicola De Pasquale
54f46c9327 antigravity gain decoupled from Iterm 2020-01-19 13:28:06 +01: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
Nicola De Pasquale
3ae5830eb0 added dterm lpf configurable curve 2020-01-14 20:24:56 +01:00
Michael Keller
359ab46037
reduce antigravity gain default to 3.5 (#9128)
reduce antigravity gain default to 3.5
2019-12-11 09:35:36 +13:00
ctzsnooze
328b42b673 Defaults changed to no averaging, higher limit threshold 2019-11-20 11:37:27 +11:00
ctzsnooze
3c91da0e59 Interpolated feed forward smoothing 2019-11-20 11:29:37 +11:00
ctzsnooze
22434fe0f3 reduce antigravity gain default to 3.5
In recent releases we have been increasing PID I.

We haven't reduced the antigravity gain value in the same proportion.

Low authority / low P quads can get I wobbles  that are apparent on throttling up.

A lower default anti-gravity gain is likely to work alright and be a fraction less likely to cause I wobbles.
2019-10-29 10:20:29 +11:00
ctzsnooze
e1a8a80584 fixes for ff_boost
1.  Excludes yaw from ff_boost.
2.  Removes suppression for 3x greater up-steps in FF to reduce boost glitching around zero sticks
3.  Spike detection gets cleaner passband and tighter rejection above threshold; higher threshold is now possible with better suppression of large spikes.
2019-09-10 19:11:04 +10:00
ctzsnooze
e381b27b9c Small modification to ff boost spike suppression
The feed forward boost concept improves stick response by adding a stick acceleration factor to feed forward. Generating spikes when there are steps in the RC signal is the main problem.
This PR makes one small change to how the spike suppression method is determined.
It no longer uses the 'jerk' signal to generate the spike suppression 'clip' value.  Instead it just uses the magnitude of the boost signal itself.
We originally used jerk because it is more sensitive to spikes. Detailed testing shows that jerk is that it has an unwanted impact one full RC step after the spike.
If we use the boost (acceleration) signal as the attenuator, that delayed impact does not occur, making the boost component more precise.
The threshold value for suppression needs to be a bit higher to achieve equivalence.
I've re-named the function to reflect it being related to spike suppression and removed 'jerk' since we aren't using that any more.
2019-09-07 11:22:06 +10:00
Michael Keller
75447ef2b8
Merge pull request #8736 from joelucid/ff2_1
various ff2_0 improvements
2019-09-05 02:14:23 +12:00
Thorsten Laux
5855b275f4 various ff2_0 improvements
simplify

double period averaging

fix calc

ff changes

in between

fixes

clip * clip and cleanup

address review feedback

more review feedback

10 to 100
2019-09-04 23:08:02 +12:00
Thorsten Laux
1a4c42aabc change transient throttle limit to 0 2019-09-03 12:38:12 +02:00
ctzsnooze
445122a997 FF defaults increased to 90's
Higher feed forward improves stick responsiveness and reduces bounce back on lower authority quads.

Feed forward defaults in 4.0 were slightly conservative even for typical quads.

In association with ff_boost and ff_max_rate_limit, overshoot with even higher feed forward is less of a problem than before.

I think these values should be about right for 4.1
2019-09-01 20:06:06 +12:00
ctzsnooze
b5ec9cd5bf Increase iTerm defaults slightly for 4.1
The feed forward changes in 4.1 will bring, to all quads of reasonable control authority, reduced setpoint to gyro delay and less error.  iTerm will tend to accumulate less during fast inputs so there will be less of a problem with iTerm-windup and iTerm related bounce-back.

Higher I values lead to better control during tight turns and greater stability in wind.  Higher I doesn't increase the absolute amount of iTerm accumulating in the PID loop, but does allow it to change more quickly and to more quickly zero out the residual errors that are strong in tight turns.

I think this modest increase will optimise performance of the default 4.1 PIDs for most quads.

Lower authority quads will need to either reduce their I setting, or, preferably, lower the iterm_relax value to 10 or even 5, to avoid wind-up.
2019-08-31 12:59:51 +10:00
Michael Keller
c40f6b15ca
Change lowpass 1 on D from biquad to pt1 (#8688)
Change lowpass 1 on D from biquad to pt1
2019-08-10 17:27:45 +12:00
ctzsnooze
977f14a4f5 make dynamic lowpass on D a PT1, not a biquad 2019-08-08 23:46:07 +10:00
Bruce Luckcuck
2b97763002 Fix unused variable warning when USE_ABSOLUTE_CONTROL is not defined 2019-08-08 08:10:39 -04:00
Thorsten Laux
25c6919051 better camels and order 2019-08-08 09:52:25 +02:00
Thorsten Laux
91ad2498ff ff from interpolated setpoint 2019-08-08 09:50:18 +02:00
Thorsten Laux
d033a8dc76 address code review 2019-08-02 14:20:37 +02:00
Thorsten Laux
293dc42710 address feedback 2019-08-02 13:51:44 +02:00