Skip to content

Connection events improperly firing #365

Open
@amzntyshka

Description

@amzntyshka

I've built an application with mavsdk, and one thing I'm noticing is things work fine if the drone is turned on after the script starts, but the connection events do not work correctly if the drone is already on when the script is started. I made a simple asyncio subscriber to test this:

async def recv_connection_state(self):
    async for state in self.drone.core.connection_state():
        if state.is_connected:
            print("Robot discovered!")
            self.connected = True
        else:
            print("Robot disconnected")
            self.connected = False

If I run this code with the robot already on, I get the following output:

Robot discovered!
Robot disconnected
Robot discovered!
Robot disconnected

If the robot is off when the script is started, I get a single

Robot discovered!

message. Not sure if it's relevant but I'm using a telemetry radio as my link. Is this known/intended behavior or a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions