Created
June 17, 2018 22:39
-
-
Save khancyr/b055d9afda99cf4395647a71332f1081 to your computer and use it in GitHub Desktop.
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 __future__ import print_function | |
| import pymavlink.mavutil as mavutil | |
| import sys | |
| import time | |
| #if len(sys.argv) != 3: | |
| # print("Usage: %s <ip:udp_port> <system-id>" % (sys.argv[0])) | |
| # print("Receive mavlink heartbeats on specified interface. " | |
| # "Respond with a ping message") | |
| # quit() | |
| srcSystem = 1 #int(sys.argv[2]) | |
| mav_get = mavutil.mavlink_connection( | |
| 'udpin:0.0.0.0:14550', source_system=srcSystem) | |
| mav_send = mavutil.mavlink_connection( | |
| 'tcp:127.0.0.1:5773', source_system=1) | |
| while (True): | |
| msg = mav_get.recv_match(type='GLOBAL_POSITION_INT', blocking=True) | |
| if msg.get_srcSystem() == srcSystem: | |
| print("Message from %d: %s" % (msg.get_srcSystem(), msg)) | |
| mav_send.mav.global_position_int_send(msg.time_boot_ms, msg.lat, msg.lon, msg.alt, msg.relative_alt, msg.vx, msg.vy, msg.vz, msg.hdg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment