diff --git a/companion.py b/companion.py index 5204c20..23f95d1 100644 --- a/companion.py +++ b/companion.py @@ -50,6 +50,10 @@ while not vehicle.mode.name == "MANUAL": print 'Waiting for MANUAL mode.' time.sleep(1) +while vehicle.gps_0.satellites_visible < MIN_SATS: + print '{} satellites aquired. Waiting for {}.'.format(vehicle.gps_0.satellites_visible, MIN_SATS) + time.sleep(1) + vehicle.armed = True while not vehicle.armed: print 'Waiting for arm.' @@ -69,6 +73,8 @@ alt_buffer_ind = 0 prev_time_below_burn_alt = mytime() while True: + if alt_buffer_ind == 0: print_status() # print status once every 60 seconds + alt = vehicle.location.global_relative_frame.alt alt_buffer[alt_buffer_ind] = alt alt_buffer_ind += 1 @@ -86,7 +92,6 @@ while True: if time_above > BURN_TIME_ABOVE: break - if alt_buffer_ind == 0: print_status() # print status once every 60 seconds time.sleep(LOOP_DELAY) print_status() diff --git a/config.py b/config.py index 4867815..31d7c42 100644 --- a/config.py +++ b/config.py @@ -7,3 +7,4 @@ TARGET_LAT = 42.345131 # desired landing latitude TARGET_LON = -71.210126 # desired landing longitude TARGET_ALT = 0 # meters above sea level LOOP_DELAY = 0.5 # time in seconds to delay within loops +MIN_SATS = 5 # minimum number of satellites before vehicle takes off \ No newline at end of file