From f8389f24c4eaee1f195a84f687d5cf42914b3f3f Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 23 Jul 2020 13:21:09 +0200 Subject: [PATCH 1/2] examples: add note about offboard attitude --- examples/offboard_attitude.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/offboard_attitude.py b/examples/offboard_attitude.py index ea9baaf7..1ea78276 100755 --- a/examples/offboard_attitude.py +++ b/examples/offboard_attitude.py @@ -1,5 +1,9 @@ #!/usr/bin/env python3 +# Warning: Only try this in simulation! +# The direct attitude interface is a low level interface to be used +# with caution. On real vehicles the thrust values are likely not +# adjusted properly and you need to close the loop using altitude. import asyncio From 1accab1cc2d82c686229303aefb25bed957df3af Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 23 Jul 2020 13:21:28 +0200 Subject: [PATCH 2/2] examples: go up first, and land again --- examples/offboard_attitude.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/offboard_attitude.py b/examples/offboard_attitude.py index 1ea78276..365810ee 100755 --- a/examples/offboard_attitude.py +++ b/examples/offboard_attitude.py @@ -39,6 +39,10 @@ async def run(): await drone.action.disarm() return + print("-- Go up at 70% thrust") + await drone.offboard.set_attitude(Attitude(0.0, 0.0, 0.0, 0.7)) + await asyncio.sleep(2) + print("-- Roll 30 at 60% thrust") await drone.offboard.set_attitude(Attitude(30.0, 0.0, 0.0, 0.6)) await asyncio.sleep(2) @@ -47,7 +51,7 @@ async def run(): await drone.offboard.set_attitude(Attitude(-30.0, 0.0, 0.0, 0.6)) await asyncio.sleep(2) - print("-- Roll 0 at 60% thrust") + print("-- Hover at 60% thrust") await drone.offboard.set_attitude(Attitude(0.0, 0.0, 0.0, 0.6)) await asyncio.sleep(2) @@ -58,6 +62,8 @@ async def run(): print(f"Stopping offboard mode failed with error code: \ {error._result.result}") + await drone.action.land() + if __name__ == "__main__": loop = asyncio.get_event_loop()