def do_GET(self): self.send_response(200) self.send_header("Content-type", "text/html") self.end_headers() drone = Drone() message = drone.connect() drone.command(self.path[1:]) print(message) self.wfile.write( bytes("<html><head><title>Title goes here.</title></head>", "utf-8")) self.wfile.write(bytes("<body><p>This is a test.</p>", "utf-8")) self.wfile.write( bytes("<p>Drone is not connected %s</p>" % message, "utf-8")) self.wfile.write(bytes("</body></html>", "utf-8")) return
# test.download_mission() # print "Preparing mission" # test.prepare_mission() # print "Uploading mission" # test.upload_mission() # print "oops" # raw_input("Press enter to begin arming and taking off") # test.arm() # test.takeoff() # test.begin_mission() # test.simple_goto(waypoint_location) # time.sleep(60) test.connect() test.run() test.wait() test.close() # while True: # print "Current Waypoint: %s" % test.vehicle.commands.next # print "command: %s" % test.vehicle.commands[test.vehicle.commands.next].command # print "Number of Waypoints: %s" % test.vehicle.commands.count # print test.distance_to_current_waypoint() # time.sleep(1) # i=0 # while True: # print "useless loop %s" % i # i+=1
""" Contrôler à l'aide du clavier un AR Drone 2.0 """ import sys sys.path.append("../") import pygame from drone import Drone from time import sleep if len(sys.argv) != 2: print "Usage : ./pc_command.py [speed]\n[speed] is between 0 and 10, but for a basic test, don't go over 4." sys.exit() d = Drone(False, speed=float(sys.argv[1])) d.connect() commands = {pygame.K_z:d.forward, pygame.K_s:d.backward, pygame.K_d:d.right, pygame.K_q:d.left, pygame.K_UP:d.up, pygame.K_DOWN:d.down, pygame.K_LEFT:d.rLeft, pygame.K_RIGHT:d.rRight, pygame.K_SPACE:d.takeOff, pygame.K_RETURN:d.land, pygame.K_r:d.resetMagnetometer } print "Commands : \n\ Forward, backward, right, left : zqsd.\n\ Up, down : Directionnal keys up/down.\n\ Rotate right / left : Directionnal keys left, right\n\ Take off : space\n\ Land : enter\n\ Reset magnetometer : r\n\ To quit : escape key."
# test.prepare_mission() # print "Uploading mission" # test.upload_mission() # print "oops" # raw_input("Press enter to begin arming and taking off") # test.arm() # test.takeoff() # test.begin_mission() # test.simple_goto(waypoint_location) # time.sleep(60) test.connect() test.run() test.wait() test.close() # while True: # print "Current Waypoint: %s" % test.vehicle.commands.next # print "command: %s" % test.vehicle.commands[test.vehicle.commands.next].command # print "Number of Waypoints: %s" % test.vehicle.commands.count # print test.distance_to_current_waypoint() # time.sleep(1) # i=0