Skip to content

Commit 1e1e502

Browse files
committed
fix(ekf2): allow optical flow to start when range finder is height reference
When EKF2_HGT_REF=2 (range sensor) with no GPS, optical flow could never start. The starting condition required isTerrainEstimateValid() or isHorizontalAidingActive(), but terrain is never "estimated" when range is the height reference (ground is the datum, terrain state is fixed at 0), and there's no horizontal aiding without GPS. HAGL is directly known from the range measurement in this case, so optical flow has everything it needs to fuse. Add the range height reference check to the optical flow starting conditions. Fixes: #25248
1 parent fab7cbd commit 1e1e502

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/modules/ekf2/EKF/aid_sources/optical_flow/optical_flow_control.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void Ekf::controlOpticalFlowFusion(const imuSample &imu_delayed)
155155
&& is_magnitude_good
156156
&& is_tilt_good
157157
&& (_flow_counter > 10)
158-
&& (isTerrainEstimateValid() || isHorizontalAidingActive())
158+
&& (isTerrainEstimateValid() || isHorizontalAidingActive() || (_height_sensor_ref == HeightSensor::RANGE))
159159
&& isTimedOut(_aid_src_optical_flow.time_last_fuse, (uint64_t)2e6); // Prevent rapid switching
160160

161161
// If the height is relative to the ground, terrain height cannot be observed.

0 commit comments

Comments
 (0)