121 Commits

Author SHA1 Message Date
bresch
611ace0ed6 EV_yaw: reset ev_to_ekf to identity when yaw is reset to EV
Otherwise, the old rotation matrix is used and not updated anymore
because the EKF is fusing EV yaw data.
2021-06-22 10:25:55 +02:00
bresch
0ef5d7d4c8 test_replay: remove setting read-only parameter 2021-06-16 15:38:17 +02:00
bresch
85f5a935fe [AUTO COMMIT] update change indication 2021-05-12 08:33:07 +10:00
bresch
f7c687e433 GNSS yaw unit test: test fallback to non yaw aiding mode 2021-05-12 08:33:07 +10:00
bresch
a685987082 GNSS yaw: unset yaw_align if fusion stops before takeoff
We do not want to rely on a potentially badly initialized heading as it
could lead to a flyaway directly after takeoff

Also remove the resetMagHeading() call from the GPS fusion control logic
as this is properly handled in mag_control.
2021-05-12 08:33:07 +10:00
bresch
7ee69706e8 GNSS yaw: add test case when measurement jumps 2021-05-12 08:33:07 +10:00
bresch
7a11871566 GNSS yaw tests: adjust timing
the starting condition needs more than 1 sample to determine if the data
comes regularly

the timeout on "no data" is defined by the fusion reset timeout
parameter (7 seconds)
2021-05-12 08:33:07 +10:00
Eike
5d34d7a24e
Height source vision: Fallback to rangefinder if available (#994) 2021-03-31 14:24:38 +02:00
PX4BuildBot
da06f25216 [AUTO COMMIT] update change indication 2021-03-28 21:22:25 -04:00
PX4 BuildBot
85fcf9393d Update geo_lookup WMM to latest Sun Mar 28 11:48:06 UTC 2021 2021-03-28 21:22:25 -04:00
bresch
cb8367026c [AUTO COMMIT] update change indication 2021-03-04 19:43:01 +11:00
bresch
93dd4e5754 fix unit tests 2021-03-04 19:43:01 +11:00
mcsauder
164e53bad3 Add unit tests and update ekf_helper setEkfGlobalOrigin() method to allow for condition when current position is unitialized. 2021-02-19 08:59:47 -05:00
Daniel Agar
63f64b57c1 EKF: set global origin method
EKF: add convergence after global origin reset test
2021-02-19 08:59:47 -05:00
bresch
81937370ac [AUTO COMMIT] update change indication 2021-02-18 10:11:51 +01:00
isidroas
0c5291d194
Heading reset to magnetometer from GPS or EV (#969) 2021-02-16 14:37:34 +01:00
Mathieu Bresciani
d4258cc66d
yaw emergency: check angle between vel observation and estimate (#975)
use thresholds based on state and obs variance

* [AUTO COMMIT] update change indication
2021-02-15 10:31:16 +01:00
PX4BuildBot
9521e81b09 [AUTO COMMIT] update change indication 2021-02-08 09:43:53 -05:00
PX4 BuildBot
ae0c054d75 Update geo_lookup WMM to latest Mon Feb 8 11:48:14 UTC 2021 2021-02-08 09:43:53 -05:00
priseborough
c25c97f8b5 [AUTO COMMIT] update change indication 2021-01-09 11:03:31 -05:00
Paul Riseborough
96418101e1 test: Allow for larger vel variance growth due to dvel bias variance 2021-01-09 11:03:31 -05:00
Paul Riseborough
1b1c049e81 test: Update unit test to match expected behaviour 2021-01-09 11:03:31 -05:00
bresch
c212975abe rng height: reset to baro using common logic
The failsafe from rng height to baro height should occur after a reset
to baro triggered by the controlHeightSensorTimeouts function and not in
the fusion selector.

Until now, the EKF was fusing baro measurements between rng updates if
the range finder ODR was slower than the EKF update rate. This is not
the case anymore as the height reset occurs after 5 seconds.

The unit test has been extended to show this behavior.
2021-01-07 10:07:57 +01:00
bresch
211c84c85b Rng finder unit test: cover "un-stuck" logic 2021-01-05 20:04:17 +11:00
Mathieu Bresciani
18f334f4db
flow: add unit test for yaw motion (#950) 2020-12-25 09:47:14 +01:00
Daniel Agar
398fe159ce EKF: allow initialising without mag depending on configuration
- reduce initial number of required mag and baro samples before init
2020-12-17 19:55:51 +11:00
Mathieu Bresciani
5ccb8b457d
fakePosFusion: reset _last_known_posNE to current state when starting (#943)
* [AUTO COMMIT] update change indication
2020-12-15 10:09:01 +01:00
Daniel Agar
1541e4b414
EKF: update control status and fault status getters
- the fault status union exceeded 16 bits, but the getter was get_filter_fault_status(uint16_t *val)
2020-12-10 09:13:12 -05:00
Mathieu Bresciani
8f3df7a97b
flow: restructure optical flow control logic (#928)
- extract motion checks performed on ground
- move all non-timing check to controlOpticalFlowFusion. This simplifies and standardirzes the setOpticalFlowData function. Furthermore, in some cases (SITL, PX4Flow), the dt is forced to 0 when the quality is 0 (which is usual on ground) so the ekf needs to ignore those values on ground to initialize properly the flow fusion.
- add filter convergence test
- move check for dt time max in setOpticalFlowData
- in the simulator, do not update dt as this is the sensor integration
period.
2020-12-09 11:33:00 +01:00
Daniel Agar
03cfcb903e
EKF: RingBuffer minor improvements
- allocate IMU and output buffers on construction according to defaults
 - determine buffer max time delay based on configuration parameters
 - reorder flowSample and extVisionSample to minimize padding
 - adjust parameter defaults to match PX4-Autopilot
2020-12-03 20:48:51 -05:00
PX4 BuildBot
67f13f7ede Update geo_lookup WMM to latest Wed Dec 2 11:48:25 UTC 2020 2020-12-02 19:47:46 -05:00
bresch
e80a683981 CI: update change indicator of yaw emergency estimator
This was incorrectly uptated in 1a7c68ea72db82de1d8729f900a5543a253a3ac4
2020-10-26 11:07:13 +01:00
Paul Riseborough
1a7c68ea72 EKF: update change indicator 2020-10-06 20:50:52 +11:00
Daniel Agar
4c2355a638 EKF: use GPS to lookup declination from WMM before full GPS checks pass 2020-09-28 08:43:32 +02:00
kamilritz
419b70e4b5 Add tests for shouldUse321RotationSequence 2020-08-27 09:51:56 +10:00
Kamil Ritz
fdc86c247a add functions to compute yaw (321 and 312 sequence)
from quaternion and rotation matrix
2020-08-27 09:51:56 +10:00
Daniel Agar
f62662ee46 update change_indication for newer WMM tables 2020-08-21 16:54:45 -04:00
PX4 BuildBot
802a6d99a0 Update geo_lookup WMM to latest Fri Aug 21 11:48:14 UTC 2020 2020-08-21 16:54:45 -04:00
kamilritz
bd0c5fbb97 Update change indication for ekf gsf 2020-08-20 22:16:28 +02:00
kamilritz
3ae934544f Add change indication for ekf_gsf_reset 2020-08-18 17:13:46 +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
9d7d502c56 std::sin -> sin 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
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
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
bresch
7f4fedde6a GPS Yaw: fix heading initialisation and add unit tests
When the antennas are not parallel to the x body axis, the GPS message
contains the angular offset but the data is already corrected in the
driver. EKF2 should then not add this offset during the initialisation.
2020-07-02 13:35:13 +02:00