def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--baseurl', default=USB_URL) parser.add_argument('--takeoff', action='store_true') parser.add_argument('--land', action='store_true') args = parser.parse_args() # Ask for a 360x240 jpeg stream at 7.5fps stream_settings = {'source': 'NATIVE', 'port': 55004} # Acquire pilot access client = HTTPClient(baseurl=args.baseurl, pilot=True, stream_settings=stream_settings) if args.takeoff: print('taking off') client.takeoff() if args.land: print('landing') client.land() print('looping now') while True: print('status ping') client.update_pilot_status() time.sleep(2) print('done')
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--baseurl', default=USB_URL) parser.add_argument('--takeoff', action='store_true') parser.add_argument('--land', action='store_true') parser.add_argument('--repeat', action='store_true') parser.add_argument('--remote-host', type=str, default=REMOTE_HOST) args = parser.parse_args() # Ask for a 360x240 jpeg stream at 7.5fps stream_settings = {'source': 'NATIVE', 'port': REMOTE_PORT} # Acquire pilot access while True: try: client = HTTPClient(baseurl=args.baseurl, pilot=True, stream_settings=stream_settings) break except: print('failed to connect') if args.repeat: time.sleep(1) else: return # proxy RTP packets to a remote host subprocess.Popen([ 'python', 'gstreamer_proxy.py', '--remote-host', args.remote_host, '--remote-port', str(REMOTE_PORT) ]) if args.takeoff: print('taking off') client.takeoff() if args.land: print('landing') client.land() print('looping now') while True: print('status ping') client.update_pilot_status() time.sleep(2) print('done')