radius = width / 3 down = False screen = pygame.display.set_mode((width, height)) center = width / 2, height / 2 joy = width / 2, height / 2 last_decay = 0 draw_joystick(center, joy, radius) print "connecting to drone..." if SIM: vehicle = connect('127.0.0.1:14551', wait_ready=True) else: vehicle = connect('0.0.0.0:14550', wait_ready=True) dd = DroneDirect(vehicle, joystick_feel=JOYSTICK_FEEL) dd.take_control() if SIM: #arm and takeoff drone - DO NOT USE THIS ON A REAL DRONE ONLY IN SIMULATION if vehicle.armed == False: # Don't let the user try to arm until autopilot is ready print " Waiting for vehicle to initialise..." while not vehicle.is_armable: time.sleep(1) vehicle.armed = True print 'Vehicle Armed' dd.takeoff() x, y = 0, 0 try: while running:
''' from dronekit import * from dronedirect import DroneDirect SIM = True print "connecting to drone..." if SIM: vehicle = connect('127.0.0.1:14551', wait_ready=True) else: vehicle = connect('0.0.0.0:14550', wait_ready=True) # connecting from GCS #vehicle = connect('udpout:127.0.0.1:14560', wait_ready=True) #connecting from onboard solo dd = DroneDirect(vehicle) dd.take_control() if SIM: #arm and takeoff drone - DO NOT USE THIS ON A REAL DRONE ONLY IN SIMULATION if vehicle.armed == False: # Don't let the user try to arm until autopilot is ready print " Waiting for vehicle to initialise..." while not vehicle.is_armable: time.sleep(1) vehicle.armed = True print 'Vehicle Armed' dd.takeoff() try: ''' YOUR CODE HERE
radius = width / 3 down = False screen = pygame.display.set_mode((width, height)) center = width / 2, height / 2 joy = width / 2, height / 2 last_decay = 0 draw_joystick(center, joy, radius) print "connecting to drone..." if SIM: vehicle = connect('127.0.0.1:14551', wait_ready=True) else: vehicle = connect('0.0.0.0:14550', wait_ready=True) sd = DroneDirect(vehicle, joystick_feel=JOYSTICK_FEEL) sd.take_control() if SIM: #arm and takeoff drone - DO NOT USE THIS ON A REAL DRONE ONLY IN SIMULATION if vehicle.armed == False: # Don't let the user try to arm until autopilot is ready print " Waiting for vehicle to initialise..." while not vehicle.is_armable: time.sleep(1) vehicle.armed = True print 'Vehicle Armed' sd.takeoff() x, y = 0, 0 try: while running: