Commit Graph

644 Commits

Author SHA1 Message Date
Paul Riseborough c81f9f1dba EKF: Reduce output predictor tracking errors
Implements a PI tracking loop
2016-10-03 14:13:07 +11:00
Julian Oes 616aeb9ad7 ekf_helper: fix forgotten return value 2016-09-27 16:36:29 +02:00
Julian Oes fd403b733d CMakeLists: don't always optimize for size
Going forward the optimization flags should be set for a platform,
rather than for each individual module.
2016-09-27 16:35:35 +02:00
Roman c6e1d97176 terrain estimator: initialise with projection
Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-20 14:09:42 +02:00
Roman cc05db4985 terrain estimator: pass initialisation return value correctly
Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-20 14:07:50 +02:00
Roman d53f532079 fixed computation of range measurement timestamp
Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-17 11:41:12 +02:00
CarlOlsson 8d60da1442 removed old wind initialization 2016-08-11 15:26:21 +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
Paul Riseborough 75bec44b94 EKF: add function to initialise wind states 2016-08-11 15:26:21 +02:00
Paul Riseborough 6dff2df28e EKF: Add method to reset wind state covariances
Set variances in polar coordinates and rotate into cartesian frame
2016-08-11 15:26:21 +02:00
Paul Riseborough a9894d7e8c EKF: improve efficiency of airspeed fusion
Don't compute array entries where the result will be zero
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
Youssef Demitri 168d9add76 added getter function for wind states 2016-07-22 12:33:41 +02:00
Beat Küng 73b8ac954d ekf_helper.cpp: remove unused includes
This fixes a compile error with GCC 5.2.0 and cross-compilation:
/usr/arm-none-eabi/include/c++/5.2.0/arm-none-eabi/armv7e-m/fpu/bits/error_constants.h:122:27: error: 'ENOTSUP' was not declared in this scope
       not_supported =     ENOTSUP,

The problem was that the #include <iomanip> was taken from the host system,
which conflicts with includes from NuttX (NuttX has only basic C++ STL
support)
2016-07-15 12:50:11 +02:00
Lucas De Marchi 2240eb6b4f Move __STDC_FORMAT_MACROS to build system (#174)
__STDC_FORMAT_MACROS changes the behavior of inttypes.h to allow
defining format macros for printf-like functions. It needs to be defined
before any include is done, otherwise due to include chains and header
guards it may not take effect.

Instead of defining it everywhere it is used, let the PX4 build system
to deal with it.
2016-07-10 16:29:51 +02:00
Paul Riseborough a2d866520a EKF: perform innovation check in all axes before fusing 3D mag data (#171)
Perform the innovation consistency check on all axes first and exit if any axis fails. Reduces the likelihood of bad magnetometer data corrupting the attitude estimates.
2016-07-07 16:46:30 +02:00
Paul Riseborough f5e9ea1626 EKF: Prevent potential divide by zero 2016-06-30 17:06:32 +10: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
Paul Riseborough 5f9752cac8 EKF: Improve function names 2016-06-30 17:06:32 +10:00
Paul Riseborough 7bc9217f00 EKF: Clean up control of observation fusion
All the decision for a sensor are made within a specific function for that sensor and when there is data to process at the fusion time horizon.
Information and warning messages are improved.
2016-06-30 17:06:32 +10:00
Beat Küng 9a95898414 gps_message: remove time_usec_vel from struct (unused) 2016-06-27 10:12:23 +02:00
Roman Bapst 1b394460a3 fix comment about filter bias states
Signed-off-by: Roman Bapst <roman@px4.io>
2016-06-21 14:13:47 +02:00
Roman Bapst bec1a6831e added method to get gyro bias
Signed-off-by: Roman Bapst <roman@px4.io>
2016-06-21 14:13:47 +02:00
Roman 703fb4e31b do not return early in velocity reset method otherwise
some code will not be executed
2016-06-08 07:51:18 +02:00
Paul Riseborough 928a7dd059 Merge pull request #157 from PX4/pr-ekf2ResetInterface
Change state reset information interface
2016-06-08 14:18:31 +10:00
Paul Riseborough 2024252d65 Merge pull request #158 from CarlOlsson/act_ars_off_by_default
activate tas fusion, off by default
2016-06-08 14:17:31 +10:00
Paul Riseborough f26aca55a1 EKF: Fix bug in quaternion covariance initialisation function
The covariances between quaternion and non-quaternion states were not being updated
2016-06-08 13:23:30 +10:00
Paul Riseborough b3baab64f2 EKF: Updates to 3-axis mag fusion auto-code
The code fragments for the magnetometer fusion have been refreshed from the auto-coder.
Explicit floating point types used for constants.
The 3x24 observation Jacobian has been replaced with a 1x24 that is updated each axis iteration to save memory.
2016-06-08 12:56:59 +10:00
Paul Riseborough 21168f9929 EKF: fix bug in 3-axis mag fusion innovation test
The fault flag was not being set after an innovation test failure resulting in fusion of the failed measurement
2016-06-08 11:58:33 +10:00
Paul Riseborough 99b34f0df4 EKF: Only reset necessary terms when mag fusion covariance reset required
Only the quaternion and mag fusion state covariances are used in the mag fusion calculations.
2016-06-08 11:58:33 +10:00
Paul Riseborough 381d99aed6 EKF: Inform console of serious fusion numerical errors 2016-06-08 11:58:33 +10:00
Paul Riseborough dbfe8c0242 EKF: remove approximation in mag fusion innovation variance calculation
The covariance was not being updated with the observation from one axis before the innovation variance was calculated for the next axis. This results in greater weighting on measurements for subsequent axes.
2016-06-08 11:58:33 +10:00
Paul Riseborough 79228352e9 EKF: Reset mag and wind state variances to 'reasonable' values
If an in-flight reset is required, we do not want these variances going to zero as that will significantly delay recovery
2016-06-08 11:58:33 +10:00
Paul Riseborough 34ffffa021 EKF: Prevent use of non time-stamped invalid data during initialisation
Fixes bad height initialisation seen intermittently with snapdragon
2016-06-08 11:56:07 +10:00
CarlOlsson eded0a8f7e activate tas fusion, off by default 2016-06-07 13:49:17 +02:00
Paul Riseborough 3c84d37175 Merge pull request #156 from PX4/fix_printfs
EKF: use ECL printfs everywhere
2016-06-07 09:45:00 +10:00
Paul Riseborough 081e17729c EKF: delay commencement of 3D mag fusion until clear of ground
Wait until enough height has been gained to be clear of ground based magnetic anomalies. Failure to do so can result in incorrect earth field initialisation.
2016-06-06 21:59:46 +10:00
Roman Bapst 670c6ca019 change state reset information interface for more convenient handling
on firmware side
2016-06-06 13:22:20 +02:00
Paul Riseborough f08aee0a7d EKF: Fix covariance index bug 2016-06-04 00:36:07 +10:00
Julian Oes b8e2f79005 EKF: correct include paths 2016-06-02 16:29:22 +01:00
Julian Oes ecfd8c867a EKF: use ECL printfs everywhere
- Changes all printfs to ECL printfs
- Add ECL_ERR.
- Include ecl.h where needed.
- Add forgotten pragma once.
2016-06-02 16:07:26 +01:00
Paul Riseborough 6a55d908c5 EKF: replace reset event times with event counters
Using a 64bit integer was unnecessary given it was only being used to detect a new reset event.
2016-06-01 17:13:00 +10:00
Paul Riseborough 70f76e1a6c EKF: publish innovation consistency check fail status 2016-06-01 17:13:00 +10:00
Paul Riseborough e371a303a9 EKF: publish the quaternion reset event 2016-06-01 17:13:00 +10:00
Paul Riseborough 81ca167da8 EKF: align output observer to EKF states on startup 2016-06-01 17:13:00 +10:00
Paul Riseborough 3ec9221c18 EKF: update output observer and capture reset event for EV yaw resets 2016-06-01 17:13:00 +10:00
Paul Riseborough 9ec09f5f4e EKF: update output observer and capture reset event for magnetic heading resets 2016-06-01 17:13:00 +10:00
Paul Riseborough 2b0d5c28f0 EKF: capture full quaternion change for reset events 2016-06-01 17:13:00 +10:00
Paul Riseborough b2e432e211 EKF: publish position and velocity reset data 2016-06-01 17:13:00 +10:00
Paul Riseborough 733862f649 EKF: move the reset status struct to the Ekf class
This protects it from being modified externally
2016-06-01 17:13:00 +10:00
Paul Riseborough aca0336392 EKF: update vertical position and velocity reset capture
Use reset event struct members instead of separate variables
2016-06-01 17:13:00 +10:00
Paul Riseborough 0605c88ecc EKF: capture horizontal position reset events 2016-06-01 17:13:00 +10:00
Paul Riseborough e3a1b4a3b3 EKF: capture velocity reset events 2016-06-01 17:13:00 +10:00
Paul Riseborough 4237269fab EKF: add struct to capture state reset events 2016-06-01 17:13:00 +10:00
Paul Riseborough 65da9173b9 EKF: capture innovation checks and reset events in separate variables
rename the innovation check status class variable and remove the reset flags from it.
2016-06-01 17:13:00 +10:00
Paul Riseborough 79705da7e6 EKF: make output predictor states consistent with position reset 2016-06-01 17:13:00 +10:00
Paul Riseborough 54d90261d5 EKF: make output predictor states consistent with velocity reset 2016-06-01 17:13:00 +10:00
Paul Riseborough 52229da089 EKF: capture optical flow innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough d80e71a499 EKF: capture HAGL innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough 8125717bf5 EKF: remove un-used airspeed health class variable
Airspeed rejection now is captured in _sensor_fault_status
2016-06-01 17:13:00 +10:00
Paul Riseborough 388e500180 EKF: remove un-used magnetometer health class variable
replaced by _sensor_health_status
2016-06-01 17:13:00 +10:00
Paul Riseborough cf489f4248 EKF: capture airspeed innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough e7690bd8f8 EKF: capture magnetometer innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough 3fb449295e EKF: capture yaw innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough 52f6eea52b EKF: capture position and velocity innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough aea827aa8a EKF: ensure filter fault status is initialised 2016-06-01 17:13:00 +10:00
Paul Riseborough 106482b078 EKF: add structure to capture innovation test failures and state resets 2016-06-01 17:13:00 +10:00
Paul Riseborough 70c40d695d EKF: Initialise alignment noise filters using valid data
Don't initialise the states for the alignment data noise filters until the buffers have been flushed
2016-05-28 09:04:26 +10:00
Paul Riseborough c905684c12 EKF: Ensure bad initial data is flushed from buffers before using data to perform alignment 2016-05-28 08:28:57 +10:00
Paul Riseborough ad02818b3d EKF: Improve height reset for external vision
reset to measurement closest in time to fusion time horizon
2016-05-27 14:00:50 +10:00
Paul Riseborough 98c0b74a71 EKF: Initialise height correctly when using external vision data
If EV height selected ensure switch to correct height mode as soon as EV data is received
The 0 height datum is not at the initialisation position, so the height state needs to be reset to the measurement on startup
2016-05-27 13:59:14 +10:00
Paul Riseborough 9f81b8f09e EKF: provide reset protection for external vision height 2016-05-27 13:15:53 +10:00
Paul Riseborough 1b6c5bbafd EKF: Enable height source to be selected independent of EV aiding 2016-05-27 13:14:52 +10:00
Paul Riseborough 00bada8f25 EKF: Clean up logic for horizontal position fusion
Remove reference to optical flow fusion mode
Simplify logic flow for selection of observation noise
Remove unnecessary conditional statement
2016-05-27 11:29:10 +10:00
Paul Riseborough 6f412a73b4 EKF: Use correct height gate when using external vision 2016-05-27 11:24:53 +10:00
Paul Riseborough e41524ac9d EKF: remove unused variables 2016-05-27 11:21:04 +10:00
Paul Riseborough 7dd123094f EKF: correct documentation 2016-05-26 21:42:56 +10:00
Paul Riseborough d5b5cb5899 EKF: improvements to observation collection
Remove unnecessary function calls
Remove un-used functions
Apply a consistent maximum safe data rate check for all observation inputs
2016-05-26 13:27:08 +10:00
Paul Riseborough e2d9e19a5d Merge pull request #148 from PX4/pr-ekf2OutputPredictor
EKF2 provide alternative output velocity prediction
2016-05-24 08:46:33 +10:00
Paul Riseborough 5a40aa2c1a EKF: prevent unwanted GPS use 2016-05-24 07:55:09 +10:00
Paul Riseborough 90d65071c1 EKF: Add output predictor processing option
Setting the velocity tracking tine constant to a negative number causes the output predictor to use a different method of correcting the velocity which provides a velocity output that is kinematically consistent with the position output.

This may improve height controller performance under some circumstances
2016-05-23 07:47:10 +10:00
Paul Riseborough 30917430e2 EKF: inline ring buffer functions used repeatedly
These functions get called 30 times each per output prediction cycle
2016-05-23 07:43:59 +10:00
Paul Riseborough c8c2d6d963 Merge pull request #145 from CarlOlsson/small_fix
Deleted second update of transformation matrix
2016-05-23 07:40:58 +10:00
Carl Olsson 0fafc49a49 fixed typos (#147) 2016-05-22 17:40:43 +02:00
Carl Olsson dbe2513d48 updated logic of calculation of body field variance (#146) 2016-05-22 17:39:25 +02:00
CarlOlsson eb70aca2e8 deleted second update of transformation matrix 2016-05-22 16:03:30 +02:00
Paul Riseborough ae5071f668 EKF: Improve heading reset
Improves reset of quaternion covariance matrix after a heading reset by preserving variance in roll and pitch and resetting yaw variance to the measurement variance.
2016-05-21 19:30:15 +10:00
waltjohnson a9ca8c294c Generalized isfinite() in similar form as done in ekf.cpp e3b9800cac/EKF/ekf.cpp (L45-L52) 2016-05-19 10:34:16 -06:00
waltjohnson 6eaa00e3f9 isfinite() is not part of the math class, rather the math.h header file. 2016-05-19 10:07:45 -06:00
waltjohnson 7c158aa59b Addressed C99 compiler issues of initializing variables in header and unused included statements. 2016-05-19 09:58:18 -06:00
Paul Riseborough e3b9800cac Merge pull request #138 from pickledgator/evTesting
EV testing
2016-05-19 12:56:41 +10:00
Paul Riseborough c1b02eaa91 EKF: Don't use 3-axis magnetometer fusion until the tilt is aligned 2016-05-18 21:06:45 +10:00
Paul Riseborough aaac867da8 EKF: Adjust tilt alignment threshold 2016-05-18 20:34:12 +10:00
Paul Riseborough e272d5f003 EKF: Use consistent position noise values during alignment 2016-05-18 20:11:08 +10:00
Paul Riseborough b9a3712ccb EKF: record yaw alignment event during initialisation to allow heading fusion to start early
This ensures bad yaw gyro biases are compensated for early, rather than waiting for the tilt alignment to fully converge before fusing heading.
2016-05-18 19:25:19 +10:00
Paul Riseborough 94a63ec9d5 EKF: don't interfere with quaternion covariances during tilt alignment 2016-05-18 19:25:19 +10:00
Paul Riseborough 22fba0fc6e EKF: don't initialise filter without EV data if we are relying on it 2016-05-18 19:25:19 +10:00
Nic 1b16f3575a added ev_pos flag check to valid_lpos, disable fake gps when ev_pos is valid 2016-05-17 21:07:04 -07:00
Paul Riseborough e4b2e9c93d EKF: Improve yaw alignment
Uses best conditioned of 321 or 312 Euler sequence to calculate initial yaw angle.
Allows alignment of yaw angle using external vision data
2016-05-18 12:16:16 +10:00
Paul Riseborough 57b2a256f7 EKF: Improve initialisation of quaternion covariances
Convert uncertainty in initial rotate vector into quaternion covariances using symbolic toolbox derived expressions.
Enable setting of initial angle uncertainty via a parameter
2016-05-17 12:47:20 +10:00
Paul Riseborough 88860d0307 EKF: Enable tuning for IMU switch on bias errors 2016-05-17 11:17:24 +10:00
Paul Riseborough 1540e937b1 EKF: Improve tilt alignment monitoring
Convert quaternion covariances into an angular alignment variance vector and discard the z component so that yaw uncertainty does not affect the result.
2016-05-17 11:17:24 +10:00
Paul Riseborough c955bfbf93 EKF: fix previous merge error 2016-05-15 20:36:51 +10:00
Paul Riseborough 920d83d68c EKF: Fix bugs preventing use of external vision yaw data 2016-05-14 21:56:41 +10:00
Paul Riseborough 13c3a95bc1 EKF: Add missing line returns 2016-05-14 21:17:30 +10:00
Paul Riseborough 59eb9eb3db EKF: fix shadow declaration arising from rebase 2016-05-14 21:17:30 +10:00
Paul Riseborough b985e58333 EKF: clean up control function
With the addition of new observation types, the control function has become too large and needed be broken up into separate functions
2016-05-14 21:17:29 +10:00
Paul Riseborough f4a0f69f6e EKF: print to console when starting EV fusion 2016-05-14 21:17:29 +10:00
Paul Riseborough 349c731375 EKF: remove PX4 dependant text output 2016-05-14 21:17:29 +10:00
Paul Riseborough ac9b7a3df6 EKF: Ensure use of EV aiding inhibits use of other height sources 2016-05-14 21:17:29 +10:00
devbharat cf1df5861a Undid hack in ecl. Handled yaw missalignment on the vision side. 2016-05-14 21:17:29 +10:00
devbharat d16f413b55 Hack to fix external vision pos offset compensation 2016-05-14 21:17:29 +10:00
devbharat d3bad9fdb0 Correct height fusion flag when using sensor other than baro 2016-05-14 21:17:29 +10:00
devbharat 6d20a426e0 Reset time_last_ext_vision 2016-05-14 21:17:29 +10:00
devbharat b681c9a5d0 Added external vision noise parameters etc and position offset 2016-05-14 21:17:29 +10:00
devbharat ff8f03b5dd Added compensation for VI sensor offset. Check sign. 2016-05-14 21:17:29 +10:00
Paul Riseborough e917d6c7f2 EKF: Add fusion of external yaw data 2016-05-14 21:17:29 +10:00
Paul Riseborough 37a09c61bc EKF: Don't use delayed data to start EV aiding 2016-05-14 21:17:29 +10:00
Paul Riseborough 25f1d1d766 EKF: Add fusion of external vision 3D pos data 2016-05-14 21:17:29 +10:00
Paul Riseborough 81469d6621 EKF: Add position, height and velocity reset for EV aiding 2016-05-14 21:17:29 +10:00
Paul Riseborough 3a0fcd03d7 EKF: Add interfaces and variables to use ext vision data 2016-05-14 21:17:29 +10:00
Paul Riseborough 172f4be594 EKF: Fix bug in calculation of terrain observation variance 2016-05-14 21:17:29 +10:00
Paul Riseborough c7e225124c EKF: Improve output observer position and velocity tracking
Replace the delayed time feedback mechanism used by the translational states with a direct feedback method.
Time constants for velocity and position convergence can be separately adjusted with tunable parameters
The method is more computationally more expensive because it requires modification of the output buffer history but is acceptable because it only requires 6 FLOP per buffer index for a total of 30*6 = 180 FLOP
The method was not applied to the attitude states because the quaternion operations required at each buffer index would have been computationally prohibitive.
2016-05-14 12:45:29 +09:30
Paul Riseborough 627d08ecc9 Revert "EKF: Fix bug in output observer"
This reverts commit 03f3df7415.
2016-05-14 12:26:46 +09:30
Paul Riseborough 03f3df7415 EKF: Fix bug in output observer
Bug was causing output observer state history to be stored at the the EKF, not IMU output rate and resulted in degraded tracking performance
2016-05-14 08:33:05 +09:30
Lorenz Meier d595596c42 Merge pull request #114 from PX4/fix_linux_build
CMakeLists: use find_package Eigen3
2016-05-12 12:55:40 +02:00
Carl Olsson 5217b73df1 added bad_airspeed reporting (#123) 2016-05-12 10:06:04 +02:00
Carl Olsson b126921894 changed airspeed innovation gate to 5 (#119) 2016-05-12 10:05:26 +02:00
Julian Oes b8ccc58887 cmake: ignore more eigen warnings 2016-05-12 08:38:37 +02:00
Julian Oes b74114a573 cmake: ignore deprecated warnings of Eigen 2016-05-12 08:27:59 +02:00
Julian Oes 07ecffc963 cmake: another try to get the module path right 2016-05-10 17:59:01 +02:00
Julian Oes 001433c660 cmake: debug output for path 2016-05-10 17:59:01 +02:00
Julian Oes d242bb78b9 cmake: try to provide path to FindEigen3 2016-05-10 17:59:01 +02:00
Julian Oes dcd191d734 cmake: include FindEIgen3.cmake for older cmake 2016-05-10 17:59:01 +02:00
Julian Oes 3d28f7ecca CMakeLists: use find_package Eigen3
Instead of hardcoding the Eigen3 path which only works on Mac, use
find_package(Eigen3).
2016-05-10 17:59:01 +02:00
Paul Riseborough 1a24ec5f50 EKF: remove unused flag from control status message 2016-05-10 10:45:06 +10:00
Paul Riseborough 481c624975 EKF: Remove use of vehicle arm status
Use single externally set in-air status for all decisions
2016-05-10 10:23:08 +10:00
Paul Riseborough 3cdf56e57c Merge pull request #122 from CarlOlsson/airspeed_fix
fixed_airspeed_healthy_bug
2016-05-09 10:24:22 +10:00
CarlOlsson ee7d7aeb8a fixed_airspeed_healthy_bug 2016-05-08 18:30:37 +02:00
Paul Riseborough 175723f690 EKF: Allow for larger accel bias offsets on startup 2016-05-08 18:03:58 +10:00
Paul Riseborough 161ac2e051 EKF: ensure position co-variances are reset
When transitioning into optical flow nav  from a non-aiding condition during ground operation, ensure position covariances are reset as they could be invalid.
2016-05-08 18:03:09 +10:00
Paul Riseborough feb4db6347 EKF: protect against large IMU errors during initial tilt alignment
Turn off innovation consistency checks for height and synthetic position measurements until the tilt as aligned
2016-05-08 17:54:45 +10:00
Paul Riseborough 00973d6215 EKF: fix pos/vel fusion innovation variance bug 2016-05-08 17:51:47 +10:00
Paul Riseborough 2144a40a3c EKF: redefine accelerometer bias state inhibit switch bit location 2016-05-08 16:03:21 +10:00
Paul Riseborough 724280fd1f EKF: move calculation of optical flow observation variance into a function
Allows it to be used when calculating initial state variance
2016-05-08 15:40:06 +10:00
Paul Riseborough 25682dce91 EKF: Prevent badly conditioned covariance calculation when starting or resetting to optical flow 2016-05-08 10:30:40 +10:00
Paul Riseborough c66ed7b662 EKF: Add interface method for filter fault status 2016-05-07 21:18:00 +10:00
Paul Riseborough 020b87933e EKF: replace fault status struct with a union to facilitate logging 2016-05-07 21:11:16 +10:00
Paul Riseborough 7f5669fb2d EKF: consolidate covariance corrections
Combines the forced symmetry, variance limiting and zeroing of covariances for unwanted states in the one function.
This ensures a consistent correction is applied after every covariance prediction or correction.
2016-05-07 20:29:50 +10:00
Paul Riseborough 0c6a367e1b EKF: fix Travis build error 2016-05-07 17:45:49 +10:00
Paul Riseborough 22f0f52bf1 EKF: fix travis build error 2016-05-07 17:06:45 +10:00
Paul Riseborough 9e53ff2f80 EKF: Improve protection against bad optical flow fusion 2016-05-07 14:23:56 +10:00
Paul Riseborough 1126048a93 EKF: Improve protection against bad airspeed fusion 2016-05-07 14:23:38 +10:00
Paul Riseborough c8d95586e7 EKF: Improve protection against bad magnetometer fusion 2016-05-07 14:23:20 +10:00
Paul Riseborough 310bd97080 EKF: Improve protection against bad pos vel fusion 2016-05-07 14:22:59 +10:00
Paul Riseborough da9d894441 EKF: Improvements to covariance reset 2016-05-07 12:57:41 +10:00
Paul Riseborough d9aeace6ac EKF: tuning update 2016-05-05 21:23:03 +10:00
Paul Riseborough f1b7e7714e EKF: Make average update rate of EKF closer to target
With the EKF, the average update rate is more important than the instantaneous value as it affects tuning. This patch ensures that the EKF prediction cycle will be performed early if the previous one was late in an attempt to maintain the target update rate.
2016-05-05 21:23:03 +10:00
Paul Riseborough 1daa6c7866 EKF: update tuning defaults 2016-05-05 21:23:03 +10:00
Paul Riseborough fc6c0c7ebf EKF: Update covariance prediction
Refresh auto generated code
Make 3-axis accel fusion the default and no accel fusion the option
2016-05-05 21:23:03 +10:00
Paul Riseborough ecaffe63af EKF: update tuning defaults 2016-05-05 21:23:03 +10:00
Paul Riseborough 7a74d58591 EKF: reduce initial accel bias uncertainty 2016-05-05 21:23:03 +10:00
Paul Riseborough a7d08d08fc EKF: Relax tilt alignment check 2016-05-05 21:23:03 +10:00
Paul Riseborough 5523a4f225 EKF: Fix IMU bias compensation scale error in output filter
Delta angle and velocities are calculated assuming data is at the filter update rate, not the IMU update rate
2016-05-05 21:23:03 +10:00
Paul Riseborough fd109b00ab EKF: replace in-line code with existing function 2016-05-05 21:23:03 +10:00
Paul Riseborough 727a43764f EKF: update initial angle alignment check 2016-05-05 21:23:03 +10:00
Paul Riseborough bc34b14779 EKF: Initialise height state variance to a value compatible with the measurement
A large height state variance and small measurement variance can destabilise the filter in the first few seconds after alignment
2016-05-05 21:23:03 +10:00
Paul Riseborough 29a361d3a3 EKF: Use intuitive units for gyro and accel bias process noise
This also makes the tuning less sensitive to changes in the EKF update rate.
2016-05-05 21:23:03 +10:00
Paul Riseborough 799865c934 EKF: update default tuning parameters 2016-05-05 21:23:03 +10:00
Paul Riseborough f01f4ae4b1 EKF: tidy up mag declination fusion 2016-05-05 21:23:03 +10:00
Paul Riseborough 0d31aad33a EKF: Fix bad limit on magnetometer noise parameter 2016-05-05 21:23:03 +10:00
Paul Riseborough 7069fb7a04 EKF: refresh auto code for mag fusion 2016-05-05 21:23:03 +10:00
Paul Riseborough ffea65e1a4 EKF: fix bug in state prediction 2016-05-05 21:23:03 +10:00
Paul Riseborough 63f093a10a EKF: Update upper limits for state variances
This limiting is a  last resort measure and the limiting for normal operation should be achieved by modification in the covariance prediction
2016-05-05 21:23:03 +10:00
Paul Riseborough 26a51c667d EKF: Improve robustness to initial gyro bias errors
Allows for ~6 deg/sec of startup bias
2016-05-05 21:23:03 +10:00
Paul Riseborough 7530e30012 EKF: Improve IMU data collection
Use IMU driver published delta angle integration time to determine when enough data has been accumulated.
Perform basic first order sculling corrections on delta velocity data
Comment steps to make make method clearer
2016-05-05 21:23:03 +10:00
Paul Riseborough f23f0b1035 EKF: fix bugs in stationary process model covariance prediction
Noise variance for stationary states was  being overwritten by the covariance prediction operations for the kinematic states
Unwanted states could end up with non-zero covariance values
The forced symmetry operation was being applied too late to be effective
2016-05-05 21:23:03 +10:00
Paul Riseborough a373ada858 EKF: explicitly define floating point type in hardcoded constants 2016-05-05 21:23:03 +10:00
Paul Riseborough f4e84a2234 EKF: fix axis label error in comments 2016-05-05 21:23:03 +10:00
Paul Riseborough 82da832816 EKF: tidy up Kalman gain calculations
Inhibiting of states is controlled via zeroing rows and columns in the covariance prediction so conditional logic in gain calculations is unnecessary.
2016-05-05 21:23:03 +10:00
Paul Riseborough 311d046a26 EKF: Enable optional activation of XY delta velocity bias estimation 2016-05-05 21:23:03 +10:00
Paul Riseborough 572c2280bd EKF: tidy up covariance prediction 2016-05-05 21:23:03 +10:00
Paul Riseborough 54e713969d EKF: Fix rebase error 2016-05-05 21:23:03 +10:00
Paul Riseborough 67d23948b5 EKF: preliminary re-tune 2016-05-05 21:23:03 +10:00
Paul Riseborough 03c35266ef EKF: remove unused parameter 2016-05-05 21:23:03 +10:00
Paul Riseborough fe9f88a8b4 EKF: test new derivation
Use direct attitude parameterisation
Discard scale factors
Add accel bias
2016-05-05 21:23:03 +10:00
Daniel Agar 22d18d638c enable Wshadow 2016-05-04 19:45:40 -04:00
Beat Küng f2dda3c183 ekf: initialize _terrain_var, fixes access to uninitialized value
in PX4 Firmware, Ekf::get_terrain_vert_pos depends on it. This is the
valgrind output:
==15439== Thread 14 ekf2:
==15439== Conditional jump or move depends on uninitialised value(s)
==15439==    at 0x5610087: sqrtf (in /usr/lib64/libm-2.22.so)
==15439==    by 0x4D1AF0: Ekf::get_terrain_vert_pos(float*) (terrain_estimator.cpp:135)
==15439==    by 0x46641F: Ekf2::task_main() (ekf2_main.cpp:655)
==15439==    by 0x42BF3D: entry_adapter(void*) (px4_posix_tasks.cpp:103)
==15439==    by 0x4E3C609: start_thread (in /usr/lib64/libpthread-2.22.so)
==15439==    by 0x5BF7A4C: clone (in /usr/lib64/libc-2.22.so)
2016-05-02 17:35:42 +02:00
Roman 0c77ebf6bd EKF: Reduce likelihood of bad covariance values after height resets
The cross terms (covariances) are now reset before the variance variance is set.

The vertical velocity state variance following a reset without GPS has been reduced.
2016-05-01 21:39:56 +10:00
Paul Riseborough 6c57bea1c3 EKF: fix bug in IMU error application timing patch 2016-04-30 15:11:12 +10:00
Paul Riseborough 15df20831a EKF: improve output complementary filter tracking
Optimise for height tracking and adjust gains automatically with changes in time delay.
2016-04-30 11:03:45 +10:00
Paul Riseborough 4fa1e9c651 EKF: Fix timing errors in state prediction
IMU corrections were being applied at the wrong time horizon to the EKF states
IMU downsampling rotates the delta velocities into the orientation produced by the last delta angle, but this wasn't consistent with the way the state prediction was using the delta velocity data.
2016-04-30 11:02:19 +10:00
Julian Oes f8a48f9cc5 ekf: now it should even compile for NuttX 2016-04-28 16:30:49 +02:00
Julian Oes 12f4d6f703 ekf: another stab at fixing isfinite for all
The previous solution did not work for Snapdragon, so I needed to copy
what is used in px4_defines.h.
2016-04-28 16:09:12 +02:00
Paul Riseborough 22ad87599c Merge pull request #112 from PX4/fix_ubuntu1604_2
ekf: compile fix for Ubuntu 16.04
2016-04-27 21:21:04 +10:00
Julian Oes 46e207106b ekf: use `std::isfinite` instead of `isnan` 2016-04-27 12:58:22 +02:00
Paul Riseborough 4fcbfb5d42 EKF: correct error in comment 2016-04-23 07:55:25 +10:00
Paul Riseborough 3e81b86280 EKF: improve height reset logic
Don't use failed sensors unless necessary and handle case where not height sensor is available for reset
2016-04-22 10:50:53 +10:00
Paul Riseborough 874558d194 EKF: improve detection of bad vert accel data
Improve ability to detect if bad vertical accel data has caused loss of height accuracy by using historical data.
2016-04-22 09:24:04 +10:00
Paul Riseborough 469a7d1711 EKF: rework height reset
calculate and save the amount that the vertical states have changed and the time of the change
apply the change delta to the output observer states and buffer
2016-04-22 08:43:56 +10:00
Paul Riseborough e3365525c2 EKF: rework height reset logic 2016-04-22 08:39:24 +10:00
Paul Riseborough 421703c267 EKF: rework initialisation of height state and offsets 2016-04-22 08:38:41 +10:00
Paul Riseborough a7417657c3 EKF: ensure fusion timeout counters are reset when required 2016-04-22 08:33:11 +10:00
Paul Riseborough 10bf05e9a6 EKF: publish the vertical position offset 2016-04-22 08:30:46 +10:00
Paul Riseborough 0de15b1b20 EKF: Add variables to monitor vertical position and height offset 2016-04-22 08:28:56 +10:00
Paul Riseborough 62c6d40f1f EKF: Add methods to ring buffer to access specific indices 2016-04-22 08:21:36 +10:00
Paul Riseborough b295f9050c EKF: ensure GPS check status is correctly initialised 2016-04-20 21:53:15 +10:00
Lorenz Meier 9487eac505 Merge pull request #98 from priseborough/pr-ekf2StatusReporting
EKF: improve reporting of filter status
2016-04-20 11:44:02 +02:00
Roman Bapst 6344fa0e8c limit maximum rates of all measurement at which they are stored into the buffers 2016-04-19 12:47:57 +02:00
Roman Bapst 00c8821006 disable airspeed fusion for now. Needs more testing and implementation of side slip fusion 2016-04-19 11:18:45 +02:00
Paul Riseborough 2fa8a11a29 EKF: replace unnecessary memcopy 2016-04-19 19:10:41 +10:00
Roman Bapst 99fc61c27c ekf2 airspeed fusion:
- finished logic for fusion
- fixed bug where previous control status was set in the wrong location
2016-04-19 09:53:31 +02:00
Paul Riseborough 82920da232 EKF: strengthen checking of local position status
provides immediate status reporting when dropping out of optical flow mode
2016-04-19 17:38:22 +10:00
Paul Riseborough 31bf342fc1 EKF: publish GPS check status 2016-04-19 17:38:22 +10:00
Paul Riseborough 6fa13c7806 EKF: publish control mode status 2016-04-19 17:37:27 +10:00
Roman Bapst 60abf07bee added function to return accelerometer bias 2016-04-18 17:52:16 +02:00
Roman Bapst f32303de69 added function to return accelerometer bias 2016-04-18 17:00:17 +02:00
Lorenz Meier 3455931617 EKF init: Fix initialization statement 2016-04-17 19:29:23 +02:00
Daniel Agar 861c13f1fe cmake STACK -> STACK_MAIN 2016-04-16 21:46:50 -04:00
Paul Riseborough ea38aa130f EKF: update default time delay parameter values 2016-04-14 08:53:59 +10:00
Paul Riseborough 8c55e36ca9 EKF: use common value for gravity 2016-04-12 11:14:31 +10:00
Paul Riseborough 163c08a3ac EKF: Improve output observer documentation 2016-04-12 11:14:31 +10:00
Paul Riseborough 2dcc6e2053 EKF: Improve accuracy of state prediction
Use an a common estimator value for gravity
Use average orientation across update interval when rotating delta velocities
2016-04-12 11:14:31 +10:00
Paul Riseborough 5bf02517a7 EKF: Rationalise use of rotation matrices and improve efficiency 2016-04-12 11:14:31 +10:00
Paul Riseborough e10093854a EKF: correct outputs for IMU offset 2016-04-12 11:14:31 +10:00
Paul Riseborough b46053415f EKF: Compensate optical flow data for sensor position offset 2016-04-12 11:14:31 +10:00
Paul Riseborough 48b105b748 EKF: correct range finder data for sensor position offset 2016-04-12 11:14:31 +10:00
Paul Riseborough e89dbb9f63 EKF: correct GPS data for antenna position offset 2016-04-12 11:14:31 +10:00
Paul Riseborough 3580940e10 EKF: Add sensor position offset parameters 2016-04-12 11:14:31 +10:00
Paul Riseborough 006b6b58e4 EKF: fix bug in status print statement 2016-04-12 10:38:50 +10:00
Paul Riseborough 74078cde94 EKF: reset state variance when performing a height reset
Set vertical position and velocity variances using known sensor error characteristics if we have reset the states to the sensor readings.
2016-04-11 19:40:27 +10:00
Paul Riseborough f4f108d57d EKF: Reset vertical velocity when performing a height reset 2016-04-11 19:25:24 +10:00
Lorenz Meier f86ef34782 EKF: Fix error message which lied 2016-04-05 19:06:35 -07:00
Paul Riseborough a352c2f4e3 EKF: Fix posix build error
Memset cannot be used on a class like this. Setting the time elements to zero achieves the desired result.
2016-04-05 18:57:21 -07:00
Lorenz Meier 6b3ad03419 Merge pull request #86 from CarlOlsson/small_airspeed_fix
Small airspeed fix
2016-04-05 16:38:37 -07:00
Paul Riseborough 430d4b1cf8 EKF: ensure data in buffers is zero at startup 2016-04-05 22:23:37 +02:00
Paul Riseborough 470098e182 EKF: update default tuning parameters
Parameters needed to be changed when covariance prediction error was corrected.
The magnetic earth and body field process noise now use separate parameters to help with tuning
2016-04-05 22:23:37 +02:00
Paul Riseborough eaf94935f0 EKF: Fix bug in initialisation of height and magnetic field
This prevents zero data being used to form the initial height and magnetic field.
Do not start sampling initial values until non-zero time values are retrieved from the buffer.
2016-04-05 22:23:37 +02:00
Paul Riseborough 03eac2f25e EKF: Apply covariance prediction derivation changes 2016-04-05 22:23:37 +02:00
CarlOlsson 8678a939e2 removed reinitialization of intermediate variables 2016-04-05 14:18:47 +02:00
Roman Bapst 2632c930f7 Merge pull request #85 from CarlOlsson/add_error_reporting_tas
added fault status reporting
2016-04-04 18:52:06 +02:00
CarlOlsson eee6f1048f Changed vtaspred threshold 2016-04-04 16:27:06 +02:00
CarlOlsson 3ad5b52aea removed comment 2016-04-04 16:26:46 +02:00
CarlOlsson 616725410d updated calculation 2016-04-04 16:26:13 +02:00
CarlOlsson ec9902d802 added fault status reporting 2016-04-04 16:21:12 +02:00
CarlOlsson 1ea26b406a change name to true_airspeed 2016-04-04 16:10:52 +02:00
Roman Bapst 27b894540e put airspeed fusion logic but don't actually call it yet 2016-03-30 17:01:03 +02:00
Roman Bapst 1b7115dec9 increased airspeed fusion rate to 12.5Hz 2016-03-30 17:01:03 +02:00