Skip to content

Commit

Permalink
Merge pull request #354 from mavlink/update-examples
Browse files Browse the repository at this point in the history
Update examples following removal of uuid from core plugin
  • Loading branch information
julianoes authored May 26, 2021
2 parents fd6a162 + 6945172 commit 50604c1
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion examples/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 with UUID: {state.uuid}")
print(f"Drone discovered!")
break

print_mode_task = asyncio.ensure_future(print_mode(drone))
Expand Down
2 changes: 1 addition & 1 deletion examples/firmware_version.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 with UUID: {state.uuid}")
print(f"Drone discovered!")
break

info = await drone.info.get_version()
Expand Down
20 changes: 10 additions & 10 deletions examples/follow_me_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from mavsdk.follow_me import (Config, FollowMeError, TargetLocation)

default_height = 8.0 #in Meters
follow_distance = 2.0 #in Meters, this is the distance that the drone will remain away from Target while following it
#Direction relative to the Target
follow_distance = 2.0 #in Meters, this is the distance that the drone will remain away from Target while following it
#Direction relative to the Target
#Options are NONE, FRONT, FRONT_LEFT, FRONT_RIGHT, BEHIND
direction = Config.FollowDirection.BEHIND
responsiveness = 0.02
Expand All @@ -19,27 +19,27 @@
async def fly_drone():
drone = System()
await drone.connect(system_address="udp://:14540")

#This waits till a mavlink based drone is connected
async for state in drone.core.connection_state():
if state.is_connected:
print(f"-- Connected to drone with UUID: {state.uuid}")
print(f"-- Connected to drone!")
break

#Checking if Global Position Estimate is ok
async for global_lock in drone.telemetry.health():
if global_lock.is_global_position_ok:
print("-- Global position state is good enough for flying.")
break

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

#Follow me Mode requires some configuration to be done before starting the mode
conf = Config(default_height, follow_distance, direction, responsiveness)
await drone.follow_me.set_config(conf)

print ("-- Taking Off")
await drone.action.takeoff()
await asyncio.sleep(8)
Expand All @@ -54,12 +54,12 @@ async def fly_drone():
print ("-- Following Target")
await drone.follow_me.set_target_location(target)
await asyncio.sleep(2)

#Stopping the follow me mode
print ("-- Stopping Follow Me Mode")
await drone.follow_me.stop()
await asyncio.sleep(5)

print ("-- Landing")
await drone.action.land()

Expand Down
2 changes: 1 addition & 1 deletion examples/geofence.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async def run():
print("Waiting for drone...")
async for state in drone.core.connection_state():
if state.is_connected:
print(f"Drone discovered with UUID: {state.uuid}")
print(f"Drone discovered!")
break

# Fetch the home location coordinates, in order to set a boundary around the home location
Expand Down
2 changes: 1 addition & 1 deletion 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 with UUID: {state.uuid}")
print(f"Drone discovered!")
break

print("Waiting for drone to have a global position estimate...")
Expand Down
2 changes: 1 addition & 1 deletion examples/manual_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def manual_controls():
# This waits till a mavlink based drone is connected
async for state in drone.core.connection_state():
if state.is_connected:
print(f"-- Connected to drone with UUID: {state.uuid}")
print(f"-- Connected to drone!")
break

# Checking if Global Position Estimate is ok
Expand Down
2 changes: 1 addition & 1 deletion examples/mission.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 with UUID: {state.uuid}")
print(f"Drone discovered!")
break

print_mission_progress_task = asyncio.ensure_future(print_mission_progress(drone))
Expand Down
2 changes: 1 addition & 1 deletion examples/offboard_attitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,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 with UUID: {state.uuid}")
print(f"Drone discovered!")
break

print("-- Arming")
Expand Down
2 changes: 1 addition & 1 deletion examples/offboard_velocity_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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 with UUID: {state.uuid}")
print(f"Drone discovered!")
break

print("-- Arming")
Expand Down
2 changes: 1 addition & 1 deletion examples/offboard_velocity_ned.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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 with UUID: {state.uuid}")
print(f"Drone discovered!")
break

print("-- Arming")
Expand Down
2 changes: 1 addition & 1 deletion examples/takeoff_and_land.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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 with UUID: {state.uuid}")
print(f"Drone discovered!")
break

print("Waiting for drone to have a global position estimate...")
Expand Down
2 changes: 1 addition & 1 deletion examples/telemetry_flight_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async def print_flight_mode():
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"Drone discovered!")
break

async for flight_mode in drone.telemetry.flight_mode():
Expand Down
2 changes: 1 addition & 1 deletion examples/telemetry_takeoff_and_land.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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 with UUID: {state.uuid}")
print(f"Drone discovered!")
break

# Start parallel tasks
Expand Down
2 changes: 1 addition & 1 deletion examples/tune.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 with UUID: {state.uuid}")
print(f"Drone discovered!")
break

song_elements = []
Expand Down

0 comments on commit 50604c1

Please sign in to comment.