def land(z=1.5, descend=False, timeout=5.0, frame_id='aruco_map', use_leds=True, interrupter=interrupt_event): if use_leds: LedLib.blink(255, 0, 0, interrupter=interrupter) FlightLib.land(z=z, descend=descend, timeout_land=timeout, frame_id_land=frame_id, interrupter=interrupter) if use_leds: LedLib.off()
def run(self): self.connect() red = 0 green = 0 blue = 0 while True: data = self.fetch_data() if 'color' in data: data = data.split()[1:] color = map(int, data) red, green, blue = color elif data == 'rainbow': LedLib.rainbow() elif data == 'fill': LedLib.fill(red, green, blue) elif data == 'blink': LedLib.blink(red, green, blue) elif data == 'chase': LedLib.chase(red, green, blue) elif data == 'wipe_to': LedLib.wipe_to(red, green, blue) elif data == 'fade_to': LedLib.fade_to(red, green, blue) elif data == 'run': LedLib.fade_to(red, green, blue) elif data == 'close': LedLib.off() time.sleep(0.001)
led.fade_to(255, 0, 0) f.reach(1, 0.25, 1.2) led.fade_to(0, 255, 0) f.reach(1, 2.2, 1.2) led.fade_to(0, 0, 255) f.reach(0.25, 2.2, 1.2) led.fade_to(255, 255, 0) f.reach(0.25, 0.25, 1.2) led.fade_to(255, 0, 0) #center_spin f.reach(0.7, 1.1, 1.5) led.run(255, 0, 255, length=15, direction=True) f.spin(yaw_rate=0.6) led.blink(255, 0, 0) f.attitude(2) #Return t land pos led.rainbow() f.reach(0.25, 0.25, 1.2, delay=True) led.chase(0, 255, 0) f.land() led.off() time.sleep(3)
def land(): LedLib.rainbow() FlightLib.land() LedLib.off()
def land(self): FlightLib.land() LedLib.off() self.state_machine.switch_state( new_state=StateMachine.PAUSE_STATE )
play_animation.takeoff(safe_takeoff=SAFE_TAKEOFF) elif command == 'pause': pause_animation() elif command == 'resume': resume_animation() elif command == 'stop': stop_animation() FlightLib.interrupt() elif command == 'land': play_animation.land() elif command == 'disarm': FlightLib.arming(False) elif command == 'led_test': LedLib.fill(255, 255, 255) time.sleep(2) LedLib.off() elif command == 'request': request_target = args['value'] print("Got request for:", request_target) response = "" if request_target == 'test': response = "test_success" elif request_target == 'id': response = COPTER_ID elif request_target == 'selfcheck': check = FlightLib.selfcheck() response = check if check else "OK" elif request_target == 'batt_voltage': response = FlightLib.get_telemetry('body').voltage elif request_target == 'cell_voltage':
def _command_led_test(*args, **kwargs): LedLib.chase(255, 255, 255) time.sleep(2) LedLib.off()