Browse Source

AutoTest: Move fence enable/disable to common location

c415-sdk
James O'Shannessy 4 years ago committed by Peter Barker
parent
commit
47e76a1807
  1. 9
      Tools/autotest/arducopter.py
  2. 21
      Tools/autotest/arduplane.py
  3. 21
      Tools/autotest/common.py

9
Tools/autotest/arducopter.py

@ -1354,14 +1354,7 @@ class AutoTestCopter(AutoTest): @@ -1354,14 +1354,7 @@ class AutoTestCopter(AutoTest):
# Activate the floor fence
# TODO this test should run without requiring this
self.run_cmd(mavutil.mavlink.MAV_CMD_DO_FENCE_ENABLE,
1,
0,
0,
0,
0,
0,
0)
self.do_fence_enable()
# first east
self.progress("turn east")

21
Tools/autotest/arduplane.py

@ -1038,27 +1038,6 @@ class AutoTestPlane(AutoTest): @@ -1038,27 +1038,6 @@ class AutoTestPlane(AutoTest):
raise NotAchievedException("fence status incorrect; %s want=%u got=%u" %
(name, want, got))
def do_fence_en_or_dis_able(self, value, want_result=mavutil.mavlink.MAV_RESULT_ACCEPTED):
if value:
p1 = 1
else:
p1 = 0
self.run_cmd(mavutil.mavlink.MAV_CMD_DO_FENCE_ENABLE,
p1, # param1
0, # param2
0, # param3
0, # param4
0, # param5
0, # param6
0, # param7
want_result=want_result)
def do_fence_enable(self, want_result=mavutil.mavlink.MAV_RESULT_ACCEPTED):
self.do_fence_en_or_dis_able(True, want_result=want_result)
def do_fence_disable(self, want_result=mavutil.mavlink.MAV_RESULT_ACCEPTED):
self.do_fence_en_or_dis_able(False, want_result=want_result)
def wait_circling_point_with_radius(self, loc, want_radius, epsilon=5.0, min_circle_time=5, timeout=120):
on_radius_start_heading = None
average_radius = 0.0

21
Tools/autotest/common.py

@ -4619,6 +4619,27 @@ class AutoTest(ABC): @@ -4619,6 +4619,27 @@ class AutoTest(ABC):
self.mavproxy.expect("Loaded module relay")
self.mavproxy.send("relay set %d %d\n" % (relay_num, on_off))
def do_fence_en_or_dis_able(self, value, want_result=mavutil.mavlink.MAV_RESULT_ACCEPTED):
if value:
p1 = 1
else:
p1 = 0
self.run_cmd(mavutil.mavlink.MAV_CMD_DO_FENCE_ENABLE,
p1, # param1
0, # param2
0, # param3
0, # param4
0, # param5
0, # param6
0, # param7
want_result=want_result)
def do_fence_enable(self, want_result=mavutil.mavlink.MAV_RESULT_ACCEPTED):
self.do_fence_en_or_dis_able(True, want_result=want_result)
def do_fence_disable(self, want_result=mavutil.mavlink.MAV_RESULT_ACCEPTED):
self.do_fence_en_or_dis_able(False, want_result=want_result)
#################################################
# WAIT UTILITIES
#################################################

Loading…
Cancel
Save