Last active
December 21, 2021 06:45
-
-
Save AmitGupta7580/1c82efd5bea99cca64649aa61f08b05a 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
#!/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/ttyUSB0") | |
print("Waiting for drone to connect...") | |
async for state in drone.core.connection_state(): | |
if state.is_connected: | |
print(f"Drone discovered!") | |
break | |
print("-- Arming") | |
await drone.action.arm() | |
print("-- Taking off") | |
await drone.action.takeoff() | |
await asyncio.sleep(10) | |
print("-- Landing") | |
await drone.action.land() | |
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