Created
March 19, 2023 17:32
-
-
Save ericjohnson97/674452558c2426557e19cf50cb297ab6 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
import requests | |
import argparse | |
import json | |
import time | |
def print_message(url, sysid=1, compid=1, message="GLOBAL_POSITION_INT"): | |
url = f"https://{url}/mavlink/vehicles/{sysid}/components/{compid}/messages/{message}" | |
# make a request to the mavlink2rest server | |
r = requests.get(url) | |
# parse the response | |
data = json.loads(r.text) | |
# print the data | |
print(json.dumps(data, indent=2)) | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser(description='mavlink2rest example') | |
parser.add_argument('--host', default='sim.intelligentquads.com', help='host url') | |
parser.add_argument('--uuid', required=True, help='uuid for intelligentquads simulation') | |
parser.add_argument('--sysid', default=1, help='sysid') | |
parser.add_argument('--compid', default=1, help='compid') | |
parser.add_argument('--message', default='GLOBAL_POSITION_INT', help='message') | |
args = parser.parse_args() | |
url = f"{args.host}/{args.uuid}" | |
print_message(url, args.sysid, args.compid, args.message) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment