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
tbolin
8a506d219f
Increase ez_landing_limit default to 15 (was 5) (#13375) 2024-02-26 12:19:51 +01:00
tbolin
ae71256da7
Throttlebased EzLanding (#12094)
* ezLanding

* Add ez_landing throttle mode

* Correct EzLanding scaling of motorMixRange

* Correct mixer_type switch bracing style

* Remove motor value cliping ez landing mode

- rename mixer type cli setting to EZLANDING from EZLANDING_THROTTLE
- remove EZLANDING_CLIP cli setting
- double default ez_landing_threshold
- halve default ez_landing_limit
- check  and  limits in cli settings
- remove mixer type dependent settings in mixer_init
- remove clip based code in mixer.c

* Change ez_landing setting values and refactoring

- Halve defaul ez_landing_threshold setting and double in init instead.
  Now stick deflection equal to ez_landing_threshold should give approimately full authority.
  Previously it was the point where the mixer was allowed to raise the throttle to 100 % (which wouuld never be required)
- Increase ez_landing_threshold maximum to 200 (from 100) to allow settings that increase authority by a little at full stick deflection
- Increase ez_landing_limit maximum to 75 which is the point where EzLanding should act identical to the Legacy mixer with airmode on
- remove throttle percent from
- simplify calculation of , since throttle stick deflection is no longer involved
- update/remove outdated comments

* Remove old EZLANDING entries in mixerType enum

* Add mixer_type setting to blackbox log header

---------

Co-authored-by: ctzsnooze <chris.thompson@sydney.edu.au>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2023-12-09 02:36:41 +01:00
Ivan Efimov
380d39e570
Renamed tpa....lower to tpa_low_..., + tpa_low_always = OFF by default (#13206)
Renamed tpa....lower to tpa_low_..., inverted the logic for it being active and renamed to a simple tpa_low_always which is OFF by default now
2023-12-08 20:51:52 +01:00
pichim
13d1dc81ce
Additional TPA breakpoint for low Throttle (#13006)
* Removed white spaces and everything that is not new

Rebase on master and update comment

Make TPA lower independent from air mode

Included tpa_breakpoint_lower_vanish option

Changes according to PR comments

Corrected comment for API version

Bugfix in msp.c

Additional TPA breakpoint for low throttle

* Changes according to PR comments

* Update src/main/cms/cms_menu_imu.c

Co-authored-by: Jan Post <Rm2k-Freak@web.de>

* Update src/main/flight/pid_init.c
2023-12-04 16:35:27 +01:00
Mark Haslinghuis
7dffe25ed1
Fix default PID DENOM (#12509)
* Set default PID DENOM

* Fixes after Karate review

* Fixes after Karate review v2

* Use gyro.sampleRateHz

* Fixes after discussion
2023-12-04 03:02:08 +01:00
ctzsnooze
9186d05468
GPS rescue IMU, velocity iTerm and other fixes (#12900)
* GPS rescue update after merge of IMU fix

imuYawCog boost on error
initial turn radius adjustment
attitude debug changes
rescue velocity iterm fixes
earth referencing of yaw forced to on
sanity check failure time 30s

* vary IMU gain according to groundspeed

* Review suggestions implemented
2023-07-05 17:51:28 +02:00
ctzsnooze
23a416b431
Thrust linear code optimisations (#12720)
remove conditions on thrust linear calculation
2023-05-24 21:36:00 +02:00
ctzsnooze
10067ad6ad
TPA optimisations (#12721)
* TPA optimisations

* improvement, thanks @ledvinap

* update following review comments, thanks karatebrot and ledvinap

* include rx.h in pid_init.c to get PWM_RANGE_MIN

* review suggestion
2023-05-11 18:38:15 +02:00
ctzsnooze
68dd061c51
Minor pid.c refactoring (#12722)
* Minor pid.c refactoring

* Only calculate unfiltered gyro delta for that debug

Remove unnecessary comment
Change multiplier to factor of 10

* remove some archaic comments

* clarify name of D_LPF_PRE_TPA_SCALE, use inverse in define

* Remove some blank lines

* undo conversion to division thanks -ffast-math
2023-05-11 17:06:36 +02:00
Jan Post
460e4d00fe
Lead-Lag Compensator (#12730)
* Implement Lead-Lag-Compensator

* Refactoring / Clean up

* Remove trailing whitespaces
2023-05-03 10:01:36 +02:00
ctzsnooze
34057bfbc2
Refactor Feedforward Angle and RC Smoothing - mashup of 12578 and 12594 (#12605)
* Refactor Feedforward Angle and RC Smoothing

* update rc_smoothing at regular intervals

* add Earth Ref to OSD, update pid and rate PG

* Initialise filters correctly

* refactoring to improve performance

* Save 24 cycles in Horizon calculations, other optimisations

At a cost of 40 bytes

* save 25 cycles and 330 bytes in rc_smoothing

* feedforward max rate improvements

* typo fix

* Karatebrot's review suggestions  part one

* Karatebrot's excellent suggestions part 2

* more efficient if we calculate inverse at init time

Co-Authored-By: Jan Post <post@stud.tu-darmstadt.de>

* Horizon delay, to ease it in when returning sticks to centre

* fix unit tests after horizon changes

Co-Authored-By: 4712 <4712@users.noreply.github.com>

* horizon_delay_ms, default 500

* fix unit test for feedforward from setpointDelta

* Final optimisations - thanks @Karatebrot for your advice

* increase horizon level strength default to 75 now we have the delay

* restore Makefile value which allowed local make test on mac

---------

Co-authored-by: Jan Post <post@stud.tu-darmstadt.de>
Co-authored-by: 4712 <4712@users.noreply.github.com>
2023-04-23 22:03:18 +02:00
Mark Haslinghuis
567d3dd2e5
Fix Mercury G4 and fix TODO for PID_PROCESS_DENOM for all targets (#12611)
* Fix Mercury G4

* Changes after #12632

* Fix TODO for PID_PROCESS_DENOM
2023-04-11 04:52:00 +10:00
ctzsnooze
b54ae921fc
update pid.c PG to 7 (#12619) 2023-04-08 05:32:26 +10:00
ctzsnooze
241e9a9b94
Angle and Horizon Mode improvements (#12231)
* Angle and Horizon Update for 4.5

* BugFix FF noise Angle Mode on yaw and in level _race mode

* use time constant in ms for angle feedforward smoothing

* refactor to remove unnecessary definition

---------

Co-authored-by: ChrisRosser <chrisrosser91@gmail.com>
2023-03-15 09:46:24 +11:00
tbolin
0c7061016f
Make dyn idle startup increase configurable (#12432)
* Make dyn idle startup increase configurable

Replace fixed 5 percent max increase from dynamic idle
when airmode is active with a configurable value.

-Default value is still 5.0 percent (50 in cli)
-Add dyn_idle_start_increase cli setting
-Add dyn_idle_start_increase BB header field

* Increse PG reset to ver 6 for pidProfile

* Indentation

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2023-03-09 23:21:14 +01:00
Dominic Clifton
738ed32cff
Improve performance for ELRS SX1280 SPI callbacks and SPI/ELRS handlers. (#11460)
* SPI - Mark the SPI IRQ handler as FAST_IRQ_HANDLER.

Since it's used by both the gyro code, at 8k (or 2x8k on dual gyro
boards) having it in RAM removes a significant amount of potential flash
latency.

It is also used by the ELRS SPI code.  The ELRS code runs at 500hz, but
each cycle uses multiple SPI transfers, for clear irq, read,
start-recieving, change-frequency, etc. I.e. invokd at least 1000hz in
addition to gyro reads.

* ELRS - Move some frequently used functions to RAM and mark some irq
handlers as FAST.

* SPI/LL - Move some frequently called code to FAST_CODE.

Also remove some invalid characters that Eclipse with encoding as UTF-8
complained about.

* SPI - Mark the spiRx and spiTx dma handlers as FAST_IRQ_HANDLER.

* Filter - move nullFilterApply out of FAST_CODE.

Since it doesn't do anything, it doesn't need to be fast.  Instead we
keep more `fast` RAM for other code that really benefits from being in
fast RAM.

There is a slight penalty to jump into slower RAM.

* Gyro - Move `performGyroCalibration`out of 'fast' ram.

On F7X2 it was being inlined, saved 478 bytes of ITCM.

* Prevent handling of crash recovery handling, not detection of crash
recovery, from being inlined to save ITCM for code that runs more
frequently.
2023-01-11 06:33:06 +11:00
haslinghuis
139210e403
Fix TPA (#11969) 2022-11-09 21:18:14 +11:00
haslinghuis
7e441b5f4f
Merge pull request #11887 from KarateBrot/styledef
Remove old style definitions
2022-10-16 00:22:02 +02:00
haslinghuis
b84b8c1ca5
Merge pull request #11097 from mathiasvr/stdlib-abs
Use std abs() instead of ABS() macro
2022-10-14 00:37:29 +02:00
haslinghuis
cbbc80ee90
Merge pull request #11779 from haslinghuis/update-pidprofile
Move TPA to PID profile
2022-10-13 21:09:49 +02:00
KarateBrot
ddf1d46549 Remove old style definitions 2022-10-13 03:33:54 +02:00
Tobias Bolin
c61efe1e2e Make Anti-windup affect anti gravity coefficient 2022-10-12 21:58:43 +02:00
Mathias Rasmussen
61ded491cd Use std abs() instead of ABS() macro
Changes uses of ABS() macro to <stdlib.h> abs() and <math.h> fabsf()
2022-10-12 19:49:03 +02:00
Mathias Rasmussen
9957ceb275 Fix function brace style 2022-10-12 16:31:55 +02:00
ctzsnooze
db528ccc8f Restore iTerm Windup to all axes, active by default 2022-08-22 10:03:55 +10:00
Mark Haslinghuis
f7547192b1 Move TPA to PID profile 2022-08-08 00:07:21 +02:00
ctzsnooze
6aaaf727ff update antigravity for 4.4, no boost on yaw
Update to anti-gravity, including removal of the old Step mode, ability to adjust the P contribution (thanks @Limon), PT2 smoothed derivative model, inherent limiting of P boost during extremely fast stick travels to minimise P oscillations, less I during the middle of a throttle up, no I boost on yaw, add hz to cutoff labels

No antigravity on yaw, fix longstanding typo

h
2022-07-25 11:37:07 +10:00
KarateBrot
0186a7b88d Fix debug mode D_LPF 2022-07-09 03:59:16 +02:00
Štěpán Dalecký
f85ebba6a4 Refactoring of IMU and ACC 2022-06-28 18:26:10 +02:00
J Blackman
00cd0e52e6
Merge pull request #11126 from mathiasvr/pr-int-exp
Use macros for power with integer exponents
2022-06-28 15:28:35 +10:00
Steve Evans
701b0ae55c Remove F1 and F3 support 2022-06-14 19:10:13 +01:00
ctzsnooze
2262dfc60e use Throttle Setpoint, not rcDATA(throttle), for TPA 2022-01-25 18:37:01 +11:00
Mathias Rasmussen
87c259a26e Fix use of floating point math functions 2021-12-21 04:18:59 +01:00
Ivan Efimov
d5c31accdf FW sliders: separate MSP commands for requesting calculations but not applying them into the FW 2021-12-19 04:00:50 -06:00
Mathias Rasmussen
1b95e3c20f Use macros for power with integer exponents 2021-12-14 11:53:09 +01:00
DusKing1
2f52855a91 fix cpu over flow on g4 when pid rate set to higher than 4k 2021-12-02 08:49:03 +08:00
ctzsnooze
e702443730 include lpf1 and make Dterm Static behaviour consistent with gyro static
white to force re-check
2021-10-25 09:21:15 +11:00
ctzsnooze
7da04d6bea set feedforward max rate limit to 90 2021-10-08 17:49:28 +11:00
ctzsnooze
898fe30924 set default iterm_windup to 85 for yaw 2021-09-28 10:33:01 +10:00
ctzsnooze
99a7479b8c consistent gyro and dterm filter names 2021-09-27 09:12:00 +10:00
ctzsnooze
90a2057179 pid slider support with changed defaults 2021-09-26 15:05:05 +10:00
Michael Keller
7a8b40a670
Merge pull request #10777 from ctzsnooze/move-feedforward-transtion-calculation 2021-09-04 16:56:37 +12:00
ctzsnooze
ff19f3fecb D_min smoothing changed to PT2 and re-tuned 2021-08-31 11:37:33 +10:00
ctzsnooze
5863015354 ifdef condition consistently applied, field names consistent, pg ID updated 2021-08-30 09:33:12 +10:00
ctzsnooze
28d9d778a6 feedforward transition moved to feedforward.c 2021-08-30 02:07:36 +10:00
Michael Keller
86aa5cc84e
Merge pull request #10778 from ctzsnooze/Allow-feedforward-in-Level-and-Horizon 2021-08-30 01:20:03 +12:00
Michael Keller
6aa40c1272
Merge pull request #10805 from ctzsnooze/feedforward-fix-at-centre-and-renaming 2021-08-04 12:59:41 +12:00
Michael Keller
b613cc2a7d
Merge pull request #10781 from ctzsnooze/fix-error-horizon-code 2021-08-04 01:37:28 +12:00
ctzsnooze
45ff9ea1e5 fixes for feedforward for 4.3 2021-08-03 23:32:34 +10:00
ctzsnooze
15a60b9e1f allow feedforward in level modes 2021-07-26 15:29:25 +10:00