autotest: fix un-set variable problem in verify_innov

This commit is contained in:
Peter Barker 2023-01-05 07:47:31 +11:00 committed by Peter Barker
parent c68bab44a5
commit d9564d973d

View File

@ -2419,6 +2419,7 @@ class AutoTestCopter(AutoTest):
self.reboot_sitl()
# add a listener that verifies rangefinder innovations look good
global alt
alt = None
def verify_innov(mav, m):
@ -2428,6 +2429,8 @@ class AutoTestCopter(AutoTest):
return
if m.get_type() != 'EKF_STATUS_REPORT':
return
if alt is None:
return
if alt > 1 and alt < 8: # 8 is very low, but it takes a long time to start to use the rangefinder again
zero_variance_wanted = False
elif alt > 20: