Skip to content

examples: improve goto example #388

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
Sep 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions examples/goto.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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!")
print("Drone discovered!")
break

print("Waiting for drone to have a global position estimate...")
Expand All @@ -32,9 +32,15 @@ async def run():
await drone.action.takeoff()

await asyncio.sleep(1)
flying_alt = absolute_altitude + 20.0 #To fly drone 20m above the ground plane
#goto_location() takes Absolute MSL altitude
await drone.action.goto_location(47.399386, 8.535245, flying_alt, 0)
# To fly drone 20m above the ground plane
flying_alt = absolute_altitude + 20.0
# goto_location() takes Absolute MSL altitude
await drone.action.goto_location(47.397606, 8.543060, flying_alt, 0)

while True:
print("Staying connected, press Ctrl-C to exit")
await asyncio.sleep(1)


if __name__ == "__main__":
loop = asyncio.get_event_loop()
Expand Down