autotest: add test altitudes in camera log messages are correct
This commit is contained in:
parent
d1a1bcba19
commit
0f913b5bdf
@ -10783,6 +10783,51 @@ class AutoTestCopter(vehicle_test_suite.TestSuite):
|
|||||||
|
|
||||||
self.wait_disarmed()
|
self.wait_disarmed()
|
||||||
|
|
||||||
|
def CameraLogMessages(self):
|
||||||
|
'''ensure Camera log messages are good'''
|
||||||
|
self.set_parameter("RC12_OPTION", 9) # CameraTrigger
|
||||||
|
self.set_parameter("CAM1_TYPE", 1) # Camera with servo trigger
|
||||||
|
self.reboot_sitl() # needed for RC12_OPTION to take effect
|
||||||
|
|
||||||
|
gpis = []
|
||||||
|
gps_raws = []
|
||||||
|
|
||||||
|
self.takeoff(10, mode='GUIDED')
|
||||||
|
self.set_rc(12, 2000)
|
||||||
|
gpis.append(self.assert_receive_message('GLOBAL_POSITION_INT'))
|
||||||
|
gps_raws.append(self.assert_receive_message('GPS_RAW_INT'))
|
||||||
|
self.set_rc(12, 1000)
|
||||||
|
|
||||||
|
self.fly_guided_move_local(0, 0, 20)
|
||||||
|
|
||||||
|
self.set_rc(12, 2000)
|
||||||
|
gpis.append(self.assert_receive_message('GLOBAL_POSITION_INT'))
|
||||||
|
gps_raws.append(self.assert_receive_message('GPS_RAW_INT'))
|
||||||
|
self.set_rc(12, 1000)
|
||||||
|
|
||||||
|
dfreader = self.dfreader_for_current_onboard_log()
|
||||||
|
self.do_RTL()
|
||||||
|
|
||||||
|
for i in range(len(gpis)):
|
||||||
|
gpi = gpis[i]
|
||||||
|
gps_raw = gps_raws[i]
|
||||||
|
m = dfreader.recv_match(type="CAM")
|
||||||
|
|
||||||
|
things = [
|
||||||
|
["absalt", gpi.alt*0.001, m.Alt],
|
||||||
|
["relalt", gpi.relative_alt*0.001, m.RelAlt],
|
||||||
|
["gpsalt", gps_raw.alt*0.001, m.GPSAlt], # use GPS_RAW here?
|
||||||
|
]
|
||||||
|
for (name, want, got) in things:
|
||||||
|
if abs(got - want) > 1:
|
||||||
|
raise NotAchievedException(f"Incorrect {name} {want=} {got=}")
|
||||||
|
self.progress(f"{name} {want=} {got=}")
|
||||||
|
|
||||||
|
want = gpi.relative_alt*0.001
|
||||||
|
got = m.RelAlt
|
||||||
|
if abs(got - want) > 1:
|
||||||
|
raise NotAchievedException(f"Incorrect relalt {want=} {got=}")
|
||||||
|
|
||||||
def tests2b(self): # this block currently around 9.5mins here
|
def tests2b(self): # this block currently around 9.5mins here
|
||||||
'''return list of all tests'''
|
'''return list of all tests'''
|
||||||
ret = ([
|
ret = ([
|
||||||
@ -10860,6 +10905,7 @@ class AutoTestCopter(vehicle_test_suite.TestSuite):
|
|||||||
self.Ch6TuningWPSpeed,
|
self.Ch6TuningWPSpeed,
|
||||||
self.PILOT_THR_BHV,
|
self.PILOT_THR_BHV,
|
||||||
self.GPSForYawCompassLearn,
|
self.GPSForYawCompassLearn,
|
||||||
|
self.CameraLogMessages,
|
||||||
])
|
])
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user