Commit Graph

840 Commits

Author SHA1 Message Date
Paul Riseborough e10798bfdf EKF: Add on ground movement detector 2018-06-09 22:23:55 +02:00
Paul Riseborough 2d3b65231b EKF: Reset yaw gyro bias learning when resuming use of magnetometer
The previous lack of yaw drift constraint will also mean that the yaw gyro bias estimate is likely to be incorrect and needs to be re-learned.
2018-06-09 22:23:55 +02:00
Paul Riseborough 8191068959 EKF: Don't start using mag if optical flow use is interrupted
If magnetometer use is being inhibited because an indoor condition has been detected (optical flow and poor or no GPS) and the optical flow fusion checks fail causing the EKF to stop navigating, we do not want the EKF to start using the magnetometer.
2018-06-09 22:23:55 +02:00
Paul Riseborough 4889e8432c EKF: Don't fuse multi rotor drag if yaw angle is bad 2018-06-09 22:23:55 +02:00
Paul Riseborough 092a8d8f21 EKF: Fix GPS validity time check error 2018-06-09 22:23:55 +02:00
Paul Riseborough 0160aaa568 EKF: Don't use magnetometer with optical flow only nav if GPS checks are failing 2018-06-09 22:23:55 +02:00
Paul Riseborough 84516760c0 EKF: Use stricter GPS accuracy test when optical flow is being used
This adds some hysteresis to the automated optical flow selection and also reduces likelihood of bad GPS being used when operating indoors,
2018-06-09 22:23:55 +02:00
Daniel Agar a80b3ab610 set MODULE define for each library
- this is needed for INFO, WARN, ERR messages when used within PX4
2018-05-27 20:08:47 +02:00
Bart Slinger bae4b8a5e7 remove superfluous elseif (#431)
* remove superfluous elseif

* Set ev_hgt flag false when starting on baro
2018-05-11 08:38:42 +10:00
Paul Riseborough e8e9e34a73 EKF: fix bug causing height offset when GPS use stops
This bug causes the last vertical velocity observation to be continuously fused.
2018-05-10 13:45:19 +10:00
Paul Riseborough 6cadc92285 EKF: Don't reject saturated flow data when it is the only aiding source 2018-05-10 07:11:59 +10:00
Paul Riseborough bf902e5eca EKF: Prevent flow motion check false positives
The previous implementation could false trigger if there was significant vibration below 200Hz during startup.
2018-05-09 07:47:17 +10:00
Paul Riseborough bdf5b3e003 EKF: Don't assume large position uncertainty when starting optical flow nav 2018-05-08 08:43:56 +10:00
Paul Riseborough e26711af7d EKF: relax terrain update requirements for continuing optical flow use 2018-05-08 08:43:14 +10:00
Paul Riseborough 868bc01087 EKF: Relax minimum required range finder measurement rate 2018-05-08 08:43:14 +10:00
Paul Riseborough 02963a85c4 EKF: relax optical flow on ground motion checks 2018-05-08 08:43:14 +10:00
Paul Riseborough 24b005ed57 EKF: range finder aiding logic fixes 2018-05-08 08:42:29 +10:00
Paul Riseborough 0c0a6602b0 EKF: Decouple range finder use criteria checking and selection 2018-05-08 08:42:29 +10:00
Paul Riseborough 6708bec1b4 EKF: Don't auto select range finder for height when on ground. 2018-05-08 08:42:03 +10:00
Paul Riseborough 0a63052753 EKF: Fix false triggering of optical flow bad motion checks 2018-05-08 08:42:03 +10:00
Paul Riseborough f9d4934db6 EKF: update comments 2018-05-08 08:42:03 +10:00
Paul Riseborough 82de3141f0 EKF: Don't use optical flow if GPS is good and the vehicle is not using range finder for height 2018-05-08 08:42:03 +10:00
Paul Riseborough 389786ef1b EKF: Stop using EV for yaw when GPS fusion starts 2018-05-08 08:42:03 +10:00
Paul Riseborough 4ab78230e6 EKF: Add persistence criteria to GPS fail check 2018-05-08 08:41:15 +10:00
Paul Riseborough 67d71ca406 EKF: allow GPS fallback if quality bad and alternative aiding available 2018-05-08 08:41:15 +10:00
Paul Riseborough bd59e381db EKF: always run GPS checks 2018-05-08 08:40:31 +10:00
Daniel Agar 3639087ac6 cmake and Jenkins add basic address santiizer test buld 2018-05-05 16:11:04 -04:00
Daniel Agar cf957b5831
code coverage cmake and Jenkins support 2018-05-04 01:40:23 -04:00
Daniel Agar 372f9f430b EKF pytest save plots to pdf 2018-05-03 22:25:36 -04:00
Daniel Agar d6a3110918 visual studio build compatibility 2018-05-03 22:25:36 -04:00
Daniel Agar 3a61035ac2 fix and re-enable EKF pytests 2018-05-03 22:25:36 -04:00
Daniel Agar c5b2f59f57 PX4 style fixes (excluding EKF generated code) 2018-05-03 22:25:36 -04:00
Daniel Agar e5952fadaf cmake standalone build 2018-05-03 22:25:36 -04:00
Daniel Agar eec71d1a10 EKF get_ekf_soln_status() fix pred_pos_horiz_abs 2018-05-03 00:12:23 -04:00
Paul Riseborough 1bd1809d6e
EKF: Fix bug causing simultaneous range and baro height fusion (#429) 2018-05-03 13:24:33 +10:00
Daniel Agar a14434d6dc EKF always fill position and velocity accuracy (#425) 2018-04-23 21:15:29 +10:00
Paul Riseborough 6e3403ce28
EKF: prevent race condition between global position validity and eph reporting 2018-04-21 13:04:04 -04:00
Paul Riseborough fdabb9277f
EKF: Use consistent validity definition for global position reporting 2018-04-21 13:04:04 -04:00
Paul Riseborough 31142c0322
EKF: tighten wind variance growth check 2018-04-21 13:04:04 -04:00
Paul Riseborough ae069b12d6
EKF: Fix bug preventing wind relative dead reckoning 2018-04-21 13:04:04 -04:00
Paul Riseborough 9747dc778d
EKF: Rework nav validity reporting
Remove duplicate checking for dead reckoning and consolidate into a single function.
Use separate timers to check for start of dead reckoning and check when dead reckoning has been performed for too long for the nav solution to be valid.
Allow the timeout for validity reporting to be adjusted externally.
Separate external reporting of dead reckoning from internal checks.
2018-04-21 13:04:04 -04:00
Daniel Agar bd72f3c521 geo std pressure constants and update usage 2018-04-19 08:57:38 +02:00
Daniel Agar 02e319431b cmake remove embedded vim settings 2018-04-11 20:50:30 -04:00
Paul Riseborough 02055acee2
EKF: Fix non GPS aiding data reset logic (#418)
* EKF: Move optical flow specific state reset to helper functions

* EKF: Ensure loss of optical flow aiding is handled correctly

If data is only source of aiding and has been rejected for too long - reset using flow data as a velocity reference.
If flow data is unavailable for too long - declare optical flow use stopped.
Use consistent time periods for all resets

* EKF: Ensure loss of external vision aiding is handled correctly

If data is only source of aiding and has been rejected for too long - reset using data as a position.
Don't reset velocity if there is another source of aiding constraining it.
If data is unavailable for too long, declare external vision use stopped.
Use consistent time periods for all resets.

* EKF: Update parameter documentation

Make the distinction between the no_gps_timeout_max and no_aid_timeout_max parameters clearer

* EKF: make class variable units consistent with documentation

* EKF: Don't reset states when optical flow use commences if using external vision

* EKF: Stop optical flow fusion when on ground if excessive movement is detected.

* EKF: fix terrain estimator vulnerabilities

Reset estimate to sensor value if rejected for 10 seconds
Protect against user motion when on ground.
Fix unnecessary duplication of terrain validity check and separate validity update and reporting.

* EKF: remove unnecessary Info console prints

Optical flow use information can be obtained from the estimator_status.control_mode_flags message

* EKF: fix inaccurate comment

* EKF: remove duplicate calculation from terrain validity accessor function
2018-04-09 18:35:15 +10:00
Daniel Agar cd12f049fe move geo and geo_lookup from PX4 Firmware to ECL 2018-03-26 21:52:11 -04:00
Paul Riseborough 1bb4c17c0e
EKF: Allow use of large GPS position observation noise when using other aiding sources (#403) 2018-03-27 11:31:37 +11:00
Paul Riseborough 8a012436f9
EKF: Fix reversion from GPS to no-aiding mode (#412)
* EKF: Do not delay reversion to no-aiding mode if parameter initiated

* EKF: Move no-aid reversion resets to helper functions

* EKF: Prevent unwanted fusion of velocity data during no aiding mode
2018-03-22 22:39:00 +11:00
Carl Olsson f6d23cc621 added rng_stuck to filter control status flags (#392) 2018-03-21 11:46:27 +11:00
Daniel Agar 1bc7378414
EKF decrease synthetic sideslip interval 1s -> 150ms (#407) 2018-03-15 23:09:42 -04:00
Daniel Agar 341f8962d2
EKF interface add get_wind_status() (#406) 2018-03-14 16:41:09 -04:00
Paul Riseborough 78e983073a
EKF: Fix bug in use of gps velocity noise parameter (#401)
This fixes a bug introduced by an earlier feature request PR. The parameter is supposed to define the lower limit on the observation noise.
2018-02-28 11:48:53 +11:00
ChristophTobler cdc6efc5d6 EKF: fix rot vec calc from quat by using matrix lib 2018-02-08 10:22:55 +01:00
ChristophTobler 9238e2f1a2 EKF: fix spike handling in ev rotation calculation 2018-02-08 10:20:59 +01:00
Paul Riseborough db5264e45c EKF: Add missing reset for output observer vertical position derivative
Required to prevent large transients in value returned by get_pos_d_deriv accessor following a vertical state reset event.
2018-01-31 08:43:39 +01:00
ChristophTobler 337cdcc59a init height using baro when set to ev height (#388)
this also makes sure the _baro_hgt_offset is being initialized correctly
2018-01-30 07:33:28 +11:00
Paul Riseborough a2d6a4dded
EKF: fix indexing bug (#387)
Should use index 9 for vertical position.
2018-01-29 08:09:55 +11:00
Paul Riseborough f016e66ff8
Revert "EKF: Release flow speed limit with altitude gained" (#382)
* Revert "EKF: Release flow speed limit with altitude gained"

This reverts commit e70206f74b.

* Revert "fix code style"

This reverts commit 76bf70121c.

* Revert "Reverse the linked list of data_validator_group and maintain a first node"

This reverts commit 32482e7644.
2018-01-24 20:46:48 +11:00
ChristophTobler cdbca91e79 EV height reset (#379)
* fix typo

* EKF: use baro if it was reset to baro from ev

* EKF: set vert_pos_reset if resetting to ev hgt

otherwise the position controller will not reset the setpoint -> leading to unwanted altitude changes
2018-01-15 20:15:56 +11:00
Daniel Agar 7df4e0f8eb reenable pytest with px4-dev-ecl 2018-01-05 02:39:02 -05:00
Daniel Agar f407954207 initial jenkins configuration 2018-01-05 02:39:02 -05:00
Paul Riseborough 0f047504d4 EKF: Prevent possible div 0 due to incorrect initial values
Gate size class variables should not be initialised to zero, because it will cause a /0 error if fuseVelPosHeight() is called before they are set to their respective parameter values.
2018-01-04 07:47:03 +11:00
Daniel Agar f0862210c7 EKF initialize _hvelInnovGate
- fixes CID 139550
2018-01-03 08:07:28 +01:00
CarlOlsson 5c8b22b43f ekf: return beta test ratio in get_innovation_test_status
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2017-12-18 15:48:36 +01:00
Paul Riseborough e70206f74b EKF: Release flow speed limit with altitude gained
When GPS use is gained whilst flying using optical flow data, the sudden release of the speed limit is unannounced to  the operator and can cause unexpected acceleration.
This patch releases the speed limit as height is gained, but does not reduce it when the vehicle descends, unless GPS use is lost.
2017-12-12 01:26:44 +00:00
Paul Riseborough 83b765f707 EKF: Don't print navigation lost message on startup 2017-12-03 23:02:02 +00:00
Daniel Agar e3da71c89d Ekf initialize all fields 2017-11-26 16:50:16 -05:00
Paul Riseborough 89be63d6c2 EKF: Fix vel pos innovation logging bug 2017-11-24 14:25:44 +11:00
Paul Riseborough b0ad8269a5 EKF: enable separate monitoring of aux velocity innovations 2017-11-21 11:18:09 +11:00
Paul Riseborough 2a57fd858d EKF: clean up reset of fusion flags 2017-11-21 11:18:09 +11:00
Paul Riseborough 8e30c2666d EKF: Add support auxiliary velocity observation
This enables the EKF to use an additional NE velocity measurement. This can be used to improve position hold stability when landing using a beacon system for positioning by fusing the beacon velocity estimates.
2017-11-21 11:18:09 +11:00
Paul Riseborough a2b24fa960 EKF: Protect against ground effect induced static pressure rise during landing and takeoff.
Apply a dead-zone to the vertical position innovation if using baro for height and if in the ground effect region during and just after takeoff.
Method needs to be activated externally.
Turns off automatically after 10 seconds or if specified height gained.
2017-11-17 21:41:31 +11:00
Daniel Agar d9c8af54bd
EKF add print_status() with memory usage 2017-11-16 14:11:34 -05:00
Daniel Agar 75d1ed894c
EKF simplify RingBuffer allocation check 2017-11-16 13:09:17 -05:00
Paul Riseborough af7004ef01 EKF: report observation buffer allocation errors 2017-11-16 20:04:46 +11:00
Paul Riseborough d785a19c0a EKF: delay final allocation of observation buffers until required 2017-11-16 19:47:04 +11:00
Paul Riseborough 7c8fcf7628 EKF: Clarify use of *= operator for quaternions 2017-11-16 11:52:19 +11:00
Daniel Agar ed9a394029
EKF RingBuffer avoid copying 2017-11-15 18:08:51 -05:00
Paul Riseborough 2b20c52c4d EKF: Remove redundant code 2017-11-15 22:03:17 +11:00
Paul Riseborough cfdab732d1 EKF: Update parameter description 2017-11-15 21:28:11 +11:00
Paul Riseborough 72a7ab2c25 EKF: Improve resistance to bad initial mag offset
When magnetic field states have been reset in-flight using a single sample, the magnetic field states are not used to constrain heading drift for a period after the reset. This period has been shortened from 10 to 5 seconds which is enough time to average out the effects of measurement noise (the original concern). The shorter time has enabled the previous practice for RW vehicles of using magnetic heading in that time period to constrain yaw drift to be discontinued. This is necessary becasue while magnetic heading is being used, it fights the yaw corrections obtained from GPs observations and lengthens the time required to recover from a bad mag calibration.
2017-11-13 07:05:56 +11:00
Paul Riseborough df9f48d2d3 EKF: Fix build error 2017-11-13 07:05:56 +11:00
Paul Riseborough 44c50ab2df EKF: Correct magnetic yaw measurement using learned mag biases
Don't apply bias corrections when biases are being learned to avoid possible circular data dependency.
2017-11-13 07:05:56 +11:00
Paul Riseborough c70363c501 EKF: Don't fuse heading if FW and waiting for mag states to stabilise
Doing so is a bad idea because bad mag data can drag the yaw angle away from the reset value and lead to rejection of GPS.
2017-11-13 07:05:56 +11:00
Paul Riseborough 279fc836f7 EKF: Always reset covariance matrix terms when doing vel pos state reset
If state errors were large before the reset, then failure to reset the covariance matrix terms can result in incorrect fusion of position and velocity measurements after the reset due to inconsistencies in the covariance matrix.
2017-11-13 07:05:56 +11:00
Paul Riseborough 141264fe63 EKF: Add method to set diagonals in covariance matrix 2017-11-13 07:05:56 +11:00
Paul Riseborough 32de90b9ef EKF: Add method to zero covariance terms 2017-11-13 07:05:56 +11:00
Paul Riseborough f3e34eddc9 EKF: do not attempt to align FW yaw using GPS method if on ground 2017-11-13 07:05:56 +11:00
Paul Riseborough 8f27d3fc54 EKF: don't reset quaternion states unnecessarily
When performing the initial in-flight mag yaw reset for RW vehicle, do not reset the quaternion states and corresponding variances unless there has been a change in yaw angle large enough to cause problems with navigation.
This is because the state estimates after a reset are more vulnerable to transient sensor errors, so a reset should be avoided if possible.
2017-11-13 07:05:56 +11:00
Paul Riseborough 9e47b6e1b6 EKF: don't reset quaternions unnecessarily
When performing the initial in-flight magnetic field reset for fixed wing vehicles, resetting the quaternion states and their corresponding covariances should be avoided unless yaw errors are large, because state estimates are vulnerable to transient sensor errors immediately following a reset.
2017-11-13 06:55:02 +11:00
Paul Riseborough 29d383edbf EKF: Allow mag field estimates to stabilise before use 2017-11-13 06:55:02 +11:00
Paul Riseborough 363edf5eb9 EKF: Fix yaw reset for fixed wing
Ensures that a complete reset of velocity and position states will always be performed if yaw has had to be reset using GPS velocity.
Ensures that the yaw_align status cannot be set to false once the filter has aligned.
2017-11-13 06:55:02 +11:00
Paul Riseborough 7852c0ed03
Merge pull request #312 from PX4/pr-ekfExtVisQuat
EKF: Enable operation with arbitrary External Vision reference frame
2017-11-12 08:35:39 +11:00
Paul Riseborough 5fd006ca48 EKF: remove redundant code 2017-11-11 07:06:01 +11:00
ChristophTobler e388e59f32 EKF: use uint64_t cast for XeY to avoid float casting of variables
The default type for XeY is float
2017-11-08 11:40:26 +01:00
Paul Riseborough bba3f70a0e EKF: reduce prediction time step from 12 to 8 sec
Reduces susceptibility to incorrect estimation of acceleration bias during sustained yaw rate.
Requires an increase in RAM allocation of 837 Bytes to allow for the longer IMU and output predictor buffers that can be created.
2017-11-02 09:27:33 +01:00
Paul Riseborough 01d68ef67c EKF: Enable use of rotated external nav estimates 2017-11-01 08:33:57 +11:00
Paul Riseborough 063533afae EKF: Add method to enable the IMU bias states to be reset externally 2017-10-26 10:41:39 +11:00
Paul Riseborough cd2ca57ec2 Merge pull request #339 from PX4/ekfPosCtrlLimits-wip
Ekf pos ctrl limits wip
2017-10-23 06:57:23 +11:00
Paul Riseborough 79995b2c15 Create total energy control system implementation
This is a new, clean and streamlined variant of the mathematical derivation I created a few years ago.
2017-10-22 20:37:40 +02:00
Paul Riseborough e10ec59058 EKF: Use consistent test for navigation validity reporting
This will enable controller to take advantage of non-inertial dead reckoning.
2017-10-20 14:44:38 +11:00