Browse Source

autotest: add accuracy option to guided_achieve_heading

zr-v5.1
Peter Barker 4 years ago committed by Peter Barker
parent
commit
3d562046da
  1. 6
      Tools/autotest/common.py

6
Tools/autotest/common.py

@ -4631,7 +4631,7 @@ class AutoTest(ABC): @@ -4631,7 +4631,7 @@ class AutoTest(ABC):
self.wait_distance(distance, accuracy=2)
self.set_rc(3, 1500)
def guided_achieve_heading(self, heading):
def guided_achieve_heading(self, heading, accuracy=None):
tstart = self.get_sim_time()
while True:
if self.get_sim_time_cached() - tstart > 200:
@ -4648,6 +4648,10 @@ class AutoTest(ABC): @@ -4648,6 +4648,10 @@ class AutoTest(ABC):
)
m = self.mav.recv_match(type='VFR_HUD', blocking=True)
self.progress("heading=%d want=%d" % (m.heading, int(heading)))
if accuracy is not None:
delta = abs(m.heading - int(heading))
if delta <= accuracy:
return
if m.heading == int(heading):
return

Loading…
Cancel
Save