Guest User

Untitled

a guest
Dec 5th, 2021
21
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ###################################################################################
  2. from dronekit import connect, VehicleMode, LocationGlobalRelative, APIException
  3. import time
  4. import socket
  5. #import exceptions
  6. try:
  7.     from exceptions import PendingDeprecationWarning
  8. except ImportError:
  9.     pass
  10. import math
  11. import argparse
  12.  
  13. ###################################################################################
  14.  
  15. def connectMyCopter():
  16.     parser = argparse.ArgumentParser(description='commands')
  17.     parser.add_argument('--connect')
  18.     args = parser.parse_args()
  19.  
  20.     connection_string = args.connect
  21.     baud_rate = 57600
  22.  
  23.     vehicle = connect(connection_string,baud=baud_rate,wait_ready=True)
  24.     return vehicle
  25.  
  26. def arm():
  27.     while vehicle.is_armable==False:
  28.         print ("Waiting for the vehicle to become armable...")
  29.         time.sleep(1)
  30.  
  31.     print("The vehicle is now armable")
  32.     print("**")
  33.  
  34.  
  35.     vehicle.armed=True
  36.     while vehicle.armed==False:
  37.         print("Waiting for drone to become armed...")
  38.         time.sleep(1)
  39.  
  40.     print("Vehicle is now armed...")
  41.     return none
  42.  
  43.  
  44. vehicle = connectMyCopter()
  45. arm()
  46.  
RAW Paste Data