Skip to content

Instantly share code, notes, and snippets.

@dbaldwin
Created August 5, 2016 22:26
Show Gist options
  • Save dbaldwin/ba2057c09244957b84c834aa726f03ee to your computer and use it in GitHub Desktop.
Save dbaldwin/ba2057c09244957b84c834aa726f03ee to your computer and use it in GitHub Desktop.
Basic script to change flight mode to STABILIZE with DroneKit
from dronekit import connect, VehicleMode
# Parse connection args
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--connect', default='127.0.0.1:14550')
args = parser.parse_args()
# Connect to vehicle
print 'Connecting to vehicle on: %s' % args.connect
vehicle = connect(args.connect, baud=57600, wait_ready=True)
# Change vehicle flight mode
print("Changing flight mode to stabilize")
vehicle.mode = VehicleMode("STABILIZE")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment