|
|
@ -392,7 +392,7 @@ class AutoTestCopter(AutoTest): |
|
|
|
while self.get_sim_time() < tstart + timeout: |
|
|
|
while self.get_sim_time() < tstart + timeout: |
|
|
|
m = self.mav.recv_match(type='GLOBAL_POSITION_INT', blocking=True) |
|
|
|
m = self.mav.recv_match(type='GLOBAL_POSITION_INT', blocking=True) |
|
|
|
alt = m.relative_alt / 1000.0 # mm -> m |
|
|
|
alt = m.relative_alt / 1000.0 # mm -> m |
|
|
|
home_distance = self.distance_to_home() |
|
|
|
home_distance = self.distance_to_home(use_cached_home=True) |
|
|
|
home = "" |
|
|
|
home = "" |
|
|
|
if alt <= 1 and home_distance < 10: |
|
|
|
if alt <= 1 and home_distance < 10: |
|
|
|
home = "HOME" |
|
|
|
home = "HOME" |
|
|
@ -690,7 +690,7 @@ class AutoTestCopter(AutoTest): |
|
|
|
while self.get_sim_time() < tstart + timeout: |
|
|
|
while self.get_sim_time() < tstart + timeout: |
|
|
|
m = self.mav.recv_match(type='GLOBAL_POSITION_INT', blocking=True) |
|
|
|
m = self.mav.recv_match(type='GLOBAL_POSITION_INT', blocking=True) |
|
|
|
alt = m.relative_alt / 1000.0 # mm -> m |
|
|
|
alt = m.relative_alt / 1000.0 # mm -> m |
|
|
|
home_distance = self.distance_to_home() |
|
|
|
home_distance = self.distance_to_home(use_cached_home=True) |
|
|
|
self.progress("Alt: %.02f HomeDistance: %.02f" % |
|
|
|
self.progress("Alt: %.02f HomeDistance: %.02f" % |
|
|
|
(alt, home_distance)) |
|
|
|
(alt, home_distance)) |
|
|
|
# recenter pitch sticks once we're home so we don't fly off again |
|
|
|
# recenter pitch sticks once we're home so we don't fly off again |
|
|
@ -721,6 +721,7 @@ class AutoTestCopter(AutoTest): |
|
|
|
self.set_parameter("AVOID_ENABLE", 1) |
|
|
|
self.set_parameter("AVOID_ENABLE", 1) |
|
|
|
|
|
|
|
|
|
|
|
# give we're testing RTL, doing one here probably doesn't make sense |
|
|
|
# give we're testing RTL, doing one here probably doesn't make sense |
|
|
|
|
|
|
|
home_distance = self.distance_to_home(use_cached_home=True) |
|
|
|
raise AutoTestTimeoutException( |
|
|
|
raise AutoTestTimeoutException( |
|
|
|
("Fence test failed to reach home - " |
|
|
|
("Fence test failed to reach home - " |
|
|
|
"timed out after %u seconds" % timeout)) |
|
|
|
"timed out after %u seconds" % timeout)) |
|
|
@ -963,14 +964,14 @@ class AutoTestCopter(AutoTest): |
|
|
|
|
|
|
|
|
|
|
|
# wait for arrival back home |
|
|
|
# wait for arrival back home |
|
|
|
self.mav.recv_match(type='VFR_HUD', blocking=True) |
|
|
|
self.mav.recv_match(type='VFR_HUD', blocking=True) |
|
|
|
while self.distance_to_home() > 5: |
|
|
|
while self.distance_to_home(use_cached_home=True) > 5: |
|
|
|
if self.get_sim_time() > (tstart + timeout): |
|
|
|
if self.get_sim_time() > (tstart + timeout): |
|
|
|
raise AutoTestTimeoutException( |
|
|
|
raise AutoTestTimeoutException( |
|
|
|
("GPS Glitch testing failed" |
|
|
|
("GPS Glitch testing failed" |
|
|
|
"- exceeded timeout %u seconds" % timeout)) |
|
|
|
"- exceeded timeout %u seconds" % timeout)) |
|
|
|
|
|
|
|
|
|
|
|
self.mav.recv_match(type='VFR_HUD', blocking=True) |
|
|
|
self.mav.recv_match(type='VFR_HUD', blocking=True) |
|
|
|
self.progress("Dist from home: %.02f" % self.distance_to_home()) |
|
|
|
self.progress("Dist from home: %.02f" % self.distance_to_home(use_cached_home=True)) |
|
|
|
|
|
|
|
|
|
|
|
# turn off simulator display of gps and actual position |
|
|
|
# turn off simulator display of gps and actual position |
|
|
|
if self.use_map: |
|
|
|
if self.use_map: |
|
|
|