762 Commits

Author SHA1 Message Date
Daniel Agar
dfdfbbfa9c
msg/vehicle_odometry.msg: simplify covariance handling and update all usage (#19966)
- replace float32[21] URT covariances with smaller dedicated position/velocity/orientation variances (the crossterms are unused, awkward, and relatively costly)
 - these are easier to casually inspect and more representative of what's actually being used currently and reduces the size of vehicle_odometry_s quite a bit
 - ekf2: add new helper to get roll/pitch/yaw covariances
 - mavlink: receiver ODOMETRY handle more frame types for both pose (MAV_FRAME_LOCAL_NED, MAV_FRAME_LOCAL_ENU, MAV_FRAME_LOCAL_FRD, MAV_FRAME_LOCAL_FLU) and velocity (MAV_FRAME_LOCAL_NED, MAV_FRAME_LOCAL_ENU, MAV_FRAME_LOCAL_FRD, MAV_FRAME_LOCAL_FLU, MAV_FRAME_BODY_FRD)
 - mavlink: delete unused ATT_POS_MOCAP stream (this is just a passthrough)

Co-authored-by: Mathieu Bresciani <brescianimathieu@gmail.com>
2022-08-04 12:55:21 -04:00
bresch
61f390b0dd ekf2_test: fix height offset compensation after origin reset 2022-08-04 16:50:31 +02:00
bresch
e34de53e2e ekf2_test: let the GPS start before setting the new origin
fix test by reducing the distance to the new origin: the maximum size of
the local position origin is a cube of 1e6m. If the origin is moved
further than this, the state is clipped to that maximum value
2022-08-04 16:50:31 +02:00
Hamish Willee
a715b5468e
mc_wind_estimator - improve readability (#19545) 2022-08-02 09:26:06 +02:00
Hamish Willee
30e2490d5b
Docs are now in user guide and main (#19977)
* Fix links to docs in source to point to docs on main not master

* More docs and scripts that need to point to main
2022-08-01 11:39:39 +10:00
Daniel Agar
41d9c3dd2a ekf2: add AUX velocity aid src status
- also includes velocity and position helpers for using estimator aid
   source status messages that will later be used for GPS, EV, etc
2022-07-29 12:02:31 -04:00
Daniel Agar
a397c09e59 ekf2: use estimator_aid_src for all yaw sources (mag, gnss, ev) 2022-07-29 11:20:48 -04:00
Hamish Willee
e6eed43648
Spelling errors (#19935) 2022-07-27 14:33:16 +10:00
Daniel Agar
70e95812e7 ekf2: reset mag_lpf (by zeroing _mag_counter) when resetting mag bias (or changing mags)
- so that there's new filtered data avaiable for reset
2022-07-21 09:24:28 -04:00
Daniel Agar
ecdade3638 ekf2: mag in air reset fall back to regular resetMagHeading() if realignYawGPS() fails 2022-07-21 09:24:28 -04:00
Daniel Agar
05133aed27 ekf2: clear test ratios, flags, etc when stopping mag fusion 2022-07-21 09:24:28 -04:00
Daniel Agar
65a587e56a ekf2: mag fusion don't update all states if mag_fault or mag_field_disturbed 2022-07-21 09:24:28 -04:00
Daniel Agar
a41a0e7e80 ekf2: resetMagHeading() split out simple init case 2022-07-21 09:24:28 -04:00
Daniel Agar
9efadad06a ekf2: move checkMagFieldStrength() to magFieldStrengthDisturbed() const method 2022-07-21 09:24:28 -04:00
Daniel Agar
a7f573e150 ekf2: delete isStrongMagneticDisturbance() 2022-07-21 09:24:28 -04:00
Daniel Agar
e6e27e694e ekf2: delete isYawResetAuthorized() 2022-07-21 09:24:28 -04:00
Daniel Agar
0f1f6daa1a ekf2: delete isMagBiasObservable() 2022-07-21 09:24:28 -04:00
Daniel Agar
d160229f47 ekf2: delete isYawAngleObservable() 2022-07-21 09:24:28 -04:00
Daniel Agar
b0c979f745 ekf2: add copyright header to EKFGSF_yaw and utils 2022-07-21 09:24:28 -04:00
Daniel Agar
4fee059696 ekf2: simplify mag yaw reset request when transitioning to mag enabled 2022-07-21 09:24:28 -04:00
Daniel Agar
f254b55523 ekf2: add mag fusion timestamps 2022-07-21 09:24:28 -04:00
Daniel Agar
e5be0e776e ekf2: if multi-mag disabled (EKF2_MULTI_MAG <= 1) properly re-enable sensors hub selection (SENS_MAG_MODE)
- this prevents potential misconfiguration if trying to disable ekf2 multi mag
2022-07-20 01:16:55 -04:00
Beat Küng
ea136e73be ekf2: remove unused variables 2022-07-20 01:14:04 -04:00
bresch
f962399ba1 ekf2: rename BaroBiasEstimator -> BiasEstimator 2022-07-19 20:46:53 -04:00
Daniel Agar
39453405a0 ekf2: cleanup zero innovation heading fusion
- refactor updateQuaternion() to compute the yaw jacobian directly (respecting  the rotation sequence determination)
 - fuseHeading()/fuseYaw321()/fuseYaw312() helpers are eliminated and now mag heading fusion and EV yaw fusion compute the innovation in place
 - clear up logic for performing zero innovation heading fusion when quaternion variance exceeds threshold (no more _is_yaw_fusion_inhibited flag manipulation)
 - when at rest continue fusing last static heading with very low variance even if other heading sources are active
2022-07-19 11:58:27 -04:00
Daniel Agar
1a513153be ekf2: update range sample fix ekf2_timestamps
- this is necessary to use distance_sensor data in replay
2022-07-18 14:39:12 -04:00
bresch
8cc6d02af3 ekf2: add missing mag fuse type in enum 2022-07-15 15:57:17 +02:00
Daniel Agar
ac209c2e78 ekf2: vehicle_local_position add dead_reckoning flag 2022-07-13 09:01:33 +02:00
bresch
de74f45e2d ekf2: do not run rng kinematic consistency check for fixed-wings
As they are always moving horizontally, the check doesn't make sense
for fixed-wings.
Also don't run the check while on ground to prevent getting a failed
check during pre-takeoff manipulation.
2022-07-12 13:45:59 -04:00
Daniel Agar
a73efd9c4f NuttX carry minimal c++ cmath (replacing Matrix stdlib_imports.hpp) 2022-07-12 08:05:06 -04:00
bresch
2f486c37fc ekf2: start airspeed fusion when test ratio is passing only
When wind is already estimated, we don't reset the states using airspeed
data, so it could be that the fusion fails if the airspeed isn't
consistent with the filter (test ratio > 1). In this case, don't start
the fusion.

When wind isn't already estimated, the wind states are reset using
airspeed so the fusion can start regardless of the current test ratio.
2022-07-07 17:39:06 -04:00
Daniel Agar
15223009d2 combine sensor_gps + vehicle_gps_position msgs (keeping separate topics) 2022-07-07 10:24:11 -04:00
bresch
af4038aa7e ekf2: publish estimator_aid_src_airspeed 2022-07-07 09:42:54 -04:00
bresch
2fd87c47e8 ekf2: use estimator_aid_source_1d message for airspeed fusion
split the fusion process into:
1. updateAirspeed: computes innov, innov_var, obs_var, ...
2. fuseAirspeed: uses data computed in 1. to generate K, H and fuse the
   observation
2022-07-07 09:42:54 -04:00
bresch
503aa87957 ekf2_derivation: create functions to generate innov_var or HK only
This is required when the innovation variance computation and the fusion
are performed in two different functions.
2022-07-07 09:42:54 -04:00
bresch
3d01b5aa11 ekf2_derivation: use unsimplified q->rot for observation equations 2022-07-05 14:25:35 +02:00
bresch
28b34a634b ekf2_derivation: do not print null equations 2022-07-05 14:25:35 +02:00
bresch
78dd557b26 ekf2_derivation: automatically replace pow function 2022-07-05 14:25:35 +02:00
bresch
11f78a3686 ekf2_derivation: update generated equations with SymPy 1.10.1 2022-07-05 14:25:35 +02:00
Daniel Agar
efde738826 ekf2: update EKF2_EV_DELAY default to 0 2022-07-04 11:44:53 -04:00
Daniel Agar
dc8ed97809 ekf2: optical flow control limits constrain speed using HAGL max 2022-06-21 12:52:25 -04:00
Daniel Agar
d5839e2dd5 optical flow sensor pipeline overhaul
- all sources of optical flow publish sensor_optical_flow
 - sensor_optical_flow is aggregated by the sensors module, aligned with integrated gyro, and published as vehicle_optical_flow

Co-authored-by: alexklimaj <alex@arkelectron.com>
2022-06-20 20:56:56 -04:00
Daniel Agar
b81a5b3efa ekf2: request mag yaw reset after calibration or sensor change 2022-06-17 21:04:05 -04:00
Daniel Agar
1980b5c5e8
ekf2: setEkfGlobalOrigin() reset baro and hgt sensor offsets if necessary
- handle uninitalized _gps_alt_ref
 - add basic lat/lon/alt sanity checks
2022-06-16 00:59:54 -04:00
bresch
0d256b8ff6 ekf2 wind: use noise spectral density for process noise tuning
The noise spectral density, NSD, (square root of power spectral density) is a
continuous-time parameter that makes the tuning independent from the EKF
prediction rate.
NSD corresponds to the rate at which the state uncertainty increases
when no measurements are fused into the filter.
Given that the current prediction rate of EKF2 is 100Hz, the
same tuning is obtained by dividing the std_dev legacy parameter by 10:
nsd = sqrt(std_dev^2 / 100Hz)
2022-06-14 18:39:10 +10:00
bresch
4f1091792f ekf2 preflight: only check innovation of active height sources 2022-06-07 11:44:56 -04:00
PX4BuildBot
a247b42907 [AUTO COMMIT] update change indication 2022-06-04 15:57:11 -04:00
bresch
e2955bdd61 terrain est: clear innovation/var/test ration when aiding stops 2022-06-03 17:31:14 -04:00
Daniel Agar
21b1c933dc ekf2: EKFGSF_yaw delete unnecessary internal state 2022-06-01 13:16:06 -04:00
Daniel Agar
3889b79342 ekf2: yaw estimator add yaw_composite_valid boolean 2022-06-01 13:16:06 -04:00