- 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>
* 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
* EKF: Use common rate vector calculation for offset corrections
* EKF: Remove duplicate matrix entry calculations
* EKF: Create a EKF-GSF yaw estimator class
* EKF: add emergency yaw reset functionality
* EKF: remove un-used function
* EKF: Ensure required constants are defined for all builds
* EKF: Fix CI build error
* Revert "EKF: remove un-used function"
This reverts commit 93005309c7f3794414ad99c86218b3062e00bbd3.
* EKF: Replace in-lined Tait-Bryan 312 conversions with function call
Also remove unnecessary operations
* EKF: Remove unnecessary update of external vision rotation matrix
* EKF: Use const
* EKF: use const
* EKF: don't use class variable as a temporary variable
* EKF: update comments
* EKF: Improve efficiency of yaw reset
Use conversion from rotation matrix to Euler angles instead of quaternion to euler angles.
* EKF: use const
* EKF: remove un-used struct element
* EKF: more descriptive function name
* EKF: use existing matrix row operator
* EKF: remove unnecessary rotation matrix update
* EKF: Use square matrix type
* EKF: Improve protection for bad innovation covariance
* EKF: Use matrix library operations
* EKF: Replace memcpy with better alternative
memcpy bypasses compiler sanity checks and is unnecessary in this instance.
* EKF: Split EKF-GSF yaw reset function
Adds a common function to support yaw reset that can be used elsewhere.
* EKF: Use common function for quaternion state and covariance yaw reset
* EKF: Replace inlined matrix operation
* EKF: Use const
* EKF: Change accessor function name
* EKF: Use const
* EKF: Don't create unnecessary duplicate variable locations
* EKF: Remove duplicate covariance innovation inverse
* EKF: Don't create unnecessary duplicate variable locations
* EKF: Rely on geo library to provide gravity
* EKF: Improve protection from bad updates
* EKF: Reduce effect of vibration on yaw estimator AHRS
* EKF: Improve yaw estimator AHRS accuracy during manoeuvre transients