113 Commits

Author SHA1 Message Date
Paul Riseborough
eb1e73ec81 Merge pull request #283 from PX4/ekf_matrix_cleanup
EKF matrix typedef cleanup
2017-07-03 21:02:24 +10:00
Paul Riseborough
dfbc9de48e Merge pull request #291 from PX4/pr-ekfWindEstBugFix
EKF: Fix bug affecting wind estimation for planes
2017-07-01 11:06:58 +10:00
Paul Riseborough
59edccca4a EKF: Fix bug in wind estimation for fixed wing 2017-06-30 10:32:54 +10:00
Paul Riseborough
ba4a311771 EKF: Update comments for wind estimation logic 2017-06-30 10:32:23 +10:00
ChristophTobler
e1274ad28a move faultiness check above pop_first_older_than() and check independent of range aid to switch back to original sensor if available 2017-06-29 17:07:58 +02:00
ChristophTobler
0d9e535acb Use baro if reset to baro from gps and vice versa 2017-06-29 17:07:42 +02:00
ChristophTobler
4a4b0fa604 remove setting rng faulty in ev mode because not checked 2017-06-29 10:01:16 +02:00
ChristophTobler
066c641d61 range aid: switch to baro/gps even if rng aid conditions met and rng faulty 2017-06-29 09:47:02 +02:00
ChristophTobler
2f382c8e0e if hgt mode is range, switch to baro if range is faulty 2017-06-29 09:47:02 +02:00
ChristophTobler
e4f36215cb if in range aid mode, check faultiness that otherwise would never change back 2017-06-29 09:47:02 +02:00
ChristophTobler
e800de88b6 remove duplicate 2017-06-29 09:47:02 +02:00
Daniel Agar
c44488fdb8
EKF matrix typedef cleanup 2017-06-19 11:10:01 -04:00
ChristophTobler
1fed209804 fix formatting 2017-06-15 09:10:43 +02:00
Roman
5036967343 barometer does not special height sensor offset because a barometer
offset from the local origin is calculated if the primary source for
height is not baro

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
c5d464b821 make range sensor height offset computation more robust
- when switching to range finder use the current terrain estimate as
height sensor offset, otherwise spikes in the range measurements could lead
to a wrong offset

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
182ea43445 fixed baro offset calculation
- do not subtract the height sensor offset variable when computing the
baro offset from the local origin. The baro height offset is calculated
when baro is not fused and so the height sensor offset used in that case
is associated to another sensor and has nothing to do with the baro.

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
39983a7d55 range aid: added hysteresis for switching in and out of range aid
- prevents rapid switching
- added innovation consistency check for using range aid

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
3778f0921a ekf: enable range finder to be used for estimating height even if it's not
the primary height source

- moved height control into single function in order to decide which sensor
should be used for estimating height
- under certain conditions allow to use the range finder to estimate height
even if it's not the primary height source
- fixed a bug where the delta time for the baro offset calculation was always
zero
- use methods to set height control flags to reduce code duplication and
to prevent bugs

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Roman
36bffd2571 ekf: calculate the delta time between consecutive baro measurments
(used for calculating filtered baro offset when primary height source
is not baro)

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
CarlOlsson
a1308482fd EKF: Reset the mag states to the field state variance when switching from the inhibit mag mode to standard mode 2017-05-31 10:18:40 +02:00
CarlOlsson
be16406b35 EKF: Add feature to use the mag to only update the mag states 2017-05-26 11:29:21 +02:00
Paul Riseborough
05c3c46f83 ekf2: changes arising from code review 2017-05-17 08:59:01 +02:00
Paul Riseborough
394dd95cba EKF: Don't do magnetic field estimation without earth frame measurements
Use horizontal acceleration to check if yaw is observable independent of the magnetometer.
Use rotation about the vertical to check if mag raises are observable.
If neither yaw of mag biases are observable, save the magnetic field variances and switch to magnetic yaw fusion.
Use the last learned declination when using magnetic yaw fusion so that the yaw reference remains consistent.
When yaw or biases become observable, reinstate the saved variances and switch back to 3D mag fusion.
2017-05-17 08:59:01 +02:00
Paul Riseborough
5ee0ed5a0d EKF: Increase sensitivity and add tuning of bad accel checks 2017-04-29 11:47:38 +02:00
Paul Riseborough
3758c5a09d EKF: down-sample drag specific force data 2017-04-16 13:07:12 +02:00
Paul Riseborough
465b145929 EKF: Add multi-rotor drag model for wind estimation 2017-04-16 13:07:12 +02:00
Paul Riseborough
2f2ac5be43 EKF: Improve protection against severe IMU accel errors
Use vertical velocity and position innovation failure to detect bad accelerometer data caused by clipping or aliasing which can cause large vertical acceleration errors and loss of height estimation. When bad accel data is detected:

1) Inhibit accelerometer bias learning
2) Force fusion of vertical velocity and height data
3) Increase accelerometer process noise
2017-04-07 08:47:13 +10:00
Paul Riseborough
040639837e EKF: Use common timeout test for reporting deadreckoning
Use a parameter to set the time-out threshold
Use a class variable for the time-out flag
Clean up comments
2017-03-15 07:57:38 +01:00
Paul Riseborough
6561edb9a5 EKF: Clean up terrain estimation functionality.
This is a functionally equivalent. It moves all of the code for the terrain estimator into a single function call from the main filter update, making it clear that it is independent of the main filter.
2017-02-22 14:12:05 +01:00
Paul Riseborough
cf9c8de167 EKF: Add arbitrary pitch offset for range sensor 2017-02-22 14:12:05 +01:00
Paul Riseborough
21270bb06a EKF: Use last known position when resuming OF aiding 2017-01-17 08:58:01 +11:00
Paul Riseborough
3c4c09593f EKF: Rationalise console messages
Combine the observation action buffer and alignment messages
Ensure all data timeout messages are warnings.
Use consistent terminology.
2016-12-28 10:39:47 +01:00
Paul Riseborough
a776b2c549 EKF: Fix bug preventing reset to GPS position when using optical flow 2016-11-26 10:28:58 +01:00
Paul Riseborough
460c9e5250 EKF: Don't try to fuse air data if not in normal aiding mode
Taking off before passing GPS checks would cause airspeed or sideslip to be fused when the filter was still using a constant position assumption. This would cause large airspeed innovations, invalid wind estimates and degrade filter performance after GPS was gained and position and velocity was reset.
2016-11-26 10:28:58 +01:00
Paul Riseborough
951c8b77af EKF: Improve wind state reset logic
Enables wind estimation without an airspeed sensor and enables synthetic sideslip to be used with an airspeed sensor for improved wind state estimation.
Wind states and covariances are reset differently depending on whether airspeed is available.
2016-11-05 12:19:01 +01:00
Paul Riseborough
352b4ca177 EKF: Allow sideslip fusion with airspeed fusion 2016-11-05 12:19:01 +01:00
CarlOlsson
a9182259a5 fixed bug in beta fusion 2016-11-05 12:19:01 +01:00
CarlOlsson
e1d9d503e3 updated logic of when to fuse beta. Now synthetic sideslip measurements are fused after 5 seconds of cruise flight with airspeed sensor activated 2016-11-05 12:19:01 +01:00
CarlOlsson
dec686afd7 updated parameters 2016-11-05 12:19:01 +01:00
CarlOlsson
5205a8198b added function to control when to fuse beta 2016-11-05 12:19:01 +01:00
Paul Riseborough
8aee45dd96 EKF: Fix bug causing repeated resets if GPS sensor disconnected 2016-11-05 09:36:06 +11:00
Paul Riseborough
968cfae632 EKF: Fix bug preventing fallback from GPS mode if GPS is lost 2016-10-25 08:32:01 +11:00
Roman
63cf3d50be ekf gps reset: do not bother checking for need of reset if gps is not
available

Signed-off-by: Roman <bapstroman@gmail.com>
2016-10-24 11:45:36 +02:00
Roman
c5f750dcca ekf reset: more granular reset / timeout strategy for gps fusion
- if both gps position and velocity measurements are rejected for 7 seconds
do a reset
- if only gps position measurements are rejected then wait for 14 seconds
as we still have velocity measurements to constrain the drift in position
- introduced ecl internal parameter for the timeout

Signed-off-by: Roman <bapstroman@gmail.com>
2016-10-24 11:40:12 +02:00
Roman
f80b3481a4 reset the newest output sample for all possible resets
Signed-off-by: Roman <bapstroman@gmail.com>
2016-10-12 08:54:38 +02:00
CarlOlsson
51c8715638 fixed issue with airspeed never fused 2016-08-11 15:26:21 +02:00
Paul Riseborough
d1d56d9e5e EKF: Add logic to to control wind state estimation 2016-08-11 15:26:21 +02:00
Roman Bapst
df0f8fed45 fixed wrong condition on which gps height would be fused (#180)
- this solves the issue where height innovations would jump
between two regimes

Signed-off-by: Roman <bapstroman@gmail.com>
2016-08-05 14:45:48 +02:00
Paul Riseborough
eb2afc522d EKF: fix bug preventing use of baro as a backup height source 2016-06-30 17:06:32 +10:00
Paul Riseborough
573f252b73 EKF: fix bug preventing GPS use as a backup height source 2016-06-30 17:06:32 +10:00