scripts: add test script for reading mavlink messages
Signed-off-by: Onur Özkan <work@onurozkan.dev>
This commit is contained in:
1 parent
45e8fe1b44
commit
f25a698483
2 files changed
+17
No files matched your search
@@ -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
|
||||
|
||||
|
||||
Executable
+14
@@ -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]} <serial-device>")
|
||||
|
||||
connection = mavutil.mavlink_connection(sys.argv[1], baud=115200)
|
||||
while message := connection.recv_match(blocking=True):
|
||||
print(message)
|
||||
Reference in new issue
Block a user