Skip to content

Commit 0d8ca14

Browse files
Merge pull request mavlink#388 from mavlink/pr-improve-goto
examples: improve goto example
2 parents ef0a72a + dd12840 commit 0d8ca14

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

examples/goto.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async def run():
1111
print("Waiting for drone to connect...")
1212
async for state in drone.core.connection_state():
1313
if state.is_connected:
14-
print(f"Drone discovered!")
14+
print("Drone discovered!")
1515
break
1616

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

3434
await asyncio.sleep(1)
35-
flying_alt = absolute_altitude + 20.0 #To fly drone 20m above the ground plane
36-
#goto_location() takes Absolute MSL altitude
37-
await drone.action.goto_location(47.399386, 8.535245, flying_alt, 0)
35+
# To fly drone 20m above the ground plane
36+
flying_alt = absolute_altitude + 20.0
37+
# goto_location() takes Absolute MSL altitude
38+
await drone.action.goto_location(47.397606, 8.543060, flying_alt, 0)
39+
40+
while True:
41+
print("Staying connected, press Ctrl-C to exit")
42+
await asyncio.sleep(1)
43+
3844

3945
if __name__ == "__main__":
4046
loop = asyncio.get_event_loop()

0 commit comments

Comments
 (0)