Skip to content

Commit fdda4b7

Browse files
committed
autotest: add test for flying a mission far from EKF origin
1 parent ffec56c commit fdda4b7

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
QGC WPL 110
2+
0 0 0 16 0.000000 0.000000 0.000000 0.000000 -35.363262 149.165237 1015.559998 1
3+
1 0 3 22 0.000000 0.000000 0.000000 0.000000 -35.362881 149.165222 20.000000 1
4+
2 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.364652 149.163501 20.000000 1
5+
3 0 0 115 640.000000 20.000000 1.000000 1.000000 0.000000 0.000000 0.000000 1
6+
4 0 3 19 5.000000 0.000000 1.000000 1.000000 0.000000 0.000000 20.000000 1
7+
5 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.365361 149.163501 0.000000 1
8+
6 0 3 16 1.000000 0.000000 0.000000 0.000000 -35.365361 149.163995 40.000000 1
9+
7 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.365361 149.164563 20.000000 1
10+
8 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.364652 149.164531 20.000000 1
11+
9 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.364652 149.163995 20.000000 1
12+
10 0 0 177 8.000000 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1
13+
11 0 3 16 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1
14+
12 0 0 20 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1

Tools/autotest/arducopter.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,6 +2768,50 @@ def CopterMission(self):
27682768

27692769
self.progress("Auto mission completed: passed!")
27702770

2771+
# def loc_from_received_GLOBAL_POSITION_INT(self):
2772+
# '''return a mavutil.location created from a received GLOBAL_POSITION_INT'''
2773+
# x = mavutil.location(m.lat/1e7, m.lon/1e7, m.alt/1e3, 0)
2774+
2775+
def set_origin(self, loc, timeout=60):
2776+
'''set the GPS global origin to loc'''
2777+
tstart = self.get_sim_time()
2778+
while True:
2779+
if self.get_sim_time_cached() - tstart > timeout:
2780+
raise AutoTestTimeoutException("Did not get non-zero lat")
2781+
target_system = 1
2782+
self.mav.mav.set_gps_global_origin_send(
2783+
target_system,
2784+
int(loc.lat * 1e7),
2785+
int(loc.lng * 1e7),
2786+
int(loc.alt * 1e3)
2787+
)
2788+
gpi = self.assert_receive_message('GLOBAL_POSITION_INT')
2789+
self.progress("gpi=%s" % str(gpi))
2790+
if gpi.lat != 0:
2791+
break
2792+
2793+
def FarOrigin(self):
2794+
'''fly a mission far from the vehicle origin'''
2795+
# Fly mission #1
2796+
self.set_parameters({
2797+
"SIM_GPS_DISABLE": 1,
2798+
})
2799+
self.reboot_sitl()
2800+
nz = mavutil.location(-43.730171, 169.983118, 1466.3, 270)
2801+
self.set_origin(nz)
2802+
self.set_parameters({
2803+
"SIM_GPS_DISABLE": 0,
2804+
})
2805+
self.progress("# Load copter_mission")
2806+
# load the waypoint count
2807+
num_wp = self.load_mission("copter_mission.txt", strict=False)
2808+
if not num_wp:
2809+
raise NotAchievedException("load copter_mission failed")
2810+
2811+
self.fly_loaded_mission(num_wp)
2812+
2813+
self.progress("Auto mission completed: passed!")
2814+
27712815
def fly_loaded_mission(self, num_wp):
27722816
'''fly mission loaded on vehicle. FIXME: get num_wp from vehicle'''
27732817
self.progress("test: Fly a mission from 1 to %u" % num_wp)
@@ -11388,6 +11432,7 @@ def tests2b(self): # this block currently around 9.5mins here
1138811432
self.CompassMot,
1138911433
self.AutoRTL,
1139011434
self.EK3_OGN_HGT_MASK,
11435+
self.FarOrigin,
1139111436
])
1139211437
return ret
1139311438

0 commit comments

Comments
 (0)