Skip to content

Commit

Permalink
Tools: Autotest: Test for EAHRS misconfiguration prearm failure
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 committed Mar 26, 2024
1 parent 485ff27 commit 79133b7
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion Tools/autotest/arduplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -3169,7 +3169,7 @@ def TerrainLoiter(self):
self.fly_home_land_and_disarm(240)

def fly_external_AHRS(self, sim, eahrs_type, mission):
"""Fly with external AHRS (VectorNav)"""
"""Fly with external AHRS"""
self.customise_SITL_commandline(["--serial4=sim:%s" % sim])

self.set_parameters({
Expand Down Expand Up @@ -3293,6 +3293,32 @@ def InertialLabsEAHRS(self):
'''Test InertialLabs EAHRS support'''
self.fly_external_AHRS("ILabs", 5, "ap1.txt")

def GpsSensorPreArmEAHRS(self):
'''Test pre-arm failure with misconfigured EAHRS_SENSORS using the MicroStrain7 driver'''
self.customise_SITL_commandline(["--serial4=sim:MicroStrain7"])

self.set_parameters({
"EAHRS_TYPE": 7,
"SERIAL4_PROTOCOL": 36,
"SERIAL4_BAUD": 230400,
"GPS1_TYPE": 0, # Disabled (simulate user setup error)
"AHRS_EKF_TYPE": 11,
"INS_GYR_CAL": 1,
"EAHRS_SENSORS": 13, # GPS is enabled
})
self.reboot_sitl()
self.delay_sim_time(5)
self.progress("Running accelcal")
self.run_cmd(
mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION,
p5=4,
timeout=5,
)

self.assert_prearm_failure("ExternalAHRS: Incorrect number", # Cut short due to message limits.
timeout=30,
other_prearm_failures_fatal=False)

def get_accelvec(self, m):
return Vector3(m.xacc, m.yacc, m.zacc) * 0.001 * 9.81

Expand Down Expand Up @@ -5408,6 +5434,7 @@ def tests(self):
self.MicroStrainEAHRS5,
self.MicroStrainEAHRS7,
self.InertialLabsEAHRS,
self.GpsSensorPreArmEAHRS,
self.Deadreckoning,
self.DeadreckoningNoAirSpeed,
self.EKFlaneswitch,
Expand Down

0 comments on commit 79133b7

Please sign in to comment.