Skip to content

Commit

Permalink
autotest: Enabled/edited old test and added new test on home alt reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Georacer committed Dec 1, 2024
1 parent 53ee7d6 commit 9095547
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions Tools/autotest/arduplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -6185,14 +6185,18 @@ def GPSPreArms(self):
def SetHomeAltChange(self):
'''check modes retain altitude when home alt changed'''
for mode in 'FBWB', 'CRUISE', 'LOITER':
self.set_rc(3, 1000)
self.wait_ready_to_arm()
home = self.home_position_as_mav_location()
self.takeoff(20)
higher_home = home
target_alt = 20
self.takeoff(target_alt, mode="TAKEOFF")
self.delay_sim_time(20) # Give some time to altitude to stabilize.
self.set_rc(3, 1500)
self.change_mode(mode)
higher_home = copy.copy(home)
higher_home.alt += 40
self.set_home(higher_home)
self.change_mode(mode)
self.wait_altitude(15, 25, relative=True, minimum_duration=10)
self.wait_altitude(home.alt+target_alt-5, home.alt+target_alt+5, relative=False, minimum_duration=10, timeout=11)
self.disarm_vehicle(force=True)
self.reboot_sitl()

Expand Down Expand Up @@ -6228,6 +6232,23 @@ def SetHomeAltChange2(self):
self.disarm_vehicle(force=True)
self.reboot_sitl()

def SetHomeAltChange3(self):
'''same as SetHomeAltChange, but the home alt change occurs during TECS operation'''
self.wait_ready_to_arm()
home = self.home_position_as_mav_location()
target_alt = 20
self.takeoff(target_alt, mode="TAKEOFF")
self.change_mode("LOITER")
self.delay_sim_time(20) # Let the plane settle.

higher_home = copy.copy(home)
higher_home.alt += 40
self.set_home(higher_home)
self.wait_altitude(home.alt+target_alt-5, home.alt+target_alt+5, relative=False, minimum_duration=10, timeout=10.1)

self.disarm_vehicle(force=True)
self.reboot_sitl()

def ForceArm(self):
'''check force-arming functionality'''
self.set_parameter("SIM_GPS1_ENABLE", 0)
Expand Down Expand Up @@ -6497,6 +6518,7 @@ def tests1b(self):
self.GPSPreArms,
self.SetHomeAltChange,
self.SetHomeAltChange2,
self.SetHomeAltChange3,
self.ForceArm,
self.MAV_CMD_EXTERNAL_WIND_ESTIMATE,
self.GliderPullup,
Expand All @@ -6508,7 +6530,6 @@ def disabled_tests(self):
"LandingDrift": "Flapping test. See https://github.com/ArduPilot/ardupilot/issues/20054",
"InteractTest": "requires user interaction",
"ClimbThrottleSaturation": "requires https://github.com/ArduPilot/ardupilot/pull/27106 to pass",
"SetHomeAltChange": "https://github.com/ArduPilot/ardupilot/issues/5672",
}


Expand Down

0 comments on commit 9095547

Please sign in to comment.