Skip to content

can't connect to QGC via UDP connection using mavsdk #714

@hilaelb

Description

@hilaelb

I want to connect to QGC, i using this code, but QGC still shows on the main screen disconnected. why is this happen?

import asyncio
from mavsdk import System

async def run():
# Create a MAVSDK system object
drone = System()

# Connect to the drone via QGC's UDP port (assuming QGC is configured to listen on 14550)
await drone.connect(system_address="udp://192.168.168.95:14550")

print("Waiting for drone to connect...")
async for state in drone.core.connection_state():
    if state.is_connected:
        print(f"Drone discovered with UUID: {state.uuid}")
        break

print("Drone connected!")

# Listen for heartbeat messages
async for heartbeat in drone.telemetry.heartbeat():
    print(f"Heartbeat: {heartbeat}")

if name == "main":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions