Skip to content

Commit

Permalink
Merge pull request #392 from mavlink/pr-update-to-v0.44.0
Browse files Browse the repository at this point in the history
Update MAVSDK to v0.44.0
  • Loading branch information
JonasVautherin authored Sep 29, 2021
2 parents ab4b774 + 31c7e94 commit ded17f0
Show file tree
Hide file tree
Showing 26 changed files with 6,564 additions and 1,572 deletions.
2 changes: 1 addition & 1 deletion MAVSDK_SERVER_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.41.0
v0.44.0
Empty file added examples/follow2.py
Empty file.
62 changes: 62 additions & 0 deletions examples/offboard_position_velocity_ned.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env python3

import asyncio

from mavsdk import System
from mavsdk.offboard import (PositionNedYaw, VelocityNedYaw, OffboardError)

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("-- Arming")
await drone.action.arm()

print("-- Setting initial setpoint")
await drone.offboard.set_position_ned(PositionNedYaw(0.0, 0.0, 0.0, 0.0))

print("-- Starting offboard")
try:
await drone.offboard.start()
except OffboardError as error:
print(f"Starting offboard mode failed with error code: {error._result.result}")
print("-- Disarming")
await drone.action.disarm()
return


async def print_z_velocity(drone):
async for odom in drone.telemetry.position_velocity_ned():
print(f"{odom.velocity.north_m_s} {odom.velocity.down_m_s}")

asyncio.ensure_future(print_z_velocity(drone))

print("-- Go 0m North, 0m East, -10m Down within local coordinate system")
#await drone.offboard.set_position_velocity_ned(PositionNedYaw(0.0, 0.0, -10.0, 0.0),VelocityNedYaw(0.0,0.0,-1.0,0.0))
await drone.offboard.set_position_ned(PositionNedYaw(0.0, 0.0, -10.0, 0.0))
await asyncio.sleep(10)

print("-- Go 10m North, 0m East, 0m Down within local coordinate system")
await drone.offboard.set_position_ned(PositionNedYaw(50.0, 0.0, -10.0, 0.0))
#await drone.offboard.set_position_velocity_ned(PositionNedYaw(50.0, 0.0, -10.0, 0.0),VelocityNedYaw(1.0,0.0,0.0,0.0))
await asyncio.sleep(20)

await drone.action.land()


print("-- Stopping offboard")
try:
await drone.offboard.stop()
except OffboardError as error:
print(f"Stopping offboard mode failed with error code: {error._result.result}")


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

0 comments on commit ded17f0

Please sign in to comment.