1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 16:25:31 +03:00
Commit graph

151 commits

Author SHA1 Message Date
joelucid
98a77dcd96 Discontinuity fix (#5509)
* use continuous feed-forward

* use continuous feed-forward

* formatting
2018-03-23 14:13:32 +13:00
Dan Nixon
bc283cf5b9 Refine extended CMS menu toggles (#3601) 2018-03-22 00:07:53 +13:00
AJ Christensen
46291a8374 Dual-stage Gyro Filtering: PT1, Biquad, Butterworth, Denoise (FIR), FKF (fixed K), and Biquad RC+FIR2 (#5391)
* Dual-stage Gyro Filtering: PT1, FKF, and Biquad RC+FIR2

* Builds on the previous work of apocolipse.
* Fixes 'stage2'/'stage1' mis-naming to reflect where it is applied in the loop.
  That is, the older Biquad, PT1, Denoise (FIR) filters are 'stage2' - applied
  after dynamic and static notches (if enabled), and the controversial PT1,
  'fast Kalman' filter, and Biquad RC+FIR2 filters, are 'stage1'. e.g. before
  dynamic notch.
* FKF bruteforce Kalman gain removed. Calculate from half of PT1 RC constant,
  automatically taking loop-time into account.
* New union type definition for stage1 filtering.
* New gyro sensor members for stage1 filter application function and states for
  all three supported filter types
* New enum types for stage1 v. stage2. dterm lowpass type references 'stage2'.
* updates to CMS/MSP/FC to allow compilation (untested, probably breaks
  MSP, Lua, and ~comms with BFC~).
* Refactors FKF initialization, update and associated structures to be faster by
  not continuously calculating 'k'. Filter gain is calculated once during
  initialization from RC constant as per PT1 and Biquad RC+FIR2. It was
  discovered this converges to static value within 100 samples at 32kHz, so can
  be removed. Remove related interface (CLI) settings.
* update dterm_lowpass_type to use new 'TABLE_LOWPASS2_TYPE' (biquad/pt1/FIR)
* Stage 1 defaults to PT1, 763Hz (equivalent to Q400 / R88 from quasi-kalman
  filter) - suitable for 32kHz sampling modes. Can be switched to Biquad
  RC+FIR2, and FKF.
* Update `#if defined(USE_GYRO_SLEW_LIMITER) to `#ifdef`.
* Includes optional Lagged Moving Average 'smoothing' pipeline step, applied (in
  code) after the output of stage1.
* (diehertz): Removed redundant pointers from gyro filtering

* blackbox: fix indentation

* cms IMU menu: fix indentation

* filters: remove USE_GYRO_FIR_FILTER_DENOISE in filter type enum

* gyro sensors: go back to `if defined()` form. for slew limiter

* gyro sensors: increment parameter group version

* due to non-appending changes, the version must be bumped.
2018-03-21 15:52:59 +13:00
ctzsnooze
ab231b7c84 Second dterm pt1 (#5458)
* Second PT1 on DTerm

This PR replaces the default biquad filter with a second PT1 set to
200Hz.

Basically allows the user to enable a second, set point configurable,
PT1 type first order low-pass filter on DTerm.

This is useful because most noise in most logs arises from D, not P.

The default is set to on, at twice the normal Dterm setpoint.  This
provides greater Dterm cut than a single PT1, and twice the steepness
of cut above the second setpoint.  Modelling shows significant
reductions in higher frequency Dterm noise with only minor additional
delay.

The improvement in noise performance will be less than for biquad, but
the delay is considerably less.

If with the default settings the overall noise improves a lot, it may
be possible bring D both filtering set points to higher numbers (e.g.
140/280), or alternatively remove other filters such as the notch
filters, while maintaining an adequate level of control over noise.

* Update names, old defaults, fix whitespace

Defaults restored to biquad with second PT1 off.  ‘lpf’ retained as
abbreviation for values, otherwise generally remove ‘Filter’ where
redundant, replace ‘FilterLpf’ with ‘Lowpass’, etc, thanks Fujin and
DieHertz

* Remove underscore in lowpass_2, add hz to setpoint for lowpass

Thanks DieHertz

* completed replacing lpf with lowpass, added _hz to all lowpass set points in profile

Thanks DieHertz

* fix whitespace

fixed whitespace in settings.c

* whitespace attempt #57

* change lpf to lowpass where appropriate elsewhere

Note did not change OSD abbreviations, they are still LPF, and did not
change gyro_lpf anywhere.

* second attempt at a simple PT1 implementation

Basically copied from the DtermNotch implementation

* Second PT1 on DTerm

This PR replaces the default biquad filter with a second PT1 set to
200Hz.

Basically allows the user to enable a second, set point configurable,
PT1 type first order low-pass filter on DTerm.

This is useful because most noise in most logs arises from D, not P.

The default is set to on, at twice the normal Dterm setpoint.  This
provides greater Dterm cut than a single PT1, and twice the steepness
of cut above the second setpoint.  Modelling shows significant
reductions in higher frequency Dterm noise with only minor additional
delay.

The improvement in noise performance will be less than for biquad, but
the delay is considerably less.

If with the default settings the overall noise improves a lot, it may
be possible bring D both filtering set points to higher numbers (e.g.
140/280), or alternatively remove other filters such as the notch
filters, while maintaining an adequate level of control over noise.

* Rebase

* Remove underscore in lowpass_2, add hz to setpoint for lowpass

Thanks DieHertz

* completed replacing lpf with lowpass, added _hz to all lowpass set points in profile

Thanks DieHertz

* fix whitespace

fixed whitespace in settings.c

* whitespace attempt #57

* change lpf to lowpass where appropriate elsewhere

Note did not change OSD abbreviations, they are still LPF, and did not
change gyro_lpf anywhere.

* second attempt at a simple PT1 implementation

Basically copied from the DtermNotch implementation

* Whitespace fix - thanks, Ledvinap

* Fix PG issue

by moving added dterm_lowpass2_hz to bottom of struct

* Got rid of redundant indirection

* Fixed indentantion shifts
2018-03-21 01:40:23 +13:00
mikeller
ee65eba88d Added selectable RaceFlight rates. 2018-01-19 00:38:14 +13:00
mikeller
018c24fec2 Fixed range for setpoint_relax_ratio to avoid division by zero. 2018-01-14 12:12:54 +13:00
Martin Budden
3747d6742b Whitespace tidy 2018-01-10 16:56:54 +00:00
mikeller
b489d0ba9d Renamed 'parameter_group' to 'pg'. 2017-12-19 23:36:31 +13:00
Michael Keller
364afcbf25
Merge pull request #4521 from martinbudden/bf_cms_onglobalexit
Remove almost entirely unused CMS ononGlobalExit function
2017-11-10 10:35:13 +13:00
Martin Budden
243e8390a2 Removed CMS menu guards when not debugging 2017-11-09 19:09:17 +00:00
Martin Budden
9a9884e4af Remove almost entirely unused CMS ononGlobalExit function 2017-11-09 19:06:25 +00:00
mikeller
a8d34dabb0 Changed defines for GYRO/ACC/MAG/BARO/GPS/SONAR/OSD/BLACKBOX/CMS to conform to the USE_ convention. 2017-11-05 10:15:24 +13:00
Martin Budden
74c8fefd63 Merge pull request #4252 from McGiverGim/bf-add_antigravity_cms
Add antigravity config to the CMS
2017-10-09 13:04:55 +01:00
Dan Nixon
f087730035 Add throttle mid and expo to CMS 2017-10-06 18:15:13 +01:00
Miguel Angel Mulero Martinez
05fb653a8e Add antigravity config to the CMS
Added the antigravity gain and threshold to the CMS menu.
2017-09-28 17:44:56 +02:00
Martin Budden
c1a99817f4 Minor tidy of PID code 2017-09-09 07:03:15 +01:00
Bas Delfos
ec4ce2bbd6 Changed condition to USE_COPY_PROFILE_CMS_MENU 2017-08-30 21:28:49 +02:00
Bas Delfos
04d08cb033 Made CMS code conditional 2017-07-29 22:26:53 +02:00
Bas Delfos
d32abc69f8 Copy profile to another profile (CLI, MSP and CMS) 2017-07-29 22:10:14 +02:00
Dan Nixon
334dbc3039 Ensure PID/rate profile is updated before editing values 2017-07-14 14:44:16 +01:00
Martin Budden
23f158913e Moved time functions out of system.h into time.h 2017-05-26 14:03:28 +01:00
Martin Budden
71546410de Rearrange PID array to be array of PIDs 2017-05-06 11:06:47 +01:00
Hydra
2b1dac4c6d CF/BF - First cut of allow building of the OSD SLAVE board without all
the flight controller code.

Likely the dependencies can be further improved.  This is a
minimal-impact solution while there are a lot of other Betaflight PR's
still pending.
2017-04-12 00:39:27 +01:00
Martin Budden
1964362dce Removal of USE_PARAMETER_GROUPS 1 2017-03-09 22:03:59 +00:00
Martin Budden
9e4de2ea3b Added separate yaw pidsum limit 2017-03-07 11:25:21 +00:00
Martin Budden
aa561d542b Updates to support parameter groups 2017-03-06 13:48:14 +00:00
Martin Budden
7ae57eb8cf Added PG config definitions 8 2017-02-27 07:25:48 +00:00
Martin Budden
a3ad97b0a4 Added profile macros and index functions 2017-02-25 07:37:53 +00:00
Martin Budden
051c9cca48 Moved rate profiles out of pid profiles 2017-02-24 23:25:43 +00:00
Martin Budden
faf1ecf0e2 Moved free standing items out of masterConfig into separate configs 2017-02-22 18:44:40 +00:00
Martin Budden
c67d6eb4f1 Preparation for conversion to parameter groups 14 2017-02-19 20:33:45 +00:00
Martin Budden
3275105127 Preparation for conversion to parameter groups 13 2017-02-19 17:46:46 +00:00
Martin Budden
79d4b2146d Preparation for conversion to parameter groups 2017-02-01 08:46:19 +00:00
Martin Budden
8c4914b330 Tidied cms imu code 2017-01-31 14:20:16 +01:00
jflyper
86bb650617 Merge remote-tracking branch 'betaflight/master' into bfdev-smartaudio 2016-12-30 00:11:57 +09:00
Martin Budden
143f2d6651 Include file fixups 2016-12-28 20:18:27 +00:00
jflyper
0cbe440cea Rebased 2016-12-05 11:43:34 +09:00
Martin Budden
b19e439361 Merge pull request #1707 from betaflight/pid_config_init
Add PID config initialisation
2016-11-30 23:10:25 +01:00
Martin Budden
3ec46f1bd2 Added gyro, compass, acc, and baro config macros 2016-11-30 21:38:14 +00:00
borisbstyle
29690b9c00 Add config reload to inflight adjustments and osd 2016-11-30 21:16:50 +01:00
jflyper
34b1a18255 Merge remote-tracking branch 'betaflight/master' into bfdev-smartaudio 2016-11-29 10:59:30 +09:00
Martin Budden
2c7d06a94e Moved gyro filter settings into gyroConfig 2016-11-25 23:22:24 +00:00
jflyper
5d5ded2131 FREE mode band/chan change requires SET to be executed 2016-11-25 18:27:55 +09:00
jflyper
99cc39dcc4 Menu restructuring
- Created “OTHER PP” menu entry in PROFILE for “Other Per Profile”
items.
- Moved dterm set point weight and set point relax to OTHER PP.
- Added missing angle strength, horizon strength and transition.
2016-11-09 12:11:35 +09:00
jflyper
8530cd4ba1 Menu restructuring
- Rate profiles are handled correctly
- Added FILTER GLB (Global) and FILTER PP (Per Profile) sub menus
- Moved MISC menu under top level.
2016-11-09 05:42:22 +09:00
Martin Budden
f68e6a4d2f Improved CMS const correctness. Added CMS and USE_MSP_DISPLAYPORT to common.h 2016-11-08 15:46:05 +00:00
jflyper
c9b7ac21c1 Added onChange function call to scalar data types
This will make changed values to take effect immediately in the profile
related menus.

It’s only used for profile selection now; will be used more through out
the menu contents.
2016-11-08 18:22:00 +09:00
jflyper
7861603c96 Optional string for OME_Label
OME_Label now has an optional string (data).
Profile number is now displayed PID menu using this facility.
2016-11-08 14:20:12 +09:00
jflyper
941c3abb12 IMU menu: fixed ranges to match that of cli. 2016-11-07 16:51:29 +09:00
jflyper
ee6641a917 Fix profile number offset problem 2016-11-07 14:33:12 +09:00