1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 04:45:24 +03:00
Commit graph

738 commits

Author SHA1 Message Date
ctzsnooze
53476d45de bit more fine tuning 2018-06-10 10:15:19 +10:00
ctzsnooze
6d2c1a3c01 initial debug changes 2018-06-10 08:40:04 +10:00
ctzsnooze
705d3939eb Initial default suggestions for 3.4
Set default RC smoothing channels to RPYT

first attempt at enabling features by default

update filter notes
2018-06-09 22:26:00 +12:00
mikeller
06428c1b05 More fixes. 2018-06-09 19:20:46 +12:00
mikeller
d43c178488 Fixes from review. 2018-06-09 13:22:36 +12:00
Michael Keller
db3c0d1447 Some fixes. 2018-06-08 21:18:54 +12:00
Thorsten Laux
fefedbd686 attempts to improve relax
attempts to improve relax fix

attempts to improve relax fix

bug fixes

spaces

changed settings and added isAirmodeActive()

fix rebase error
2018-06-08 21:01:46 +12:00
Michael Keller
7936fb07d5
Merge pull request #6052 from mikeller/change_setpoint_weight_to_decimal_scaling
Changed 'dtermSetpointWeight' to use decimal scaling.
2018-06-07 23:38:16 +12:00
Michael Keller
2dd1d742bf
Merge pull request #6051 from etracer65/rc_smoothing_training
RC smoothing: improve rx frame rate detection, add rc_smoothing_info cli command
2018-06-07 16:22:48 +12:00
Michael Keller
3f3fb0c01c Changed 'dtermSetpointWeight' to use decimal scaling. 2018-06-06 11:21:11 +12:00
Bruce Luckcuck
e49c10b573 RC smoothing: improve rx frame rate detection, add rc_smoothing_info cli command
Improved the rx frame rate detection/training by delaying calculation to avoid loop time jitter during flight controller initialization.

For auto cutoffs calculate a value appropriate for BIQUAD or PT1 depending on the configuration.

Added a new rc_smoothing_info cli command to display internal details about its operation.
2018-06-05 18:25:13 -04:00
mikeller
a373204d7a Added validation checks for interpolation settings, made throttle boost conditional. 2018-06-05 18:38:57 +12:00
mikeller
e29fa595f5 Optimised the use of static variables in the PID loop. 2018-06-04 18:56:30 +12:00
Bruce Luckcuck
7e18d7c1b9 Make filter type selectable and add BIQUAD
Adds options to select the filter type for both input and derivative.
rc_smoothing_input_type = PT1 | BIQUAD (default is BIQUAD)
rc_smoothing_derivative_type = OFF | PT1 | BIQUAD (default is OFF)
2018-06-03 21:52:15 -04:00
Bruce Luckcuck
826609e703 Experimental filter-based rc channel smoothing
Adds an additional rc channel smoothing algorithm that can be used in place of the default rc interpolation. Utilizing a filter-based approach the smoothing has lower latency and is immune to loop time jitter that can introduce artifacts.  Additionally a smoothing filter is added to the setpoint derivative used to produce D-term setpoint weight resulting in a smoother effect on D.

The default setting is to use the previous interpolation logic and there are no changes unless the optional method is selected.

Configuration:

rc_smoothing_type: (INTERPOLATION | FILTER) - defaults to INTERPOLATION

rc_smoothing_input_hz: (0-255) - sets the rc channel input filter cutoff in Hz. Default value of 0 will enable auto calculation based on received RX frame rate.

rc_smoothing_derivative_hz: (0-255) - sets the setpoint weight derivative filter cutoff in Hz. Default value of 0 will enable auto calculation based on received RX frame rate.

rc_smoothing_debug_axis: (ROLL | PITCH | YAW | THROTTLE) - determines which axis is logged in the debug fields

Debug logging:

set debug_mode = RC_SMOOTHING

debug(0) = raw un-smoothed rc channel data
debug(1) = raw un-smoothed setpoint derivative
debug(2) = filtered setpoint derivative before applied to setpoint weight
debug(3) = auto-calculated filter cutoff frequency base after sampling the rx frame rate

Notes:

Currently only enabled for F4/F7 due to flash size limitations

Uses the rc_inter_ch parameter to determine which channels are smoothed (same as default interpolation logic)

The auto filter cutoff calculation will set a cutoff frequency of 30Hz for typical SBUS frames (9ms).  11ms Spektrum will calculate to approximately 25Hz. The user can manually enter the filter cutoffs to be used instead of the auto calculation.  The current default calculation was chosen as a good starting point but may be adjusted in the future.

Setting a lower cutoff frequency will result in more smoothing, but also more delay.

There currently isn't any support for receivers that change their rx frame rate dynamically.  So for CRSF users wishing to use this alternate smoothing method should change their settings to lock the rx frame rate for now. Support for auto-adjusting to new frame rates in flight will likely be added.
2018-06-03 21:52:01 -04:00
mikeller
f32731638d Removed default changes from this pull request. 2018-06-03 22:44:42 +12:00
mikeller
75693fbd5b Added defaults and MSP support to filter settings. 2018-06-03 22:44:42 +12:00
mikeller
a9b3911e03 Made new PID loop improvements conditional, disabled some for F3 to save flash space. 2018-06-03 17:07:10 +12:00
mikeller
c666fcfa17 Reordered and optimised pidProfile parameter group. 2018-05-31 23:51:31 +12:00
Thorsten Laux
bb71b6ec64 correct drift 2018-05-30 23:06:27 +02:00
Thorsten Laux
8fe07af613 correct stickInput 2018-05-30 23:06:27 +02:00
Thorsten Laux
0138200c1c initialize acErrorRate if iterm_relax is off 2018-05-30 23:05:16 +02:00
Thorsten Laux
b40db51448 address style issues and set off by default 2018-05-30 23:05:15 +02:00
Thorsten Laux
bd289121fc absolute control feature 2018-05-30 23:04:26 +02:00
Thorsten Laux
df71817fba incorporate style feedback 2018-05-30 23:01:54 +02:00
Thorsten Laux
7c8c3b6784 address style requests 2018-05-30 23:01:54 +02:00
Thorsten Laux
85b0f6f9c2 ITerm relax feature 2018-05-30 23:01:54 +02:00
Bruce Luckcuck
ad067ee09a Overshoot logic updates, disable for GPS Rescue, constrain max setpoint
Updates for finalize the flight performance.

Disable if GPS Rescue is active

Constrain the max setpoint calculated by the angle correction logic. To catch border cases where the user activates the feature while inverted and has a high gain which could result in excessively high setpoint rates.

Make sure internal states are reset when feature is activated via mode switch.
2018-05-29 21:08:19 -04:00
Bruce Luckcuck
2384088855 Requested changes, cleanup and control logic updates
Also added a new parameter acro_trainer_gain to allow adjustments to the limiting strength.
2018-05-29 21:08:19 -04:00
Bruce Luckcuck
9b43839052 Acro trainer
Adds a new angle limiting mode for pilots who are learning to fly in acro mode. Primarily targeted at new LOS acro pilots, but can be used with FPV as well.

The feature is activated with a new mode named "ACRO TRAINER". When the feature is active, the craft will fly in normal acro mode but will limit roll/pitch axes so that they don't exceed the configured angle limit. New pilots can start with a small angle limit and progressively increase as their skills improve.

The accelerometer must be enabled for the feature to be configured and function.

Also the feature will only be active while in acro flight and will disable if ANGLE or HORIZON modes are selected.

For most users all they need to do is simply configure the new mode to be active as desired on the "Modes" tab in the configurator and configure the desired angle limit in the cli.

Configuration parameters:

acro_trainer_angle_limit: (range 10-80) Angle limit in degrees.

acro_trainer_lookahead_ms: (range 10-200) Time in milliseconds that the logic will "look ahead" to help minimize overshoot and bounce-back if the limit is approached at high gyro rates. The default value of 50 should be good for most users. For low powered or unresponsive craft (micros or brushed) it may be helpful to increase this setting if you're seeing substantial overshoot.

acro_trainer_debug_axis: (ROLL, PITCH) The axis that will log information if debugging is active.

To enable debugging:
set debug_mode = ACRO_TRAINER

debug(0) - Current angle
debug(1) - The internal logic state
debug(2) - Modified setpoint
debug(3) - Projected angle based gyro rate and lookahead period
2018-05-29 21:08:16 -04:00
Michael Keller
eecb59db45
Merge pull request #5963 from joelucid/iterm_relax
ITerm relax feature
2018-05-30 09:32:21 +12:00
Thorsten Laux
dc929baf75 make itermRelax into enum 2018-05-29 16:40:23 +02:00
AJ Christensen
a63c8b0079 gyro & d-term filters: remove filtering options except biquad/pt1
* through extensive testing prior to the beginning of the RC cycle, we have
  discovered that the simplest combination of filters appears to be up to four
  PT1 filters: two for gyro, and two for d-term.
* non-cascaded biquad filter plumbing is retained for noisy setups and the
  dynamic notch bandpass, although gyro and d-term variants of the filtering may
  eventually be removed in favor of pt1
* update all related unit tests
2018-05-29 10:54:46 +12:00
Thorsten Laux
5bdc2ead61 make itermRelax an uint8_t 2018-05-28 16:44:13 +02:00
Thorsten Laux
6239b8258a make itermrelax on yaw optional 2018-05-28 16:41:05 +02:00
Thorsten Laux
2c02c14a1d debug log only roll and pitch, but separately 2018-05-28 16:40:09 +02:00
Thorsten Laux
5a1d84cdae incorporate style feedback 2018-05-28 16:40:08 +02:00
Thorsten Laux
0086932946 address style requests 2018-05-28 16:39:43 +02:00
Thorsten Laux
791c584d81 add debug option DEBUG_ITERM_RELAX 2018-05-28 16:37:41 +02:00
Thorsten Laux
32748a328a ITerm relax feature 2018-05-28 16:37:41 +02:00
Michael Keller
5c3599a028
Merge pull request #5962 from joelucid/pid_ff
If P and FF have same sign take larger one
2018-05-27 21:36:23 +12:00
Thorsten Laux
62dcd1b2fa Also move previousPidSetpoint 2018-05-27 07:47:51 +02:00
Thorsten Laux
d337023e87 assign previousGyroRateDterm after calculating ff 2018-05-27 07:44:11 +02:00
Andrey Mironov
375bfe3929 Marked crucial functions inlined into ITCM-RAM explicitly 2018-05-26 11:04:02 +03:00
Thorsten Laux
af5fde98c1 address style requests 2018-05-25 07:12:12 +02:00
Thorsten Laux
5aad57c3a7 add smart_feedforward config setting 2018-05-24 21:55:49 +02:00
Thorsten Laux
82edaaaf8a remove newline 2018-05-24 15:31:45 +02:00
Thorsten Laux
25cc445d7e switch micro-optimizations 2018-05-24 15:30:55 +02:00
Thorsten Laux
dc452ced00 rename pid_ff 2018-05-24 15:26:08 +02:00
Thorsten Laux
fde2aae4f5 If P and FF have same sign take larger one 2018-05-24 14:08:52 +02:00