Skip to content

Instantly share code, notes, and snippets.

@AmitGupta7580
Last active December 21, 2021 06:47
Show Gist options
  • Save AmitGupta7580/b1493a3a2509cdedd5f190c0e669ebac to your computer and use it in GitHub Desktop.
Save AmitGupta7580/b1493a3a2509cdedd5f190c0e669ebac to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import asyncio
from mavsdk import System
async def run():
print("Code Initialized---")
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 position in drone.telemetry.position():
print(position)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment