print("starting connection") # self.connection.start() super().start() # Only required if they do threaded # while self._in_mission: # pass self.stop_log() if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--uri', type=str, default='radio://0/80/2M', help="uri of crazyflie, i.e. 'radio://0/80/2M'") args = parser.parse_args() # create the connection conn = CrazyflieConnection('{}'.format(args.uri)) # create the drone drone = VelocityFlyer(conn) # a short delay and the start the script time.sleep(2) drone.start()
self.start_log("Logs", "NavLog.txt") # self.connect() print("starting connection") # self.connection.start() super().start() # Only required if they do threaded # while self.in_mission: # pass self.stop_log() if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--port', type=int, default=3001, help='Port number') parser.add_argument('--host', type=str, default='0.0.0.0', help="host address, i.e. '127.0.0.1'") args = parser.parse_args() # conn = MavlinkConnection('tcp:{0}:{1}'.format(args.host, args.port)) # conn = WebSocketConnection('ws://{0}:{1}'.format(args.host, args.port)) uri = 'radio://0/80/2M' conn = CrazyflieConnection(uri) drone = BackyardFlyer(conn) time.sleep(2) drone.start()
print('space') if key.char == 'l': if self.flight_state == States.WAYPOINT or self.flight_state == States.TAKEOFF: self.landing_transition() if key.char == 'q': #self.mc.start_turn_left(self.ang_velocity) print('q') if key.char == 'e': #self.mc.start_turn_right(self.ang_velocity) print('e') def on_release(self, key): pass #self.mc.stop() #print(key.char + ' released') #:print("") if __name__ == "__main__": conn = CrazyflieConnection('radio://0/80/250K') drone = KraziDrone(conn) time.sleep(2) drone.start() with keyboard.Listener(on_press=drone.on_press, on_release=drone.on_release) as listener: listener.join()
self.in_mission = False self.flight_state = States.MANUAL def start(self): """This method is provided 1. Open a log file 2. Start the drone connection 3. Close the log file """ print("Creating log file") self.start_log("Logs", "NavLog.txt") print("starting connection") self.connection.start() print("Closing log file") self.stop_log() if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--port', type=int, default=5760, help='Port number') parser.add_argument('--host', type=str, default='127.0.0.1', help="host address, i.e. '127.0.0.1'") args = parser.parse_args() # conn = MavlinkConnection('tcp:127.0.0.1:5760', threaded=False, PX4=False) conn = CrazyflieConnection('radio://0/80/2M', velocity= 0.3) # conn = WebSocketConnection('ws://{0}:{1}'.format(args.host, args.port)) drone = BackyardFlyer(conn) time.sleep(2) drone.start()