Browse Source

autotest: add test for quadplane booting in auto

master
Peter Barker 3 years ago committed by Peter Barker
parent
commit
9f58e7df31
  1. 4
      Tools/autotest/ArduPlane_Tests/BootInAUTO/mission.txt
  2. 5
      Tools/autotest/common.py
  3. 26
      Tools/autotest/quadplane.py

4
Tools/autotest/ArduPlane_Tests/BootInAUTO/mission.txt

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
QGC WPL 110
0 0 0 16 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1
1 0 3 22 15.000000 0.000000 0.000000 0.000000 0.000000 0.000000 50.000000 1
2 0 3 16 0.000000 0.000000 0.000000 0.000000 47.523048 18.813797 100.000000 1

5
Tools/autotest/common.py

@ -6474,6 +6474,11 @@ class AutoTest(ABC): @@ -6474,6 +6474,11 @@ class AutoTest(ABC):
**kwargs
)
def assert_current_waypoint(self, wpnum):
seq = self.mav.waypoint_current()
if seq != wpnum:
raise NotAchievedException("Incorrect current wp")
def wait_current_waypoint(self, wpnum, timeout=60):
tstart = self.get_sim_time()
while True:

26
Tools/autotest/quadplane.py

@ -705,6 +705,28 @@ class AutoTestQuadPlane(AutoTest): @@ -705,6 +705,28 @@ class AutoTestQuadPlane(AutoTest):
"ConfigErrorLoop": "failing because RC values not settable",
}
def BootInAUTO(self):
self.load_mission("mission.txt")
self.set_parameters({
})
self.set_rc(5, 1000)
self.wait_mode('AUTO')
self.reboot_sitl()
self.wait_ready_to_arm()
self.delay_sim_time(20)
self.assert_current_waypoint(1)
self.arm_vehicle()
self.wait_altitude(9, 11, relative=True) # value from mission file is 10
distance = self.distance_to_home()
# this distance check is very, very loose. At time of writing
# the vehicle actually pitches ~6 degrees on trakeoff,
# wandering over 1m.
if distance > 2:
raise NotAchievedException("wandered from home (distance=%f)" %
(distance,))
self.change_mode('QLAND')
self.wait_disarmed(timeout=60)
def test_pilot_yaw(self):
self.takeoff(10, mode="QLOITER")
self.set_parameter("STICK_MIXING", 0)
@ -978,6 +1000,10 @@ class AutoTestQuadPlane(AutoTest): @@ -978,6 +1000,10 @@ class AutoTestQuadPlane(AutoTest):
"Check disarm behaviour in Q-mode",
self.MidAirDisarmDisallowed),
("BootInAUTO",
"Test behaviour when booting in auto",
self.BootInAUTO),
("LogUpload",
"Log upload",
self.log_upload),

Loading…
Cancel
Save