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

310 commits

Author SHA1 Message Date
Michael Keller
53151817e1
Merge pull request #6430 from mikeller/remove_duplicate_build_bug_on
Removed 'BUILD_BUG_ON'.
2018-08-22 18:49:45 +12:00
mikeller
b4db764b46 VTX improvements from iNav. 2018-08-20 23:26:57 +12:00
Michael Keller
43e6ea31da
Merge pull request #6517 from ctzsnooze/DynFiltV5
Dynamic Filter Update
2018-08-20 23:23:50 +12:00
ctzsnooze
759007214b remove PT1
warning:
In file included from ./src/main/sensors/gyro.c:1022:0:
./src/main/sensors/gyro_filter_impl.h: In function 'filterGyro':
./src/main/sensors/gyro_filter_impl.h:18:15: warning: variable 'gyroDataForAnalysis' set but not used
2018-08-20 12:15:05 +10:00
mikeller
70ac9423c7 Unified BUILD_BUG_ON and STATIC_ASSERT into STATIC_ASSERT. 2018-08-20 10:50:06 +12:00
ctzsnooze
14c90bf10b user configurable sample rate, true peak detection
1. User can set sampling rate to suit expected range of frequencies:
- HIGH suits 4" or smaller and 6S 5"
- MEDIUM suits classic 5" 4S
- LOW is for 6" or greater
Limits automatically scaled:
HIGH : 133/166 to 1000Hz, MEDIUM : 89/111 to 666Hz, LOW : 67/83 to 500Hz
2. Bandpass entirely eliminated, not needed.
3. True peak detection method, favouring first peak to exceed 80% of maximum bin height; ignore or threshold values not required.
2018-08-20 00:33:11 +10:00
Andrey Mironov
3f001295f7 Simplified FFT location 2018-08-20 00:33:11 +10:00
ctzsnooze
1e960c95eb Dynamic Filter Update
Improves on earlier 3.5RC1 dynamic filter with:
- better FFT tracking performance overall, even with a narrower default notch width
- can reach 850Hz for high kV 2.5-3" and 6S quads
- works better with 32k gyros
- can be applied pre- (location 1) and post- (location 2) static filters. Pre-static filter location works best, but post-static may work well in 32k modes or with PT1 option
- option to use a PT1 filter rather than the classical notch filter, perhaps useful for quads with a lot of noise above their peak.
- ability to totally bypass the pre-FFT bandpass filter, by setting Q=0, maximising the range of responsiveness
- "ignore" value, absolute FFT bin amplitude below which the bin will be excluded from consideration. May be tweaked to optimise peak detection; primarily for advanced tuners. If too high, only the very peaks will be included, if too low, noise may clutter peak detection.
- "threshold" value for peak detection, which, when divided by 10, is the multiple by which one bin must exceed the previous one for peak detection to commence. If too low, FFT detection becomes more random, if too high, no peaks are detected.
2018-08-20 00:33:10 +10:00
Kiripolszky Károly
c0e2ca3546 initial implementation of log status OSD element 2018-08-19 10:21:19 +02:00
AirBreak69
0e52e21524 GPS altitude: cleanup all occurancies to assume source is in cm per lsb resolution
Harmonized (and partly corrected) all occurancies of gpsSol.llh.alt and getEstimatedAltitude() to handle altiude sourced in cm resolution.
This was introduced by GSP_RESCUE/RTH.
Introduced a naming convention that include the unit into the variable/function names:
gpsSol.llh.alt -> gpsSol.llh.alt_cm
getEstimatedAltitude() -> getEstimatedAltitude_cm()
2018-08-19 00:11:30 +12:00
Michael Keller
18cc9ef15a
Merge pull request #6404 from s0up/rescue_config_change
[GPS Rescue] - Allow minimum distance to home to be configurable.
2018-08-17 00:22:52 +12:00
Michael Keller
41ce2c6327
Merge pull request #6391 from leocb/osd-max-g-force-stat
Added Max G-force OSD stat
2018-08-17 00:22:11 +12:00
Markus Jevring
131d46c850 Enable using the 'heading' field in MAVlink to display mAh used 2018-08-06 20:26:41 +02:00
s0up
3ade65a438 correct casing per mikeller review 2018-07-22 12:23:33 -07:00
s0up
0f2dc6328e Merge branch 'master' of github.com:betaflight/betaflight into rescue_config_change 2018-07-22 12:21:36 -07:00
mikeller
2746173ab6 Updated defaults. 2018-07-23 00:43:30 +12:00
mikeller
46d3f0dd83 Added parameters for dynamic notch filter. 2018-07-23 00:43:30 +12:00
Bruce Luckcuck
17e76e48f6 PID controller feedforward
Restructures the PID controller to decouple feedforward from D.

Cleaned up the structure of the PID controller; moved some feature-based enhancements out of the main structure.

Feedforward becomes a separate component of the PID controller and there is now:
f_pitch
f_roll
f_yaw

The default values of 60 for pitch and roll matches the default setpoint weight used in BF3.4.  Yaw previously had no setpoint weight capability so the default here needs to be discussed.  Currently it's also set to 60 and flight testing seems positive.  Feedforward on yaw adds a lot of value so I don't think we want to default to 0.  Instead we need decide on the default.

All occurences of setpoint weight have been replaced by feedforward. "setpoint_relax_ratio" has been renamed to "feedforward_transition".

The pidSum now consists of P + I + D + F.

D has been added back for yaw (disabled by default with d_yaw = 0). We've found little need for D for normal quads but it may have value for other configurations - particularly tricopters.

Updated CMS menus to support adjusting the feedforward for each axis.

Changed the default for "rc_interp_ch" to be "RPYT".  Need yaw to be smoothed to support feedforward.

Open issues:

Needs BFC support
- Need to add support for the axis "F" gains.
- Remove "setpoint weight" slider.
- Rename "D Setpoint transition" to "Feedforward transition"

Needs BBE support
- Header "setpoint_relaxation_ratio" has been renamed "feedforward_transition"
- Header "dterm_setpoint_weight" has been replaced with an array named "feed_forward_weight".
  example: H feed_forward_weight:65,60,60    (R,P,Y)
- PID component "AXISF" has been added for all axes. Should be handled like P, I and D values.
- PidSum calculation needs to include F.

Needs LUA script support
- Support the renamed "setpoint_relax_ratio".
- Support for feedforward weight on all 3 axes.

Open code issues:
- rc_adjustments.c - support for adjusting feedforward weight for all axes. Currently only supporting roll - needs coordination with BFC.
2018-07-21 10:26:23 -04:00
ctzsnooze
94c7109a4c Changes, thanks mikeller and jirif 2018-07-21 23:49:41 +12:00
ctzsnooze
4c917efa50 Smooth anti gravity 2018-07-21 23:49:41 +12:00
s0up
0fd24e23a4 set maximum min dth value as 1km vs 32km, no reason to be so high 2018-07-20 09:03:51 -07:00
s0up
0e9108f5ad fix rogue space 2018-07-19 23:31:00 -07:00
s0up
d7909df3ba add min rescue distance configuration parameter 2018-07-19 23:29:48 -07:00
mikeller
1286e400d8 Disabled extra (ESC) sensors in SmartPort by default. 2018-07-18 23:31:16 +12:00
leocb
05e42db90b Added Max G-force OSD stat 2018-07-17 11:44:01 -03:00
Michael Keller
e2cf7fc238
Merge pull request #6233 from leocb/add-gforce-osd
Added G-Force to the OSD
2018-07-17 18:28:58 +12:00
Michael Keller
5371350150
Merge pull request #6129 from McGiverGim/iterm_relax_decreasing_I
Add Iterm Relax INC modes
2018-07-09 22:43:33 +12:00
Michael Keller
dfb19981db
Merge pull request #6213 from azolyoung/fixed_open_connection_bug_and_timeout_processing
fixed open connection twice times and timeout logic
2018-06-30 14:45:56 +12:00
azol
8b98528590 fixed open connection twice times and timeout logic 2018-06-28 21:00:54 +08:00
leocb
e2eca1b762 Added G-Force to the OSD 2018-06-27 13:56:26 -03:00
jflyper
23e18069ff Fix bad range for 3d_deadband_throttle 2018-06-23 09:13:41 +09:00
Miguel Angel Mulero Martinez
d63eecffaa Add Iterm Relax INC modes 2018-06-15 15:08:09 +02: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
mikeller
a373204d7a Added validation checks for interpolation settings, made throttle boost conditional. 2018-06-05 18:38:57 +12:00
mikeller
9738a1cdd2 Added more options for RC interpolation channel selection. 2018-06-04 22:41:54 +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
a9c1f02afb Added RSSI offset to complement RSSI scaling. 2018-06-03 21:45:55 +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
Michael Keller
f37a8184d5
Merge pull request #5891 from mikeller/add_disable_rx_loss_dshot_beacon_option
Implemented 'beacon' command in CLI.
2018-06-01 21:51:57 +12:00
Michael Keller
011711c0c1
Merge pull request #5998 from Cleric-K/failsafe-mode-switch
Failsafe switch choosable behavior
2018-05-31 23:15:51 +12:00
Michael Keller
f013debb2d
Merge pull request #6008 from McGiverGim/gps_use_galileo
Add Galileo support to GPS
2018-05-31 19:33:53 +12:00
Miguel Angel Mulero Martinez
f43b36ce19 Add Galileo support to GPS 2018-05-31 08:20:58 +02:00
Thorsten Laux
bd289121fc absolute control feature 2018-05-30 23:04:26 +02:00
Michael Keller
d330ad519e
Merge pull request #6004 from mikeller/add_esc_sensor_offset
Added offset parameter to ESC sensor current calculation to compensate for non-ESC consumption.
2018-05-30 22:45:50 +12: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
2fccb2b9b7 Fix from review. 2018-05-30 12:56:30 +12:00
Michael Keller
eecb59db45
Merge pull request #5963 from joelucid/iterm_relax
ITerm relax feature
2018-05-30 09:32:21 +12:00
Cleric-K
e17abc4063 Failsafe switch choosable behavior #5994
The `failsafe_kill_switch` parameter has been renamed to
`failsafe_switch_mode` and it determines what happens
when the Failsafe mode is activated with an AUX switch.
It takes one of three values:
  0 - simulates RC signal loss - thus activates Stage1 failsafe
      (former behavior when kill switch option was OFF)
  1 - disarms immediately
      (former behavior when kill switch option was ON)
  2 - activates the failsafe procedure (Stage2) immediately (new)
2018-05-29 23:28:09 +03:00