mirror of https://github.com/ArduPilot/ardupilot
autotest: use percentage error when determining if z is preserved
floating point storage means an absolute error doesn't work
This commit is contained in:
parent
08f652fe2c
commit
b441c24eaa
|
@ -4241,9 +4241,13 @@ class AutoTest(ABC):
|
||||||
raise NotAchievedException("Frame not same (got=%s want=%s)" %
|
raise NotAchievedException("Frame not same (got=%s want=%s)" %
|
||||||
(self.string_for_frame(downloaded_item_val),
|
(self.string_for_frame(downloaded_item_val),
|
||||||
self.string_for_frame(item_val)))
|
self.string_for_frame(item_val)))
|
||||||
if abs(item.z - downloaded_item.z) > 1.0E-3: # error should be less than 1 mm
|
if downloaded_item.z == 0:
|
||||||
raise NotAchievedException("Z not preserved (got=%f want=%f)" %
|
delta = abs(item.z)
|
||||||
(downloaded_item.z, item.z))
|
else:
|
||||||
|
delta = 1 - abs(item.z / downloaded_item.z)
|
||||||
|
if delta > 0.01: # error should be less than 1 mm, but float precision issues in Python...
|
||||||
|
raise NotAchievedException("Z not preserved (got=%f want=%f delta=%f%%)" %
|
||||||
|
(downloaded_item.z, item.z, delta))
|
||||||
|
|
||||||
def check_fence_items_same(self, want, got, strict=True):
|
def check_fence_items_same(self, want, got, strict=True):
|
||||||
check_atts = ['mission_type', 'command', 'x', 'y', 'seq', 'param1']
|
check_atts = ['mission_type', 'command', 'x', 'y', 'seq', 'param1']
|
||||||
|
|
Loading…
Reference in New Issue