You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
626 B
Python

2 years ago
import asyncio
from mavsdk import System
import time
async def print_connect(drone):
async for state in drone.core.connection_state():
print(f"{state}")
async def run():
drone = System()
await drone.connect(system_address="udp://:14550", timeout=10)
# drone = System(mavsdk_server_address='localhost', port=50053)
# await drone.connect()
print("Connected to drone!")
asyncio.ensure_future(print_connect(drone))
drone.core.connection_state()
while True:
await asyncio.sleep(1)
asyncio.get_event_loop().run_until_complete(run())
print("Finish")