1444 Commits

Author SHA1 Message Date
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
CarlOlsson
dbf0bd43e8 EKF: update wind covariance initialization
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2020-01-23 10:27:54 +11:00
kamilritz
37201fb071 Remove legacy imu interface 2020-01-23 09:34:07 +11:00
kamilritz
7c3a2f839b Update range finder interface 2020-01-23 09:34:07 +11:00
kamilritz
4fb2d1b02e Update range finder interface 2020-01-23 09:34:07 +11:00
kamilritz
9f0d8ed59e Update mag interface 2020-01-23 09:34:07 +11:00
kamilritz
856961ba85 Update airspeed interface 2020-01-23 09:34:07 +11:00
kamilritz
b8a3ed5f09 Update baro interface 2020-01-23 09:34:07 +11:00
kamilritz
74ec80cdc7 Update gps interface 2020-01-23 09:34:07 +11:00
Paul Riseborough
a19c29e708 EKF: Rework yaw fusion to remove singularity at +-90 deg yaw 2020-01-23 09:23:56 +11:00
kamilritz
fc7e8b848b Run github actions also on PRs from forks 2020-01-22 09:47:19 +01:00
kamilritz
29cf7884c3 Test baro downsampling 2020-01-21 10:09:48 +03:00
kamilritz
b51ea4fe39 Test dynamic pressure compensation
(cherry picked from commit b3d9334b5abe02f1d123519cfc74a875225eb0bd)
2020-01-21 10:09:48 +03:00
kamilritz
83b2abe434 protect against overflow 2020-01-21 10:09:48 +03:00
kamilritz
4be9ae8029 Compute the timestamp of average sample correctly 2020-01-21 10:09:48 +03:00
kamilritz
29c5954690 Move baro downsampling and dynamic pressure comp to ECL 2020-01-21 10:09:48 +03:00