17 Commits

Author SHA1 Message Date
Daniel Agar
185f22b094
geo_lookup: copyright header consistency and minor update
Minor consistency fixes for the copyright header and update the tables to current. PX4Buildbot will periodically update the tables automatically from this point.
2020-07-20 13:01:56 -04:00
Daniel Agar
9aa7991654
geo_lookup: upgrade table size (2 bytes per element) and add testing
- updated table to 2 bytes (int16) per element and scaled the inclination/declination/strength tables to use most of the range without being too awkward
 - tables have been extended to include the full latitude range
 - expanded the API slightly to offer declination/inclination in both degrees/radians and the magnetic strength in Gauss and Tesla
 - generated some simple testing that verifies interpolation between points
2020-07-19 18:53:47 -04:00
PX4 BuildBot
e4b44f704b Update geo_lookup WMM to latest Tue Jun 23 14:15:04 UTC 2020 2020-06-23 10:41:59 -04:00
Daniel Agar
fda30d8cec geo_lookup: expand latitude to +-80 degrees 2020-06-22 09:45:22 -04:00
Daniel Agar
109eca5200 geo_lookup: create simple python script to update tables 2020-06-22 09:45:22 -04:00
Daniel Agar
41b9e4f628 geo_lookup: move tables to separate file 2020-06-22 09:45:22 -04:00
Mathieu Bresciani
c7bdf25663
[ekf] controlMagFusion refactor and mag field strength check (#662)
* ekf_control: Inhibit mag fusion when field magnitude is large
Move mag inhibition check in separate function

* ekf_control: pull out of functionalities out of controlMagFusion
- yaw abd mag bias observability checks
- mag 3D conditions
- load mag covariances
- set and clear mag control modes

* ekf_control: refactor mag heading/3D start/stop.
Move mag declination, mag 3d and mag heading fusion out of the main function

* ekf_control: extract mag yaw reset and mag declination fusion requirements

* ekf_control: use WMM in isStronMagneticField for mag fusion inhibition
- Correct units of WMM strength table

* ekf_control: extract mag_state_only functionality of AUTOFW (VTOL custom)
Also split inAirYawReset from onGroundYawReset

* ekf_control: extract mag automatic selection
- transform if-else into switch-case for parameter fusion type selection

* ekf_control: extract run3DMagAndDeclFusion, reorganize functions, fix
flag naming in Test script

* ekf_control: do not run mag fusion if tilt is not aligned.
Reset some variables on ground even if mag fusion is not running yet. It
could be that it runs later so we need to make sure that those variables
are properly set.

* ekf_control: move controlMagFusion and related functions to mag_control.cpp

* ekf control: check for validity of mag strength from WMM and falls back
to average earth mag field with larger gate if not valid

* ekf control: remove evyaw check for mag inhibition

* ekf control: change nested ternary operator into if-else if

* Ekf: create AlphaFilter template class for simple low-pass filtering
0.1/0.9 type low-pass filters are commonly used to smooth data, this
class is meant to abstract the computation of this filter

* ekf control: reset heading using mag_lpf data to avoid resetting on an outlier
fixes ecl issue #525

* ekf control: replace mag_states_only flag with mag_field_disturbed and
add parameter to enable or disable mag field strength check

* ekf control: remove AUTOFW mag fusion type as not needed This was implemented for VTOL but did not solve the problem and should not be used anymore

* ekf control: use start/stop mag functions everywhere instead of setting the flag

* ekf control: Run mag fusion depending on yaw_align instead of tilt_align
as there is no reason to fuse mag when the ekf isn't aligned

* AlphaFilter: add test for float and Vector3f
2019-11-08 16:02:59 +01:00
Daniel Agar
cd34ab802d mathlib delete floorf in favor of math.h 2019-05-28 19:42:59 +10:00
Sebastian Verling
710c52980e fixed calculation of magentic table values by using floor instead of int casting 2019-05-24 09:09:26 +02:00
Paul Riseborough
3accab1ac5 EKF: protect declination fusion from badly conditioned earth field estimates
Fusion with large initial magnetometer biases errors can result in the the NE earth field states reducing in magnitude and effectively flipping sign.

EKF: Move declination state limiting into a separate function

EKF: Limit NE mag states after each 3-axis mag fusion

EKF: Fix bug in mag field strength look-up scale factor
2019-01-31 09:53:57 -05: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
Daniel Agar
b227aca4a8 geo_lookup fix table bounds 2018-05-06 03:13:00 +02:00
Daniel Agar
d6a3110918 visual studio build compatibility 2018-05-03 22:25:36 -04:00
Daniel Agar
e5952fadaf cmake standalone build 2018-05-03 22:25:36 -04:00
Daniel Agar
bd72f3c521 geo std pressure constants and update usage 2018-04-19 08:57:38 +02:00
Daniel Agar
39b69af9bf geo_lookup: Update geomagnetism tables.
Update declination table to use latest IGRF data
Add lookups for inclination and field strength
2018-03-26 21:52:11 -04:00
Daniel Agar
cd12f049fe move geo and geo_lookup from PX4 Firmware to ECL 2018-03-26 21:52:11 -04:00