Skip to content

system.core.connection_state() gives two status updates instead of one #463

Open
@sienks

Description

@sienks

When connecting to either gazebo sim or a flight controller over a serial connection I am given two updates for the connection state.

import asyncio
from mavsdk import System

system = System()

async def check_connection_state():
    async for connection_state in system.core.connection_state():
        print(connection_state)

async def main():
    await system.connect("udp://:14540")
    asyncio.create_task(check_connection_state())

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    try:
        loop.create_task(main())
        loop.run_forever()
    finally:
        loop.stop()
        loop.close()

Output:

ConnectionState: [is_connected: True]
ConnectionState: [is_connected: True]

This only happens for the initial connection, if I disconnect gazebo or a FC and then reconnect it I am given a single update result.
Note: I am using mavsdk 1.2.0

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