Commit Graph

1459 Commits

Author SHA1 Message Date
bresch f38388cdab YawEst: simplify AHRS accelerometer gain computation
Replace the multiple if-else statements by a generic equation.
- For a multicopter, the attenuation factor is 2 and symmetrical
- For a fixedwing, the attenuation factor is 1 if the acceleration is
positive and that centripetal correction is available and 2 otherwise.

Note that the function "sq" needs to be const in order to be used in a
const function.
2020-03-18 17:45:13 +01:00
CarlOlsson ee5e3c479b ekfgsf: fix formatting 2020-03-18 08:34:02 +01:00
Mathieu Bresciani f20fc08b7d
ekf2: centralize mag covariance reset (#693)
* ekf2: centralize mag covariance reset. A complete and clean reset of the
mag states covariances is now performed through the "resetMagCov"
function only. This avoid having slight differences of implementations
across the code.

* Ekf: reset quat cov with initial uncertainty instead of zero
2020-03-17 20:07:20 +11:00
Daniel Agar f1aa53db8a
delete attitude_fw (merged into PX4/Firmware)
- this was never maintained as a separate standalone project
 - https://github.com/PX4/Firmware/pull/14284
2020-03-15 13:36:27 -04:00
kamilritz 975060d108 Add missing const modifier 2020-03-11 16:46:16 +01:00
kamilritz 7e20d9df14 Small style cleanup 2020-03-11 16:46:16 +01:00
Daniel Agar 580118e366
EKFGSF_yaw::updateEKF() R_prev copy safely (#775)
* EKFGSF_yaw::updateEKF() R_prev copy safely

* only copy required values (first 3)
2020-03-11 15:49:45 +01:00
kritz 9390d2065b
Run github actions also on master branch (#774) 2020-03-10 20:24:29 +01:00
bresch d09473da89 Ekf control: do not set hgt mode if already set
If we are in a certain height mode and that we do a reset to the
same mode, there is no need to set the mode again.
2020-03-09 20:22:57 +01:00
bresch 13a7d53295 Ekf: correct wrong indentation 2020-03-09 20:22:57 +01:00
bresch 684737eab1 Ekf control: replace individual by global check of baro/GPS health
Use _gps_data_intermittent and _baro_hgt_faulty to know is the sensors
provide fresh data
2020-03-09 20:22:57 +01:00
bresch 320a90d146 EKF control: extract checkVerticalAccelerationHealth logic
This is done to reduce the size of the controlHeightSensorTimeouts
function and to clarify the logic
2020-03-09 20:22:57 +01:00
bresch 975afa6560 EKF: update csv for change indicator 2020-03-09 19:10:07 +01:00
CarlOlsson 93be6ea49a EKF: dont print wrong reset message on baro timeout
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2020-03-09 09:06:49 +01:00
kritz bcd3869ca2
CleanUp of the EKFGSF (#769)
* Add const modifiers

* Pass imu data as sampe

* Remove emergency reset request counter

* Improve matrix library usage

* Indentation fix

* Do not store innovation matrix for each model

* Make weights a separate vector

* EKF: Add missing alignment transfer to AHRS solutions

* EKF: Replace #define constants with static constexpr

* EKF: Move declaration for weights into GSF section

* EKF: Fix documentation error

Co-authored-by: Paul Riseborough <p_riseborough@live.com.au>
2020-03-06 19:37:35 +11:00
Paul Riseborough 4669aa6312
EKF: Add Emergency yaw recovery using EKF-GSF estimator (#766)
* EKF: Use common rate vector calculation for offset corrections

* EKF: Remove duplicate matrix entry calculations

* EKF: Create a EKF-GSF yaw estimator class

* EKF: add emergency yaw reset functionality

* EKF: remove un-used function

* EKF: Ensure required constants are defined for all builds

* EKF: Fix CI build error

* Revert "EKF: remove un-used function"

This reverts commit 93005309c7f3794414ad99c86218b3062e00bbd3.

* EKF: Replace in-lined Tait-Bryan 312 conversions with function call

Also remove unnecessary operations

* EKF: Remove unnecessary update of external vision rotation matrix

* EKF: Use const

* EKF: use const

* EKF: don't use class variable as a temporary variable

* EKF: update comments

* EKF: Improve efficiency of yaw reset

Use conversion from rotation matrix to Euler angles instead of quaternion to euler angles.

* EKF: use const

* EKF: remove un-used struct element

* EKF: more descriptive function name

* EKF: use existing matrix row operator

* EKF: remove unnecessary rotation matrix update

* EKF: Use square matrix type

* EKF: Improve protection for bad innovation covariance

* EKF: Use matrix library operations

* EKF: Replace memcpy with better alternative

memcpy bypasses compiler sanity checks and is unnecessary in this instance.

* EKF: Split EKF-GSF yaw reset function

Adds a common function to support yaw reset that can be used elsewhere.

* EKF: Use common function for quaternion state and covariance yaw reset

* EKF: Replace inlined matrix operation

* EKF: Use const

* EKF: Change accessor function name

* EKF: Use const

* EKF: Don't create unnecessary duplicate variable locations

* EKF: Remove duplicate covariance innovation inverse

* EKF: Don't create unnecessary duplicate variable locations

* EKF: Rely on geo library to provide gravity

* EKF: Improve protection from bad updates

* EKF: Reduce effect of vibration on yaw estimator AHRS

* EKF: Improve yaw estimator AHRS accuracy during manoeuvre transients
2020-03-05 21:50:52 +11:00
Paul Riseborough 8ce285cdfa
EKF: Don't allow tilt alignment if vehicle is moving excessively (#768)
Also remove unnecessary update of the _accel_lpf after alignment.
2020-03-05 21:42:45 +11:00
Mathieu Bresciani 230c865fa9
EKF: do not fuse multiple times the same height (#767)
* EKF: do not fuse multiple times the same height

The _fuse_height flag was never set to zero, hence the fusion was called
at each iteration, even if no new data is available.
The effects were: high CPU usage and virtually less measurement noise
due to multiple fusion of the same sample

Also remve unused variables
2020-03-04 10:31:22 +01:00
Paul Riseborough b4ecfb7723
EKF: Fix sign error in earth rotation rate correction (#763)
* EKF: Fix sign error in earth rotation rate correction

Addresses issue https://github.com/PX4/ecl/issues/759

* Update change indication output

Co-authored-by: kritz <kritz@ethz.ch>
2020-03-03 20:16:49 +01:00
Daniel Agar 4fab6057a7 EKF control height fusion add switch statement for all dist sensor types 2020-03-03 11:29:07 +01:00
Kamil Ritz 7c179b39b8 Make test with Clang 2020-03-03 11:23:45 +01:00
Carl Olsson 3fa5f501ae
EKF: dont check gps_check_fail_status in velocity reset (#761)
In a velocity reset we only used the GPS measurement if _gps_check_fail_status.value was equal to zero. The value of this flag is independent of EKF2_GPS_CHECK so checks can fail even if they are not configured to have any effect.
2020-02-27 11:59:38 +01:00
Daniel Agar 71d4d22ae4
EKF: covariances() helper return const reference and fix code style
- PX4 astyle puts the reference with the name.
2020-02-21 11:28:44 -05:00
bresch 8b918563a2 ekf: fix angle wrapping in realignYawGPS
To obtain the correct difference between two angles, we need to wrap
the result between -pi and pi. Otherwise, the difference between two
angles close to 180 degrees but with opposite signs will produce a large
error.
For example if a = -179 and b = 179, b - a = 258 instead of -2 degrees
2020-02-21 13:08:30 +01:00
Daniel Agar 00872fcaa3
EKF: ImuDownSampler pass imuSample as const reference
- inline ImuDownSampler::getDownSampledImuAndTriggerReset()
 - minor formatting and initialization cleanup
2020-02-18 13:20:52 -05:00
bresch 81c6d6655f ekf: clean uncorrelateQuatStates function
As the name can be ambiguous, it gets renamed
"uncorrelateQuatFromOtherStates".
Also replace the loops storing the values and reapplying them by simply
zeroing two slices (this also saves 130B of flash).
2020-02-13 14:33:32 +01:00
Julian Kent c6d5a74685 Update change indicator 2020-02-12 22:34:44 +01:00
bresch 05d391c785 Update test csv after functional fix 2020-02-12 22:03:22 +01:00
bresch 90ca012705 ekf_helper: restore oridinal quaternion decorrelation
The intent of the function "uncorrelateQuatStates()" is to uncorrelathe quaternions from the other states but not between each other as they are and should remain linked alltogether.
Clearing the quaternions to quaternion covariances introduced unstabilities in other states (especially accel biases).
2020-02-12 22:03:22 +01:00
CarlOlsson b6420d0b79 ekf: add vehicle at rest to flags 2020-02-12 18:58:24 +01:00
Paul Riseborough 89bcebd631 EKF: Prevent covariance initialisation overwriting yaw variance
Also typo fix
2020-02-05 15:20:34 +01:00
Paul Riseborough a3347b7e06 EKF: Use more conservative value for delta velocity bias process noise
Smaller values have resulted in bias estimation divergence under some conditions
2020-02-05 15:20:34 +01:00
Paul Riseborough 21054a4236 EKF: Fix bug causing incorrect covariance initialisation
The covariance initialisation should not be performed before the quaternion states are initialised.
2020-02-05 15:20:34 +01:00
Daniel Agar ed260c4f1d validation: remove unused vibration metric 2020-02-04 23:37:05 -05:00
kritz e52e2b88ed
Sensor Replay (#717)
* Add primitive logging for Ekf

* Add python script to extract sensor data from ULog

* Add primitive sensor replay

* Add iris_gps data for sensor replay

* Add CI for functional change indication

* Update sensor replay flow data type

* update iris_gps_change indication

* test: Update EKF replay test documentation

Co-authored-by: Paul Riseborough <priseborough@users.noreply.github.com>
2020-02-01 20:41:12 +11:00
kamilritz da752c9e30 Hot flow fusion fix 2020-01-28 17:19:51 +01:00
kritz ee859e092a Robustify timestamp checks (#729)
* Robustify timestamp checks

* Remove lowerbound on sensor timestamp

* Add tests for fusion timeouts

* Inline and const time check functions

* Rename dead_reckoning time variable
2020-01-28 20:33:16 +11:00
kamilritz f20726d47f Expand auto-format coverage and tiny style changes 2020-01-27 16:54:25 +01:00
kritz fbdd75da2e Update CONTRIBUTING.md
Co-Authored-By: Roman Bapst <bapstroman@gmail.com>
2020-01-27 10:42:17 +03:00
kamilritz 5d38b73072 Update description of Firmware build tests 2020-01-27 10:42:17 +03:00
bresch e3af91c9ce Ekf: use helper functions to centralize the checks of horizontal aiding (gps, flow, ev_pos, ev_vel) 2020-01-24 17:22:50 +04:00
kamilritz a3e1eb9d50 Checkout to matching firmware if possible 2020-01-24 16:18:42 +03:00
kamilritz f3d790a664 Update optical flow interface 2020-01-24 16:18:42 +03:00
RomanBapst cafb1400fb estimator_interface: bugfix, set range sample correctly
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2020-01-24 13:03:04 +01:00
kamilritz df37c9bf1d First draft of the contribution guidelines 2020-01-24 09:31:49 +01:00
kamilritz 4b0e7b2cff Remove filtering on external vision alignment 2020-01-24 08:23:12 +01:00
kamilritz 2fe16c4ffe Update build instructions in readme 2020-01-24 09:03:48 +03:00
kamilritz d63e4edfd8 Fix github actions 2020-01-23 16:31:42 +01:00
kamilritz de33885658 Update setExtVisionData interface 2020-01-23 14:50:43 +01:00
kritz ed916c8006 Auto Formatting with clang-format-6.0 (#727)
* Add clang-format

* Auto-format AlphaFilter and RingBuffer

* Update to tab=8spaces

* Allow for 120 width
2020-01-23 20:56:10 +11:00