Skip to content

Commit

Permalink
Merge pull request #234 from mavlink/pr-goto
Browse files Browse the repository at this point in the history
Added goto example
  • Loading branch information
JonasVautherin authored Jul 22, 2020
2 parents 7195967 + e76198b commit f03730a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions examples/goto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3

import asyncio
from mavsdk import System


async def run():
drone = System()
await drone.connect(system_address="udp://:14540")

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("Waiting for drone to have a global position estimate...")
async for health in drone.telemetry.health():
if health.is_global_position_ok:
print("Global position estimate ok")
break

print("-- Arming")
await drone.action.arm()

print("-- Taking off")
await drone.action.takeoff()

await asyncio.sleep(1)

await drone.action.goto_location(55.8688660, -4.2851267, 40, 0)

if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())

0 comments on commit f03730a

Please sign in to comment.