Created
December 21, 2021 06:51
-
-
Save AmitGupta7580/0c4f53e11b400a4bf9e796940a312cdb to your computer and use it in GitHub Desktop.
get_flight_mode.py
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
#!/usr/bin/env python3 | |
import asyncio | |
from mavsdk import System | |
async def print_flight_mode(): | |
drone = System() | |
await drone.connect(system_address="serial:///dev/ttyUSB1") | |
print("Waiting for drone to connect...") | |
async for state in drone.core.connection_state(): | |
if state.is_connected: | |
print(f"Drone discovered!") | |
break | |
async for flight_mode in drone.telemetry.flight_mode(): | |
print("FlightMode:", flight_mode) | |
if __name__ == "__main__": | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(print_flight_mode()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment