1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 11:29:58 +03:00
Commit graph

738 commits

Author SHA1 Message Date
ctzsnooze
8b73c5242b Default yaw lowpass to 100hz 2021-07-17 21:02:33 +10:00
ctzsnooze
bfb8954a43 small bug in horizon code 2021-07-01 14:13:11 +10:00
ctzsnooze
3b62b2e5d4 add PT2 and PT3 lowpass filter options 2021-05-18 09:59:27 +10: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
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
TheIsotopes
246d3a6d89
setting simplified_dterm_filters to off by defaults
all over simplified tuning settings also set to off
2021-02-18 11:04:20 +01:00
Bruce Luckcuck
87f322927a Self-level modes expo
Adds angle setpoint roll/pitch expo for self-level modes.

Previously the angle setpoint was a simple linear calculation based on the stick deflection percentage and the angle limit. This makes control very jumpy around center stick and people would often resort to adding expo in their radios to compensate. This then adds the complication of wanting expo in the radio when in self-level but not when in acro - leading to complicated mixes, virtual switches, etc.

This PR adds separate self-level expo settings for roll/pitch so the user can customize the axis behavior. Yaw is excluded because this axis uses normal rates and expo controlling the rotational rate around the yaw axis and not an angle setpoint. The roll/pitch expo can range from 0 (off) to 100 (max) like other RC expo settings. For example:
```
set roll_level_expo = 30
set pitch_level_expo = 40
```
The default values are 0 which disables any expo and behaves as before.

The settings are available in the CMS rate profile menu.
2021-01-25 19:08:43 -05:00
ctzsnooze
5b40fcc326 exclude yaw from AG driven P boost 2021-01-09 21:19:10 +11:00
Michael Keller
58b4cb916c Added missing simplified gyro tuning defaults. 2020-12-26 14:27:06 +01:00
Michael Keller
7fc3c7cea6 Renamed 'tuning sliders' to 'simplified tuning'. 2020-12-26 14:26:56 +01:00
IvoFPV
cff19dc113 Implement tuning sliders, add to CMS, MSP 2020-12-26 14:26:50 +01:00
ctzsnooze
8050ecd1e7 Mixer update: dynamic idle and throttle logging improvements
- all CLI parameters related to dynamic idle alone re-named with the `dyn_idle_` prefix
- when linear throttle scaling is active, the user's set idle value is now correct whether dynamic idle is on or off. Previously, the idle value fell when dynamic idle was activated at the same time as linear throttle scaling.
- enabling dynamic idle no longer causes a deadband at full throttle
- the setpoint throttle value sent to Blackbox does not include the dynamic idle offset
- the throttle value sent to the antigravity and dynamic lowpass code includes throttle scaling, but no other modifiers, to avoid false elevation of the apparent throttle position from dynamic idle and unnecessary transient changes in their filter cutoffs
- Dynamic Idle now uses a modified PI controller during active rpm control phase
- the D factor provides early detection of rapid falls in rpm, e.g. in hard chops. It is filtered heavily. Inadequate `dyn_idle_d_gain` may lead to a transient drop in rpm immediately after cutting throttle. Default is 50.
- the P factor provides fast control over rpm during the active control phase. Too much `dyn_idle_p_gain` may cause oscillation in that phase. Note enough and a slow drop in rpm will be inadequately corrected. Default is 50. Needs to be higher with heavier larger props.
- An integral element does most of the work.  It prevents enduring offsets from the set rpm. The I gain is high when increasing responding to low rpm, and slow to release.  The slow release makes a huge difference and avoids I oscillation. Not enough `dyn_idle_i_gain` and there may be wobble in rpm during the control phase, or the idle value may rise too slowly; too much may cause wobble. Default is 50. Needs to be higher with heavier larger props.
- The DYN_IDLE debug shows idle P, I and D in debugs 0, 1 and 2. minRps stays in debug 3.
- Interactions between throttle and thrust linear, dynamic idle, throttle scaling and throttle boost have been checked and work as they should.
2020-11-09 09:09:17 +11:00
ctzsnooze
c075569563 Whitespace - thanks, Nicola!
Space invader indeed lol
2020-09-20 12:42:09 +10:00
ctzsnooze
6a143beb6f Code improbements, thanks for the feedback! 2020-09-20 12:42:09 +10:00
ctzsnooze
d1bf5d0d11 Add late P boost to antigravity 2020-09-20 12:42:09 +10:00
ctzsnooze
73663f7fae FF update including second order fitlering of boost, tidying up etc
Include default to no averaging
2020-09-12 17:08:14 +10:00
Sam Lane
4c99ad743d Rename FAST_RAM to FAST_DATA 2020-08-23 08:49:26 +01:00
Nicola De Pasquale
c1ce6f30f8 removed unnecessary static declarations 2020-08-16 11:12:55 +02:00
Nicola De Pasquale
d0fe84528a using same curve of dyn dterm lpf 2020-08-08 15:36:28 +02:00
Michael Keller
99f9a34462
Merge pull request #9999 from mikeller/fix_rpm_filter
Fixed missing RPM filter update.
2020-07-11 23:46:49 +12:00
Michael Keller
7bb2c26c43
Merge pull request #9990 from ctzsnooze/refactor-Thrust-Linear-update 2020-07-09 15:34:36 +12:00
mikeller
99c3cc9b0b Fixed missing RPM filter update. 2020-07-08 21:23:18 +12:00
ctzsnooze
1fbf0ba816 Further refactoring
Thanks, Mike!
2020-07-07 22:59:58 +10:00
ctzsnooze
9a65b766a2 refactor Thrust Linear to initialise throttleCompensateAmount in pid_init.c
Maybe this could avoid recaculating throttleCompensateAmount every PID loop?
2020-07-07 15:11:17 +10:00
mikeller
15d1df3c77 Removed DTerm RPM filter. 2020-07-06 19:33:06 +12:00
Michael Keller
41fa8754bc
Merge pull request #9633 from mikeller/remove_vbat_pid_compensation
Remove vbat pid compensation
2020-07-06 13:41:27 +12:00
Michael Keller
3ef0a529ca
Merge pull request #9832 from SteveCEvans/debug_dlpf
Add DEBUG_D_LPF
2020-07-05 14:53:26 +12:00
SteveCEvans
d8c0159378 Add DEBUG_D_LPF 2020-07-05 14:37:48 +12:00
mikeller
fb605aed01 Fixed throttle calculation. 2020-07-05 14:15:11 +12:00
ctzsnooze
7cd83464d6 Power 2 thrust compensation with 50% throttle compensation
^2 gain curve after discussions with Markus
Variable throttle compensation, more with higher TL for whoops
Calculator https://www.desmos.com/calculator/1rhq0pqoug
2020-07-05 14:01:42 +12:00
mikeller
b6689edc26 Removed VBat PID compensation. 2020-06-22 01:12:47 +12: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
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