Created
February 21, 2017 20:30
-
-
Save donghee/07ca13d9064a5c19863f275f42d8edc3 to your computer and use it in GitHub Desktop.
Pymavlink Receive Match
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymavlink import mavutil | |
# python /usr/local/bin/mavproxy.py --mav=/dev/tty.usbserial-DN01WM7R --baudrate 57600 --out udp:127.0.0.1:14540 --out udp:127.0.0.1:14550 | |
connection_string = '127.0.0.1:14540' | |
mav = mavutil.mavlink_connection('udp:'+connection_string) | |
mav.wait_heartbeat() | |
print("HEARTBEAT OK\n") | |
print(mav.recv_match(type='SYS_STATUS', blocking=True)) | |
print("asking for parameters") | |
mav.param_fetch_all() | |
print(mav.recv_match(type="PARAM_VALUE",blocking=True)) | |
while True: | |
m = mav.recv_match(type="PARAM_VALUE",blocking=True,timeout=1) | |
print(m) | |
if m is None: | |
break | |
#print("asking for data streams") | |
#mav.mav.request_data_stream_send(mav.target_system, mav.target_component, | |
# mavutil.mavlink.MAV_DATA_STREAM_ALL, 4, 1) | |
mav.mav.command_long_send(1, 1, mavutil.mavlink.MAV_CMD_DO_SET_MODE, 0, mavutil.mavlink.MAV_MODE_MANUAL_ARMED, 0, 0, 0, 0, 0, 0) | |
# https://pixhawk.ethz.ch/mavlink/#HEARTBEAT | |
print(mav.recv_match(type='???', blocking=True)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment