111 Commits

Author SHA1 Message Date
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
kamilritz
16a00eae0b Make Kfusion a Vector24f 2020-07-02 09:02:24 +02:00
bresch
2bafe9df08 GPS Yaw: wait to fuse at yaw at least once before declaring it faulty
This fixes the cases where the yaw message from the GNSS receiver would
take more time than the vel/pos. The estimator should wait and not
immediately fall back to an other aiding source after 5sec.
If it never comes, it will never fall back, but this is ok since the
user wants to fly with GPS aiding an not with something else.
2020-06-23 08:43:48 +02:00
bresch
51cd63d626 GPS Yaw: fall back to other yaw aiding source in case of bad data
If the user selects GPS yaw fusion but that there is no GPS yaw data in
the GPS message or if the fusion is rejected for some time, the GPS yaw
data is declared faulty and the fusion is stopped to allow an other
source of yaw aiding to start.
2020-06-23 08:43:48 +02:00
bresch
3c6790f5d5 GPS Yaw: Always reset Yaw when GPS Yaw fusion is starting
Also avoid fusing fake mag data when an other source of yaw aiding
is active, even if in MAG_TYPE_NONE mode.
2020-06-23 08:43:48 +02:00
Matthias Grob
a296fe7d8c Move AlphaFilter out of EKF 2020-06-15 13:07:51 -04:00
bresch
821e1fa8fc terrain_estimator: add unit tests 2020-06-05 20:44:30 +02:00
bresch
5d6a72e383 sensor_simulator: add possibility to set GPS position rate
one can set the position rate = velocity to obtain consistent gps data
2020-06-05 20:44:30 +02:00
bresch
62e15cbacf sensor_simulator: set IMU rate to 200Hz as this is the new value
used in the Firmware
2020-06-03 17:09:20 +02:00
bresch
6126c190b2 sensor_simulator: update EKF at IMU rate
This is how it is also done in ekf2_main. Otherwise, this leads to
multiple integration of the same IMU data due to asynchronous sensor
updates triggering a prediction step between IMU updates.

Fix unit tests that broke because of this fix
2020-06-03 17:09:20 +02:00
Mathieu Bresciani
b024cdd282
unit test: check that the accel bias is only learned when observable (#827) 2020-05-25 11:10:01 +02:00