diff --git a/.gitignore b/.gitignore index ad67955..9393706 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ target # These are backup files generated by rustfmt **/*.rs.bk +# Python bytecode caches +__pycache__/ + # MSVC Windows builds of rustc generate these, which store debugging information *.pdb diff --git a/scripts/read-mavlink.py b/scripts/read-mavlink.py new file mode 100755 index 0000000..674d1d0 --- /dev/null +++ b/scripts/read-mavlink.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +# NixOS: nix-shell -p 'python313.withPackages (ps: [ ps.pymavlink ps.pyserial ])' --run './scripts/read-mavlink.py /dev/ttyUSB0' + +import sys + +from pymavlink import mavutil + +if len(sys.argv) != 2: + sys.exit(f"usage: {sys.argv[0]} ") + +connection = mavutil.mavlink_connection(sys.argv[1], baud=115200) +while message := connection.recv_match(blocking=True): + print(message)