Skip to content

COMMAND_DENIED issue when attempting do_orbit() command for fixedwing #363

@patrickcgray

Description

@patrickcgray

I've been trying to run the do_orbit command for a fixed wing drone that I'm developing. This is running on a raspberry pi and a pixhawk. I am not tied to this command I just need a command that will get my plane to go to a specific lat,lon,alt. Is this the correct one? My code here is basically the same as the goto.py example but using the do_orbit command.

#!/usr/bin/env python3

import asyncio
from mavsdk import System
import mavsdk

async def run():
    drone = System()
    await drone.connect(system_address="serial:///dev/serial0:57600")

    print("Waiting for drone to connect...")
    async for state in drone.core.connection_state():
        if state.is_connected:
            print(f"Drone discovered!")
            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("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.do_orbit(20, 3, mavsdk.action.OrbitYawBehavior(2), 34.715, -76.6730, 20.0)

    # i've also tried this goto but it doesn't do anything
    #await drone.action.goto_location(34.715048, -76.673046, 10, 0)

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

And this is the output and error:

Waiting for mavsdk_server to be ready...
Connected to mavsdk_server!
Waiting for drone to connect...
Drone discovered!
Waiting for drone to have a global position estimate...
Global position estimate ok
-- Arming
-- Taking off
Traceback (most recent call last):
  File "goto.py", line 43, in <module>
    loop.run_until_complete(run())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "goto.py", line 38, in run
    await drone.action.do_orbit(20, 3, mavsdk.action.OrbitYawBehavior(2), 34.715, -76.6730, 20.0)
  File "/home/pi/.local/lib/python3.7/site-packages/mavsdk/action.py", line 591, in do_orbit
    raise ActionError(result, "do_orbit()", radius_m, velocity_ms, yaw_behavior, latitude_deg, longitude_deg, absolute_altitude_m)
mavsdk.action.ActionError: COMMAND_DENIED: 'Command Denied'; origin: do_orbit(); params: (20, 3, <OrbitYawBehavior.UNCONTROLLED: 2>, 34.715, -76.673, 20.0)
Exception ignored in: <function System.__del__ at 0xb50ca108>
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/mavsdk/system.py", line 56, in __del__
  File "/home/pi/.local/lib/python3.7/site-packages/mavsdk/system.py", line 92, in _stop_mavsdk_server
ImportError: sys.meta_path is None, Python is likely shutting down

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions