-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathspecific_msg.py
More file actions
29 lines (25 loc) · 938 Bytes
/
Copy pathspecific_msg.py
File metadata and controls
29 lines (25 loc) · 938 Bytes
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
"""
Example of how to connect pymavlink to an autopilot via an UDP connection
"""
import time
# Import mavutil
from pymavlink import mavutil
import sys
# Create the connection
# If using a companion computer
# the default connection is available
# at ip 192.168.2.1 and the port 14550
# Note: The connection is done with 'udpin' and not 'udpout'.
# You can check in http:192.168.2.2:2770/mavproxy that the communication made for 14550
# uses a 'udpbcast' (client) and not 'udpin' (server).
# If you want to use QGroundControl in parallel with your python script,
# it's possible to add a new output port in http:192.168.2.2:2770/mavproxy as a new line.
# E.g: --out udpbcast:192.168.2.255:yourport
master = mavutil.mavlink_connection('tcp:127.0.0.1:5762')
# Get some information !
while True:
try:
print(master.recv_match(type = 'LOCAL_POSITION_NED',blocking=True))
except:
pass
time.sleep(0.1)