1117 Commits

Author SHA1 Message Date
Roman
4a8a3a4079 l1 controller: simpler way of doing slew rate limiting
Signed-off-by: Roman <bapstroman@gmail.com>
2018-07-26 07:54:38 +02:00
Roman
fe4e6779f3 l1 position control: added roll angle setpoint slew rate limiting
Signed-off-by: Roman <bapstroman@gmail.com>
2018-07-26 07:54:38 +02:00
Paul Riseborough
748446b92f EKF: Use parameter for stuck range test threshold
The default has been reduced to make it suitable for low altitude optical flow navigation.
2018-07-26 07:53:39 +02:00
Paul Riseborough
628079719f EKF: Fix inconsistency in timeout for terrain validity
Terrain validity is determined solely by successful range finder fusion and terrain state initialisation.
A range finder that has been declared faulty requires continuous range finder data fusion requires  data to be continuous before the fault status _rng_hgt_faulty  can be cleared. This will enforce the requirement for continuous data before fusion can commence.
2018-07-26 07:53:39 +02:00
Paul Riseborough
d1d49857f9 EKF: Prevent stuck range checks running without new data 2018-07-26 07:53:39 +02:00
dakejahl
80146273ba removed if statement that would prevent the update of the _rng_hgt_faulty flag (#480) 2018-07-26 07:53:39 +02:00
Paul Riseborough
17d40478bb EKF: Rework range height validity checking
Eliminate race condition caused by checking for data freshness using time stamps from buffer push instead than buffer pop events.
Consistent use of range data ready and range data fault flags. This achieved by ensuring that _rng_hgt_faulty is set to true for all range data faults, not just data freshness.
Include range data validity requirement in rangeAidConditionsMet() check.
2018-07-26 07:53:39 +02:00
Paul Riseborough
e0bcfeb533 EKF: Add validity boolean to mag declination accessor 2018-07-26 07:51:58 +02:00
Paul Riseborough
1e610894b9 EKF: Correct documentation and function name for declination accessor
The function name and documentation are misleading given the function is only a getter.
This change makes the usage clearer.
2018-07-26 07:51:58 +02:00
Paul Riseborough
4d01883f75 EKF: Disable GPS drift checks when the vehicle is moving. 2018-07-24 07:31:45 +02:00
Roman Bapst
ee85a29202 Pr opt flow (#482)
* optical flow: fixed calculation of velocity of the flow sensor relative to
the IMU

- gyroXYZ holds a delta angle and first needs to converted to a gyro rate

Signed-off-by: Roman <bapstroman@gmail.com>

* optical flow: calculate height above the ground with respect to the flow
camera
- the flow camera can be offset from the IMU which needs to be considered

Signed-off-by: Roman <bapstroman@gmail.com>

* estimator interface: fixed comment regarding optical flow sample timestamp

- the timestamp on an optical flow sample corresponds to the trailing
edge of the flow integration period

Signed-off-by: Roman <bapstroman@gmail.com>
2018-07-16 11:41:35 +10:00
Paul Riseborough
4d59c834eb EKF: Consolidate range finder checking
This brings all the range finder data checks (excluding innovation consistency checks) into one place and eliminates the need to perform range checking external to the library.
The hard coded optical flow tilt limit is changed to use the same value as the range finder.
Variable names are changed to make a clear distinction between the max/min values calculated by the stuck range check and the max/min valid values for the sensor.
2018-07-12 18:20:50 +02:00
Kabir Mohammed
e1661a92c3 EKF : allow init without external vision measurements (#464) 2018-07-12 11:36:47 +10:00
Paul Riseborough
a0ed08967e EKF: Add missing range validity check 2018-07-11 14:53:37 +02:00
Daniel Agar
41953ab582 EKF angle constants in degrees for readability (#465)
* EKF angle constants in degrees for readability

* EKF make FILTER_UPDATE_PERIOD_MS static constexpr and add FILTER_UPDATE_PERIOD_S

* EKF controlOpticalFlowFusion() use constants and update comments

* EKF controlMagFusion() use angle in degrees

* EKF move earth spin rate to geo and update usage

* EKF: Fix numerical constant error and clean up comments

Comments do not need to contain numerical values when the code makes these clear.
2018-07-05 08:55:22 +10:00
Daniel Agar
cebdc3d829 ekf run output predictor immediately with new IMU data (#471)
* EKF collect_imu take const imu sample and populate buffer

* EKF calculateOutputStates cleanup

* EKF add calculate_quaternion output predictor method

* EKF: update documentation

* EKF: remove unnecessary getter function

* EKF calculateOutputStates only apply dt correction to bias

* EKF pytest assert attitude validity, not update() return

* EKF: correct documentation

* EKF: Do not make attitude validity dependent on yaw alignment status

Yaw alignment could fail in flight due to temporary loss of data and yet the quaternions would still usable for stabilisation even though the absolute earth yaw angle wrt true north was uncertain.
2018-07-05 07:59:35 +10:00
Daniel Agar
114ae4116a geo get_bearing_to_next_waypoint() small optimization 2018-06-30 21:30:35 +00:00
Daniel Agar
b26c2d62b8 geo get_distance_to_arc remove double promotion 2018-06-30 10:09:10 -04:00
Philipp Oettershagen
b3959fab2f TECS: Do not even calculate integrator state if integrator gain is zero 2018-06-29 15:55:46 +00:00
Philipp Oettershagen
ccfba49971 TECS: Set the integrator output to zero if the gain is zero. Otherwise (e.g. after a climbout) it can happen that the integrator stays at a large constant value and thus distrubs the control loop 2018-06-29 15:55:46 +00:00
Paul Riseborough
1cba257bac
Merge branch 'master' into pr-ekfOptFlowGyro 2018-06-18 09:36:16 +10:00
Paul Riseborough
1a1106878d
EKF: Prevent timestamp jitter failing GPS data arrival check (#462)
This fixes a error condition that occurs if _time_last_gps is greater than _time_last_imu.
By checking time stamps at the fusion time horizon, we guarantee that this cannot happen because all observations must have a time stamp smaller or equal to _imu_sample_delayed.time_us before they are retrieved from the buffers.
2018-06-15 16:03:54 +10:00
Daniel Agar
4ae8242c35 validation DataValidatorGroup::get_best() nullptr check
- fixes Coverity CID 139448
2018-06-14 08:14:53 +02:00
Daniel Agar
c3e071e052 validation initialize all members
- fixes Coverity CID 260331
2018-06-14 08:14:53 +02:00
Roman
c8af315aa7 flow_fusion: corrected sign of gyro data when it is taken from the ekf
gyro data

Signed-off-by: Roman <bapstroman@gmail.com>
2018-06-13 21:52:42 +02:00
Paul Riseborough
c6ed2ccfcd EKF: Fix half frame offset in flow gyro compensation.
The gyro data accumulation needs to be across the same integration period as the flow sensor. The previous code didn't sample the accumulation until the midpoint of the flow data had fallen behind the fusion time horizon.

This PR changes the optical flow time stamp definition so that flow data is retrieved when the leading edge of the flow accumulation period falls behind the fusion time horizon. This enables the accumulated gyro data to be sampled at the correct time. Fusion is then delayed until the mid sample time has fallen behind the fusion time horizon.
2018-06-13 16:51:42 +10:00
Paul Riseborough
48561b0c8a EKF: Update optical flow interface documentation 2018-06-12 16:52:26 +10:00
Paul Riseborough
de7c9d85a4 EKF: Handle flow data without valid gyro data 2018-06-12 16:24:25 +10:00
elia
26dcf05d80 keep ev timeout sign always positive 2018-06-11 00:17:19 +02:00
Daniel Agar
a8b73bd139 replace geo _wrap_pi with matrix::wrap_pi 2018-06-11 00:16:17 +02:00
Daniel Agar
5c64879688
Jenkins codecov.io add flag 2018-06-09 21:12:03 -04:00
Paul Riseborough
d177e96508 EKF: Fix bug causing slow drift when high rate flow data is used
High rate optical flow data could make flow fusion to run every major update cycle, resulting in the calculation of bias errors in the body rates used to compensate flow data failing time validity checks and not running. This resulted in a slow drift of the nav solution if bias errors were present in the in the gyro data used for flow sensor motion compensation.
2018-06-09 22:23:55 +02:00
Paul Riseborough
ee2dc7d790 EKF: Rework optical flow selection logic
Fixes a race condition caused by the _is_dead_reckoning test.
Only checks flow selection when flow is available.
2018-06-09 22:23:55 +02:00
Paul Riseborough
e383b6a272 EKF: rework optical flow selection logic
Make use of range aiding movement check clearer.
Fix logic errors that caused rapid toggling of flow use when on ground.
2018-06-09 22:23:55 +02:00
Paul Riseborough
487e6a0901 EKF: enable user selection of auto mag free operation
Also modify check to not apply if EV yaw is being used.
2018-06-09 22:23:55 +02:00
Paul Riseborough
6bdbe032f9 EKF: Fallback to optical flow for all in-flight loss of navigation scenarios 2018-06-09 22:23:55 +02:00
Mohammed Kabir
b4d2b8c57d EKF : introduce new architechture for navigation limits 2018-06-09 22:23:55 +02:00
Paul Riseborough
8a713398cb EKF: Improve ground effect compensation
Start deadline at zero so that initial rotor wash effect is rejected.
2018-06-09 22:23:55 +02:00
Paul Riseborough
39697f1196 EKF: rework optical flow switching 2018-06-09 22:23:55 +02:00
Paul Riseborough
1cfe845751 EKF: rework GPS quality check 2018-06-09 22:23:55 +02:00
Paul Riseborough
99a80387ed EKF: improve optical flow GPS quality checking 2018-06-09 22:23:55 +02:00
Paul Riseborough
7f36add241 EKF: scale GPS vertical accuracy check when using optical flow 2018-06-09 22:23:55 +02:00
Paul Riseborough
fc9f532c34 EKF: relax range finder data continuity check 2018-06-09 22:23:55 +02:00
Paul Riseborough
93c456f2b8 EKF: Improve protection against badly conditioned dVel bias covariances
Reduces likelihood of Z delta velocity bias learning to wrong value.
2018-06-09 22:23:55 +02:00
Paul Riseborough
225057aaf5 EKF: Fix bug preventing use of terrain estimator 2018-06-09 22:23:55 +02:00
Paul Riseborough
adb4a09beb EKF: Fix bug causing large yaw innovations when GPS is lost 2018-06-09 22:23:55 +02:00
Paul Riseborough
f59cd0f5b0 EKF: Don't make detection of indoor operation dependent on optical flow
This is required because it can take several seconds for an optical flow sensor operation to be confirmed and there are also many use cases for indoor operation where no optical flow is used.
2018-06-09 22:23:55 +02:00
Paul Riseborough
1562a82dc2 EKF: Add parameter to adjust on-ground movement detector sensitivity 2018-06-09 22:23:55 +02:00
Paul Riseborough
ea9e8246ed EKF: Improve detection of indoor flight condition 2018-06-09 22:23:55 +02:00
Paul Riseborough
565f99254c EKF: Reduce effect of yaw gyro bias when using optical flow indoors 2018-06-09 22:23:55 +02:00