Commit Graph

303 Commits

Author SHA1 Message Date
Daniel Agar da7d41e78a EKF: add mag bias reset helper and update IMU bias reset to match (#924) 2020-12-08 12:16:59 -05: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
Daniel Agar a21092804a EKF: remove virtual getters from estimator_interface 2020-11-02 09:35:47 -05:00
Daniel Agar 48a8992caf EKF: move small simple getters to header
- return by const reference where possible
2020-10-30 09:48:45 -04:00
Daniel Agar 5ea8824439 EKF: inline simple getters 2020-10-27 08:53:58 -04:00
Daniel Agar 6e99ebd928 EKF: add fault status bit for bad vertical accel data 2020-10-26 17:37:15 +01:00
Mathieu Bresciani dd3ffc4192 Optical flow: compute velociy from corrected flow data for logging (#920)
This is really useful when debugging optical flow data
2020-10-26 13:27:52 +01: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 9797e4d28f updateYawInRotMat with hidden rotation sequence handling 2020-08-27 09:51:56 +10:00
kamilritz 4fb4e0ca01 Clean euler321 and euler312 code and comment 2020-08-27 09:51:56 +10:00
Kamil Ritz 2be738e806 Add helper function to alter heading in rotation matrices 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
Kamil Ritz 15afa8ae17 shouldUse321RotationSequence(const Dcmf& R) 2020-08-27 09:51:56 +10:00
Kamil Ritz 4872f2a545 Remove not used code 2020-08-24 19:24:27 +10:00
Paul Riseborough 1e6c6f2d3c EKF: update all output states when aligning output time horizon filter 2020-08-16 10:00:47 +10:00
kamilritz 3bd9415498 Make delayed output stayed not a member variable 2020-08-16 10:00:47 +10:00
kamilritz 310b989c9a refactor start of gps into separate function 2020-08-07 10:02:47 +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
kritz 88c52aba5e Refactor ev fusion start into helper functions (#872) 2020-07-27 11:42:52 +02:00
kamilritz b5e1397c0f Add const modifier
const modifier


Add missing const modifier
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 3d82d822ae Add const modifier 2020-07-16 18:25:06 +02:00
kamilritz 2af2696b63 Revert if-else condition to get rid of unnecessary indentation 2020-07-02 15:55:24 +02:00
kamilritz fce4958d4f Random cleanup 2020-07-02 15:55:24 +02:00
kritz 9eea44f4ab Return type of resets (#859)
* Reset position/velocity return type is void

* Delete not needed comments
2020-07-02 14:53:59 +02:00
kamilritz 97225fcb74 Use matrix lib inside getState 2020-07-02 09:02:24 +02:00
kamilritz 16a00eae0b Make Kfusion a Vector24f 2020-07-02 09:02:24 +02:00
kamilritz 5356077a32 Make flow_innov/-var a matrix Vector2f 2020-06-26 08:26:26 +02:00
kamilritz 630be60930 Increase matrix library usage 2020-06-26 08:26:26 +02:00
kamilritz 22274b1d30 Add const modifier 2020-06-26 08:26:26 +02:00
kamilritz b8f937666a Make mag_innov/-var a Matrix::Vector3f 2020-06-26 08:26:26 +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
kamilritz ff8b5ec69d Extract general functions into utils 2020-06-23 08:18:34 +02:00
RomanBapst b7d54b5477 gps: fixed filter initialization bug around gps
- do not gps reference altitude to zero in case gps checks pass before the
filter initialized
- reset the filtered gps position and position derivative filters in case
we are in air or there is movement on the ground

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2020-06-08 16:19:38 +02:00
Paul Riseborough 59183f70ba EKF: Reduce EKF-GSF vulnerability to large yaw gyro bias errors (#831)
* EKF: Reduce EKF-GSF vulnerability to large yaw gyro bias errors

* Update EKF/ekf_helper.cpp

* EKF: Fix comment typo

Co-authored-by: Roman Bapst <bapstroman@gmail.com>

Co-authored-by: Mathieu Bresciani <brescianimathieu@gmail.com>
Co-authored-by: Roman Bapst <bapstroman@gmail.com>
2020-06-02 17:42:54 +10:00
kritz bf78044bcd EKF: fix initialization of local position validity 2 (#820)
The `_deadreckon_time_exceeded` flag is used in
`local_position_is_valid()`. This means that
`_params.valid_timeout_max` after startup, in my observed case 5
seconds, the local position switche from valid to invalid and then after
a while back to valid again.

With this fix, the local position is flagged invalid from boot and gets validated after the first aiding event.

Co-authored-by: Julian Oes <julian@oes.ch>
2020-05-20 08:24:23 +02:00
kritz 716caa5168 Refactor position resets (#822) 2020-05-19 21:53:46 +02:00
kritz 98801ad17b Support vision velocity expressed in body frame too (#708)
* Support vision velocity expressed in body frame

* Use switch statement for vision velocity frame

* Robustify vision velocity frame test

* Increase lower bound on vision velocity noise to 0.05 m/s
2020-05-12 16:03:35 +02:00
Kamil Ritz b40adf3dec Refactor velocity resets 2020-05-12 08:05:32 +02:00
bresch 97b437233e ekf: remove unused function 2020-05-08 16:55:23 +02:00
bresch 75c49b2082 ekf_helper: fuse double if 2020-05-08 16:55:23 +02:00
Kamil Ritz 050298f6c1 Improve matrix library usage 2020-04-25 10:11:01 +02:00
Kamil Ritz 5749273d19 refactor resetPosition 2020-04-25 10:11:01 +02:00
bresch 30d69aa45b Ekf: extract baro height offset computation 2020-04-19 12:38:13 +02:00
bresch 6b64cf0770 Ekf: centralize GPS height fusion startup 2020-04-19 12:38:13 +02:00
bresch 61763544b6 Ekf: centralize baro fusion startup 2020-04-19 12:38:13 +02:00
kritz fa5a00d871 Refactor velocity reset (#788)
* Refactor velocity reset

* Add unit tests for velocity resets

* Expand updates to vertical buffer to velocity resets outside of resetHeight

* Improve matrix library usage

* Improve naming of vertical output samples

* Fix update of output_vert_new during reset

* Improve naming of vertical output samples 2
2020-04-08 16:39:15 +02:00
bresch 572ad2df0a SensorRangeFinder: add distBottom function to get the vertical distance 2020-04-03 11:01:23 +02:00
Mathieu Bresciani 0623b2b02d Range check cleanup (#782)
* EKF: centralize range finder tilt check

* Ekf-control: do not double check for terrain estimate validity

isRangeAidSuitable can only return true if the terrain estimate is valid
so there is no need for an additional check

* range_finder_checks: restructure the checks to avoid early returns

There is now only one clear path that can lead to the validity being
true.
Furthermore, if the _rng_hgt_valid is true, we can trust it and we don't
need for additional checks such as tilt.

The case where we need to provide fake measurements because the drone is
on the ground and the range finder data is bad is already handled
in "controlHeightFusion" so there is no need to hack the range finder
checks with that.

* Add Sensor and SensorRangeFinder classes

The purpose is to encapsulate the checks for each sensor in a dedicated
class with the same interface

* SensorRangeFinder: encapsulate in estimator::sensor namespace

* EKF: rename _sensor_rng to _range_sensor

* Range checks: include limits in valid range

* RangeChecks: update comment in the continuity checks

* RangeChecks: move more low-level checks in functions

Also move setTilt out of the terrain estimator, this is anyway protected internally
to not compute cos/sin if the parameter did not change.

* Sensor: remove unused virtual functions

Those are not required yet but can still be added later

* SensorRangeFinder: re-organise member variables

Also rename getRangeToEarth to getCosTilt

* SensorRangeFinder: split setSensorTilt and setCosMaxTilt functions

* SensorRangeFinder: Add a few unit tests

- good data
- tilt exceeded
- max range exceeded

* SensorRangeFinder: set hysteresis in us instead of ms

* SensorRangeFinder: Add more tests

* SensorRangeFinder: update continuity, hysteresis and stuck tests

* SensorRangeFinder: rename variables

* SensorRangeFinder: get rid of "delayed" specification

From the SensorRangeFinder class point of view, it's not relevant to
know if the data is delayed or not

* SensorRangeFinder: move time_last_valid out of stuck check

* SensorRangeFinder: rename file names to sensor_range_finder

* SensorRangeFinder: address Kamil's comments

* SensorRangeFinder: Add more tilt tests

* SensorRangeFinder: store current tilt offset

This is to avoid recomputing cos/sin functions at each loop
2020-04-03 08:28:07 +02:00