success = mambo.connect(num_retries=3) print("connected: %s" % success) if (success): # get the state information print("sleeping") mambo.smart_sleep(1) mambo.ask_for_state_update() mambo.smart_sleep(1) print("taking off!") mambo.takeoff() # enquanto o speed_ts == 0 esperar, pois os sensores ainda não responderam todos aux = 0 while mambo.sensors.speed_ts == 0: mambo.smart_sleep(0.5) aux = aux + 1 if (aux == 10): quit() print("remember shot 3 e 4") x = threading.Thread(target=go, args=(mambo, )) x.start() mambo.fly_direct(0, 40, 0, 0, 1) mambo.smart_sleep(4) mambo.land() mambo.disconnect() x._stop()
msg = pickle.loads(msg) #msg = str(msg) time.sleep(0.5) print(f"recebido {msg}") if (msg != "abort"): msg = msg.split(",") if (len(msg) < 2): print(type(msg[0])) # CODIGO PARA CLIENTE QUE APENAS OPERA 1 DRONE mambo = Mambo(msg[0].rstrip(), use_wifi=False) success = mambo.connect(num_retries=5) print(success) if (success): #mambo.takeoff() mambo.takeoff() mambo.smart_sleep(5) mambo.land() else: print("is a list ||%s ||| %s|| " % (msg[0].rstrip(), msg[1].rstrip())) mambo1 = Mambo(msg[0].rstrip(), use_wifi=False) mambo2 = Mambo(msg[1].rstrip(), use_wifi=False) success = mambo1.connect(num_retries=5) print(f"manbo 1 - {success}") if (success): success = mambo2.connect(num_retries=5) print(f"manbo 2 - {success}") if (success): mambo1.takeoff() mambo2.takeoff() mambo1.smart_sleep(1) mambo2.smart_sleep(1)