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

74 commits

Author SHA1 Message Date
cvetaevvitaliy
f217ba6d19
Implementation of the ICM-40609D gyroscope driver (#14367)
* add icm40609d

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

refactor include

* add support for setting filters from config

* set optimal settings for AAF

* add settings DEC2 M2 filter for Gyro

* set 3Rd hardware UI filters for Gyro&Accel

* update comments filter order

* set readFN for read SPI data via DMA, add INT1 to pulse mode, push-pull, active high

* fix PR issue

* revert INT1 POLARITY to ACTIVE HIGH

* refactor icm40609GetAafParams

* Update src/main/drivers/accgyro/accgyro_spi_icm40609.c

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update src/main/drivers/accgyro/accgyro_spi_icm40609.c

* update link to datasheet

* fix typo
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-05-27 22:56:37 +02:00
cvetaevvitaliy
b389c2000d
Implementation of the ICM456xx gyroscope driver (#14348)
* add support ICM-45686, ICM45605 gyros

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

* update PR issue

* change IMU order

* fix register AAF for Accel, update comments, configure LPF from config

* change IMU order

* fix access to IPREG_TOP1 registers, update define INT1_CONFIG2

* add read Gyro&Acc via SPI DMA

* coderabbitai bot suggestion

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix buf len

* codestyle

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

* coderabbitai bot suggestion: SPI transfer, Inconsistent accelerometer scale setting

* refactor read spi

* update PR issue

* revert "attempts remaining" for gyro detect

* resolve issue

Co-authored-by: Petr Ledvina <ledvinap@gmail.com>

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
2025-05-26 12:00:41 +02:00
Jacob Dahl
7a44f1bdce
Add IIM42653 IMU support (#14095)
* drivers: accgyro: iim42653 IMU support

* reorder accgyro enums, update comment about IIM42653

* remove comma after VIRTUAL in enum
2025-01-14 22:11:25 +01:00
Mark Haslinghuis
38928085f2
Adds missing ACCGYRO defines and remove legacy drivers (#14087) 2025-01-01 06:06:39 +11:00
ctzsnooze
3138141cd1
Position hold for 4.6 and Altitude Hold updates (#13975)
* autopilot naming, function sharing
* initial position hold setup
* get current gps location
* first position hold draft
* basic control scheme
* add debug values for testing
* first working example with smoothed acceleration
* add deadbands
* Re-organise included files and functions thanks Karate
* revise PID gains
* PIDJ distance controller, not velocity based. Remove airmode check
* sanity check notes
* fix pid bug and improve iTerm handling
* calculate PIDs independently for each axis, increas DJ gains
* adjust pids and smoothing; smoothing cutoff to settings
* force iTerm to zero when close to target
* allow earth referencing in alt and pos hold
* stop activation until throttle raised, but not require airmode
use wasThrottleRaised in place of isAirmodeActivated where airmode isn't really needed
* remove unnecessary debug
* block arming if poshold or althold switches are on
* basic sanity check and OSD warning
* allow user to fly without mag only if they reverse the default
* separate alt and pos hold deadbands
if poshold deadband is zero, sticks are ignored
if user tries to enable posHold and it can't work, they get stick with a deadband
* try to prevent position hold if no mag without valid IMU
fixes a bug in the last commit, also
* retaisn iTerm just attenuate the output
* struct for values
* reset position at start when slowed down, retain rotated iTerm back
* resolve bounceback and remove iTerm attenuation
* adjust PID gains to 30
* force unit tests sto work
* tidy up after merge
* Use mpif
* conditionally only do compass check if Mag is defined
* fixe defines and remove const
* comments to explain strange rc multiplier
* fix small omission when refactoring after throttle raised PR
* licence updates, refactoring from review comments
* fix issues when pos hold deadband is set to zero
* A for acceleration element, not J
* compact the posHoldUpdate() function - thanks K
* rename showPosHoldWarning to posHoldFailure
* Use a function in gps.c to initate the posHold activity on new GPS data
* Use autopilotAngle in place of posHoldAngle
* separate function for gpsHeading truth
* use FLIGHT_MODE(POS_HOLD_MODE) in place of isPosHoldRequested
* removed non-required definitions
* fix failure to initiate position hold from error in ifdef
* refactoring from reviews, rename posHoldReset
* move deadbands for pos and alt hold to their config files.
* comment
* fix for blackbox breakup of GPS values
reverts use a function in gps.c to initate the posHold activity on new GPS data
* fix for msp change for posHoldConfig
* try to constrain aggressiveness at start, smaller deadband
* allow greater overshoot at the start for high incoming speed
rename justStarted to isDeceleratingAtStart
* dynamically update smoothing at the start
* retain iTerm when moving sticks, to keep attitude in the wind
* fix unit tests
* finally retain iTerm correctly while moving sticks, but reset at start
* Fix iTerm reset and parameter rotation
* absolute rotation vs incremental rotation, fix spike after resetting target location
* don't rotate D or A, it reverses their sign inappropriately
* Block yaw, allow in CLI, option to apply yaw correction code
* restore debug
* calc D from groundspeed and drift angle
* add back some target based D
* Earth Frame iTerm vector
appears to work :-)
* fix unit test
* lower PID gains, slowly leak iTerm while sticks move
* earth ref Dterm, not from GPS Speed
smoother than using GPS Speed and heading
* stronger PIDs
* adjust debug
* shoehorn the unit tests
* Proper earth referencing, at last
* clean up a bit
* no need to duplicate wrapping done in sin_approx
* add note about PT1 gain on PT2 filters
* avoid unnecessary float conversions
* Remove unnecessary CLI testing params
* update PID gains, stronger tilt angle correction
* improved distance to target. thanks to demvlad
* Terminate start individually on each axis
added comments
* refactoring to avoid code duplication
* implement reviews, reduce PID gains
* upsampling filter at 5Hz
* warn if posHold mode requested but throttle not above airmode activation point
* disable angle feedforward in position hold
* rebase, pass unit test
* sequential PT1's, refactoring from reviews
* PID and filter revision
* bane of my life
* lenient sanity check, message for noMag, possible DA vector limit code
* replace angleTarget in pid.c only when autopilot is active
* rearrange status checks
* fix debug, tidy up EF axis names, add comments about sign and direction
* stop more cleanly, easier sanity check, phases, debugs complete
* extend sanity check distance while sticks move; refactor; comments
* fix instability on hard stop, allow activation after arming but before takeoff
* make altHoldState_t  local, getter to pass unit tests.
* hopefully the last cleanup of this test file
* implement review from PL - thank you!
* restore angle limiting in pid.c , max of 80 degrees allowed in CLI
* fixes after review changes weren't right
* fix braces
* limit max angle to 50 by vector length
* Fix curly brackets, comments and debug mistake
* in autopilot modes, allow up to 85 deg for pos hold
* limit pilot angle in position hold to half the configured position hold angle
* use smaller of angle_limit or half the autopilot limit
* increase alt_hold sensitivity 5x and narrow deadband to 20
* make altitude control 5x stronger with narrower deadband and new name
* add suggestions from recent reviews
* start autopilot gpsStamp at 0
* renaming variables
* reset the upsampling filters when resetting position control
* improved gpsStamp thanks PL
Also cleanup names and notes
* simplify altitude control
* rename to GPS_distances  to GPS_latLongVectors
* alt_hold respect zero deadband, hold when throttle is zero
* remove unused debug
* fix unit test
* re-name variables in alt_hold and update comments
* more flexible limit on target vs current altitude
* updates from reviews, thanks karate
* review changes from PL
* more updates from PL review
* rationalise GPS_latLongVectors
* remove static newGpsData and rescueThrottle
* Thanks, PL, for your review
* Modifications, but has a big twitch when sticks stop
* Re-naming, fix the twitch, minor changes
* remove unnecessary unit test reference
* sanity dist to 10m at full stop, send task interval for upsampling filter
* vector and parameter re-name
Co-Authored-By: Jan Post <19867640+KarateBrot@users.noreply.github.com>
* small changes from review
Co-Authored-By: Mark Haslinghuis <8344830+haslinghuis@users.noreply.github.com>
Co-Authored-By: Petr Ledvina <2318015+ledvinap@users.noreply.github.com>
* comment PL
Co-Authored-By: Petr Ledvina <2318015+ledvinap@users.noreply.github.com>
* fix ltm alt_hold flightMode
* NOINLINE some pid.c functions
* Revert "NOINLINE some pid.c functions"
This reverts commit 56a3f7cec2.
* fast_code_pref the wing functions in pid.c
* use fast_code_pref where won't break the build
* apply fast_code_pref correctly
* NOINLINE some pid.c functions
FAST_CODE_PREF for updatePIDAudio
add comment to FAST_CODE_PREF
FIx platform.h unit test issue
Wing functions all FAST_CODE_PREF
* revert FAST_CODE_PREF changes
* Reduce ITCM RAM footprint considerably
* multiple name changes and some refactoring
Thanks, PL
* small editorial change
* refactoring, thanks PL
Co-Authored-By: Petr Ledvina <2318015+ledvinap@users.noreply.github.com>
* 64 bytes to check crossing 180 deg longitude
Co-Authored-By: Petr Ledvina <2318015+ledvinap@users.noreply.github.com>
* try to fix build error
Co-Authored-By: Petr Ledvina <2318015+ledvinap@users.noreply.github.com>
* Revert "try to fix build error"
This reverts commit f926d26021.
* just guessing here
* Revert "just guessing here"
This reverts commit ebc240a325.
* use a null location at initialisation
* Revert "use a null location at initialisation"
This reverts commit b51ae1395d.
* revert more compact initialisation code due to SITL error otherwise
* fix wrapping when 180 lon meridian is crossed
* null location option from PL
* Revert "null location option from PL"
This reverts commit ad40e979bd.
* refactor PosHold start/stop code
* move Alt_Hold and Pos_Hold warnings ahead of Angle, update some comments
* use setTargetLocationByAxis, fix comments
* change from karatebrot review
Co-Authored-By: Jan Post <19867640+KarateBrot@users.noreply.github.com>
* things still to do
Co-Authored-By: Jan Post <19867640+KarateBrot@users.noreply.github.com>
* keep warning strings 12 or less characters
Co-Authored-By: Jan Post <19867640+KarateBrot@users.noreply.github.com>
* a few more
Co-Authored-By: Jan Post <19867640+KarateBrot@users.noreply.github.com>

---------

Co-authored-by: Jan Post <19867640+KarateBrot@users.noreply.github.com>
Co-authored-by: Mark Haslinghuis <8344830+haslinghuis@users.noreply.github.com>
Co-authored-by: Petr Ledvina <2318015+ledvinap@users.noreply.github.com>
Co-authored-by: Jay Blackman <blckmn@users.noreply.github.com>
2024-12-06 13:04:00 +11:00
Jan Post
db44e9df9e
Collision Detection (#13010) 2024-12-01 03:20:15 +11:00
Jan Post
f71170db1b
Vector library expansion (#12968) 2024-09-16 07:03:32 +10:00
ctzsnooze
f890287598
Auto-disarm on landing impact (#13803)
* Disarm on landing

* Changes from review comments, thanks PL

* Sorry missed that one

* calculate Acc magnitude once only, not multiple times

* Include gyro factors as in crashRecovery

* Fix bug in CrashRecovery delta gains

Add temporary debugs to monitor error and delta inputs

* remove 1G subtraction for accMagnitude

thanks Karate

* Use AccDelta or Jerk - thanks Karate

* Revert using Gyro Setpoint and Delta

* Fix typo, thanks Mark

* increment PG version to 9
2024-08-10 08:34:51 +02:00
Steve Evans
e126f1c4a4
STMicro LSM6DSV16X IMU support (#13046)
Add support for LSM6DSV16X
2023-12-04 02:19:48 +01:00
Homer
515e55ef0a
Rename FAKE to VIRTUAL (#12493)
* use_fake_xyz to use_virtual_xyz

* xyz_fake to xyz_virtual

* other fake to virtual

* all files fake to vrtual

* last touch on fake to virtual
2023-03-14 12:35:39 +01:00
Štěpán Dalecký
f85ebba6a4 Refactoring of IMU and ACC 2022-06-28 18:26:10 +02:00
Dominic Clifton
46c62cfcf2 ICM42688P - Initial sensor support based on ICM42605 driver. 2021-08-10 21:09:34 +02:00
Bruce Luckcuck
99a9543968 Add support for LSM6DSO gyro/acc
Also supports the LSM6DSOX variant which has the additional machine learning core (not used by Betaflight).
2020-06-21 16:22:29 -04:00
Bruce Luckcuck
447cbac988 Add support for Bosch BMI270 gyro/accelerometer sensor 2020-03-08 18:56:50 -04:00
Bruce Luckcuck
f584780944 Gyro native rate sampling, filtering, and scheduler restructuring 2020-02-04 18:19:35 -05:00
Dominic Clifton
3b3ead25f0 ICM42605 - Initial sensor support. 2019-12-26 20:09:47 +01:00
mikeller
cedcf2d7e2 Added calibration menu to CMS. 2019-11-19 13:59:52 +13:00
mikeller
a21d0f5d31 Fixed potentially incorrect calculation in ACC calibration if non-default cycle number is used. 2019-11-17 10:58:28 +13:00
mikeller
b5908f5bab Applied 'USE_ACC' consistently. 2019-02-08 09:51:48 +13:00
mikeller
21edada68b Removed leftover references to 'gyro_align', 'acc_align'. 2019-02-01 01:50:40 +13:00
blckmn
a9f74cd6df Removed excess trailing spaces before new lines on licenses. 2018-04-25 20:58:00 +10:00
blckmn
46fe22b4bd Direct license replacement 2018-04-22 09:22:46 +10:00
Adrian Miriuta
b21d681153 Introduced cli parameter <gyro_offset_yaw>
It allows to manually compensate gyro drift over time.
rebased squashed.
2018-01-25 12:45:38 +01:00
Martin Budden
d90b42970c Acc fn/variable renames to align with iNav 2017-12-29 10:23:51 +00:00
mikeller
b489d0ba9d Renamed 'parameter_group' to 'pg'. 2017-12-19 23:36:31 +13:00
Martin Budden
22c672fa7d Add acc and gyro accumulators to improve attitude estimation 2017-11-28 06:26:57 +00:00
Martin Budden
ed04a1f24a Improve ACC filter initialisation 2017-11-24 07:23:19 +00:00
brianlbalogh
b295a159b0 Add gyro rates and configurable FSR for ICM20649 (#4077) 2017-09-07 14:05:11 +01:00
Brian Balogh
afec0258c7 Add support for ICM-20649 acc/gyro 2017-09-01 10:57:54 -04:00
Steffen Windoffer
03aa31acdd remove not needed whitespaces 2017-08-24 11:33:39 +02:00
Martin Budden
2493c214b0 Created subdirectories in drivers directory 2017-04-12 08:06:22 +01:00
Martin Budden
9a3cad9ca3 Further work on gyro SPI selection 2017-03-26 10:10:10 +01:00
Martin Budden
dbfc355097 Added support for BMI160 gyro 2017-02-22 21:37:37 +00:00
Martin Budden
5851b21e4a Removed a number of static config pointers 2017-02-01 12:58:29 +00:00
Martin Budden
79d4b2146d Preparation for conversion to parameter groups 2017-02-01 08:46:19 +00:00
Martin Budden
8e79e8092e Fixed up whitespace 2017-01-22 22:42:45 +00:00
blckmn
102114758c Better representation of actual sensor (when using 6500 compatible sensors). 2017-01-01 18:37:54 +11:00
Martin Budden
ee8a1676c4 Moved accelerometerTrims into accelerometerConfig() 2016-12-17 22:30:03 +00:00
Martin Budden
17494840a5 Moved gyro and acc detection code into init functions 2016-12-13 10:00:43 +00:00
Martin Budden
4bb6820c42 Moved sensor detection into respective sensor modules 2016-12-05 15:26:14 +00:00
Martin Budden
229f6d14d4 Moved accZero and magZero out of sensorTrims into acc and compass config 2016-12-05 06:49:15 +00:00
Martin Budden
06e871406e Moved xx_hardware out of sensorSelectionConfig into config for specific sensor 2016-12-05 06:49:14 +00:00
Martin Budden
60e2227396 Moved alignment from sensor into device 2016-12-05 06:49:14 +00:00
Michael Jakob
46387c9dbe Cleanup ENUM usage 2016-12-04 16:09:21 +01:00
Martin Budden
b8b9c95f57 Moved sensor global data into sensor_s structs 2016-12-01 17:47:17 +00:00
Martin Budden
265cd85457 Moved accelerometer items to struct. masterConfig tidy. 2016-11-27 14:42:50 +00:00
kc10kevin
6dbded7071 ICM20689 Gyro Fix 2016-10-16 20:28:53 -05:00
Anders Hoglund
44abc8f2e4 Clean up vtx.c includes, move all not directly used to where they belong. 2016-10-09 21:26:17 +02:00
kc10kevin
dc4b4ac986 ICM-20689 Gyro 2016-09-14 07:33:32 -05:00
kc10kevin
57c24c6ee1 ICM-20689 Gyro 2016-09-13 19:44:36 -05:00