Skip to content

Same connection and GPS checks in all examples #456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2022

Conversation

potaito
Copy link
Contributor

@potaito potaito commented Mar 21, 2022

Context: #369 (comment)

A year ago I extended the check prior to arming from

if health.is_global_position_ok

to

if health.is_global_position_ok and health.is_home_position_ok:

because otherwise the PX4 preflight checks might fail if the python scripts are too quickly attempting to arm the drone after it acquired GPS.

Unfortunately I added this patch to only a few examples and not all of them. This PR is making up for that, and it also unifies the connection check at the beginning of almost every script. I don't mind the exact phrasing of the messages and whether it's "drone discovered" or "drone connected", but I think it's good to have it similar in all example scripts.

@potaito
Copy link
Contributor Author

potaito commented Mar 21, 2022

@JonasVautherin please take a look :)

@@ -12,13 +12,13 @@ async def run():
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}")
print(f"-- Connected to drone!")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correctly, {state.uuid} was causing issues with some MAVSDK versions. At least I got errors sometimes trying to run this script. Should we just remove it or is there a new "proper way" to access the UUID?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the UUID is part of the info plugin, I think 👍

Copy link
Collaborator

@JonasVautherin JonasVautherin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@JonasVautherin JonasVautherin merged commit 50a811e into mavlink:main Mar 21, 2022
@potaito potaito deleted the pr-unify-initial-checks branch March 22, 2022 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants