Skip to content

Instantly share code, notes, and snippets.

@djnugent
Created June 18, 2015 18:06
Show Gist options
  • Save djnugent/d65e6adb24344dcdf970 to your computer and use it in GitHub Desktop.
Save djnugent/d65e6adb24344dcdf970 to your computer and use it in GitHub Desktop.
api.stop usage
import time
# First get an instance of the API endpoint
api = local_connect()
# Get the connected vehicle (currently only one vehicle can be returned).
v = api.get_vehicles()[0]
#wait here until mavproxy tells us to exit
while not api.exit:
time.sleep(0.2)
#This is our clean up code
#close connections and files
print 'sleeping for 5 seconds'
time.sleep(5)
api.stop() #kill the script
print "This shouldn't print"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment