-
Notifications
You must be signed in to change notification settings - Fork 0
/
attribut_fetcher.py
53 lines (33 loc) · 1.34 KB
/
attribut_fetcher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
###########################DEPENDENCIES###############################
from dronekit import connect, VehicleMode, LocationGlobalRelative, APIException
import time
import socket
import exceptions
import math
import argparse
###########################FUNCTIONS##################################
def connectMyCopter():
parser = argparse.ArgumentParser(description='commands')
parser.add_argument('--connect')
args = parser.parse_args()
connection_string = args.connect
if not connection_string:
import dronekit_sitl
sitl = dronekit_sitl.start_default()
connection_string = sitl.connection_string()
vehicle = connect(connection_string,wait_ready=True)
return vehicle
###########################MAIN exec###################################
vehicle = connectMyCopter()
vehicle.wait_ready('autopilot_version')
print('Autopilot version is: %s'%vehicle.version)
print('Supports set attitude from companion: %s'%vehicle.capabilities.set_attitude_target_local_ned)
print('position is: %s'%vehicle.location.global_relative_frame)
print('attitude is: %s'%vehicle.attitude)
print('velocity is: %s'%vehicle.velocity) #north, east, down
print('is the drone armable: %s'%vehicle.is_armable)
print('ground speed: %s'%vehicle.groundspeed)
print('Mode: %s'%vehicle.mode.name)
print('Armed: %s'%vehicle.armed)
print('ekf ok: %s'%vehicle.ekf_ok)
vehicle.close()