1624 Commits

Author SHA1 Message Date
Paul Riseborough
274523bd98 EKF: Use ecl::powf for integer exponents 2020-08-16 08:44:17 +10:00
Paul Riseborough
f20a5d814d EKF: Remove redundant tilt check
Also fix comment indent
2020-08-16 08:44:17 +10:00
Paul Riseborough
1592db8f34 EKF: Convert optical flow fusion to use SymPy generated equations 2020-08-16 08:44:17 +10:00
Paul Riseborough
1f386c1bb8 EKF: Add yaw estimate SymPy generated code files 2020-08-16 08:43:29 +10:00
Paul Riseborough
510d93858f EKF: move yaw estimator derivation into main filter derivation
Enables use of common components
2020-08-16 08:43:29 +10:00
Paul Riseborough
f89c52e840 EKF: use ecl::powf for integer exponents 2020-08-15 08:40:59 +10:00
Paul Riseborough
0aa2f17562
EKF: Convert GPS yaw observation method to use SymPy generated code (#880)
* EKF: add test comparison program for GPS yaw fusion equations

* EKF: convert GPS yaw fusion method to use SymPy generated equations

* Replace if/else with simple if

* EKF: fix formatting of GPS yaw fusion auto-code comparison test

* EKF: Use  SparseVector type for GPS yaw fusion Jacobians

* EKF: Fix bug in GPS yaw derivation comparison check

* Add gps_yaw auto generated code file

Co-authored-by: kamilritz <kritz@ethz.ch>
2020-08-13 13:23:57 +10:00
Paul Riseborough
21cc46edd7
EKF: Convert magnetic field observation methods to use SymPy generated code (#879)
* EKF: Add comparison test for mag field fusion generated code

* EKF: convert mag field fusion to use SymPy generated code

* EKF: Add test comparison program for yaw fusion equations

* Stop setting 0 to 0

* Reduce if/else statement to only if

* EKF: more accurate implementation for sequential fusion of magnetometer data

* test: update change indicator

* Use matrix::SparseVector<float, 24, ...> for observation jacobian

* Adapt the auto code generation to allow for different bracket styles

* Add auto generated code for mag fusion

* Add generic computation of KHP

* Apply generic computation of KHP to mag fusion

* tests: update change indicator

* tests: update change indicator

Co-authored-by: kamilritz <kritz@ethz.ch>
2020-08-11 18:57:22 +10:00
kamilritz
ec93490890 geo test change to arc length 2020-08-10 22:15:43 +02:00
kamilritz
98dec6afa6 add tests for waypoint_from_line_and_distance() 2020-08-10 22:15:43 +02:00
kamilritz
60388a8b6d Geo: Fix double correcting for negative distance 2020-08-10 22:15:43 +02:00
Paul Riseborough
6feb28c27d
EKF: Convert EKF-GSF yaw estimator from matlab to sympy derived equations (#871)
* EKF: Add sympy derivation of equations for EKF-GSF yaw estimator

* EKF: Convert EKF-GSF yaw estimator to use sympy generated equations

* EKF: Add status prints for GSF-EKF yaw estimator cvode gen

* EKF: Move generated code for GSF-EKF yaw estinmator to generated directory

* Make it run with python3

* Cleanup yaw estimator code generation

* Improve and simplify gsf measurement update code generation

* Use improved auto generated measurement update code

& remove obsolete updateInnovCovMatInv function

* Delete generated ekf_derivation for the moment

Co-authored-by: kamilritz <kritz@ethz.ch>
2020-08-10 09:27:31 +02:00
kamilritz
9d7d502c56 std::sin -> sin 2020-08-09 15:28:35 -04:00
kamilritz
4ab364f0fd Make conversion from float to double explicite 2020-08-09 15:28:35 -04:00
Julian Kent
9ea3468091 Negative distances go in the opposite direction 2020-08-09 11:36:36 -04:00
kamilritz
b7e49f20e4 Update change indication 2020-08-09 11:08:59 -04:00
kamilritz
497008811a Update matrix version 2020-08-09 11:08:59 -04:00
kamilritz
d7568d55b4 extend firmware build checks 2020-08-07 11:42:13 +02:00
kamilritz
310b989c9a refactor start of gps into separate function 2020-08-07 10:02:47 +02:00
kamilritz
7eb2b08eed Yaw measurement jacobian to Vector4f 2020-08-04 09:57:00 +02:00
kamilritz
15d360f446 saved_mag_ef_cov to Squarematrix2f 2020-08-04 09:57:00 +02:00
kamilritz
7609bc69b2 drag innov member variables to Vector2f 2020-08-04 09:57:00 +02:00
kamilritz
960b80ee71 Do not update output filter a second time after reset to flow. 2020-08-03 09:51:59 +02:00
Paul Riseborough
77b11129fa
EKF: replacement of covariance prediction autocode with sympy generated output (#870)
* added python script with ekf derivation (WIP)

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* worked on c code auto-generation

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* save before variable name change

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* changed symbol names

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* added codegeneration class

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* improve 3D mag fusion derivation

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* EKF: Extend ekf sympy derivation to include all observation types

* EKF: Add custom ecl::powf function for integer powers

* EKF: Convert ekf covariance prediction to use sympy output

* EKF: Add test program to compare sympy and matlab covariance prediction

Also tests ecl::powf(x,exp) function

* EKF: simplify ecl::powf function

* Generate code to subfolder generated/

* Add printouts for showing code generation progress

* Move generated covariance code to generated folder

* Upgrade code generation to python3

* main.py: Remove unused create_symbols function

& making code more compact

* main.py: move main part into function

* Code generation: fix passing wrong rotation matrix to yaw_observation ()

* EKF: Amend generated code filename for consistency

* Move ecl::powf function test to unit tests

* EKF: Use updated ecl:powf functionality in test program

* Move ecl::powf to utils.hpp

* Update ecl::powf test

* Update output change indication

* test: update expected output for change indicator

* test: update expected output for change indicator again

Co-authored-by: RomanBapst <bapstroman@gmail.com>
Co-authored-by: kamilritz <kritz@ethz.ch>
2020-07-30 12:44:08 +10:00
Matthias Grob
0bffd951ec AlphaFilter: include float.h for FLT_EPSILON 2020-07-28 15:41:58 -04:00
kritz
88c52aba5e
Refactor ev fusion start into helper functions (#872) 2020-07-27 11:42:52 +02:00
kamilritz
8c65ca29e4 Only run firmware build test on pull_request 2020-07-26 10:11:52 -04:00
kamilritz
049f59d7de Fix firmware-build-test 2020-07-26 10:11:52 -04:00
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
kamilritz
3651ed37fb Do not update time_last_imu outside of setGpsData 2020-07-17 11:06:36 +02:00
kamilritz
89bfcc2167 Introduce checkAndFixCovarianceUpdate(KHP) function 2020-07-16 18:25:06 +02:00
kamilritz
5c4a3d4576 Make observation jacobian a Vector24f when possible 2020-07-16 18:25:06 +02:00
kamilritz
b5e1397c0f Add const modifier
const modifier


Add missing const modifier
2020-07-16 18:25:06 +02:00
kamilritz
e357376797 Bring declaration and initialization together 2020-07-16 18:25:06 +02:00
kamilritz
796afd5f98 Rename yaw_use_inhibit -> is_yaw_fusion_inhibited
Temp
2020-07-16 18:25:06 +02:00
kamilritz
4cb2d1c645 Remove duplicated code snippets
by combining x and y ballistic coeff inverse a vector
2020-07-16 18:25:06 +02:00
kamilritz
b0ad9f0226 Replace componentwise with matrix operation 2020-07-16 18:25:06 +02:00
kamilritz
b5765eb3b4 Move variable declaration to better place &
remove airspeed_innov_var_temp variable. setting to global variable even when fusion is aborted is okay
2020-07-16 18:25:06 +02:00
kamilritz
05855b7fc1 Update time of last fusion event really only if fused
Except for the velpos fusion
2020-07-16 18:25:06 +02:00
kamilritz
efd96db49d Avoid setting 0 to 0 2020-07-16 18:25:06 +02:00
kamilritz
5ef18f8823 Style improvement 2020-07-16 18:25:06 +02:00
kamilritz
01515b9a9c Replace min(max()) with constrain 2020-07-16 18:25:06 +02:00
kamilritz
b0458fbded Refactor output buffer updates into separate functions 2020-07-16 18:25:06 +02:00
kamilritz
3d82d822ae Add const modifier 2020-07-16 18:25:06 +02:00
kamilritz
93011ed52c Use ternary operator 2020-07-16 18:25:06 +02:00
kamilritz
46a5e6e428 Replace divisions with multiplications 2020-07-02 15:55:24 +02:00
kamilritz
3e3a66e9e9 Remove unnecessary operations 2020-07-02 15:55:24 +02:00
kamilritz
079a699556 Random cleanup 2020-07-02 15:55:24 +02:00
kamilritz
d18ddb3e92 Use ternary operator 2020-07-02 15:55:24 +02:00