Command Denied: origin: arm(); params: () - I am getting this error

Hello,

I own a Pixhawk Orange Cube and a telemetry transceiver device (RFD868x). The telemetry device is connected to my computer at USB0.

First, I start the MAVSDK server with the following command:

bash

./mavsdk_server -p 50051 serial:///dev/ttyUSB0:57600

Then, when I try to arm the drone with this simple code:

python

Kodu kopyala

import mavsdk

async def run():
    # Specify the MAVSDK server address
    drone = mavsdk.System(mavsdk_server_address="localhost", port=50051)
    await drone.connect(system_address="serial:///dev/ttyUSB0:57600")

    async for state in drone.core.connection_state():
        if state.is_connected:
            print("Drone connected")
            break

    # Arm the drone
    print("Arming the drone...")
    try:
        action = drone.action  # Access the Action class
        await action.arm()
        print("Drone armed successfully")
    except mavsdk.action.ActionError as e:
        print(f"Failed to arm the drone: {e}")

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

I am unable to arm the drone. The output is:

Drone connected
Arming the drone…
Failed to arm the drone: COMMAND_DENIED: ‘Command Denied’; origin: arm(); params: ()


However, I can arm the drone and execute commands using QGroundControl or Mission Planner.

mavsdk_server
./mavsdk_server_musl_x86_64 -p 50051 serial:///dev/ttyUSB0:57600
[09:54:56|Info ] MAVSDK version: v2.12.3 (mavsdk_impl.cpp:26)
[09:54:56|Info ] Waiting to discover system on serial:///dev/ttyUSB0:57600… (connection_initiator.h:20)
[09:54:56|Debug] New system ID: 1 Comp ID: 1 (mavsdk_impl.cpp:720)
[09:54:56|Debug] Component Autopilot (1) added. (system_impl.cpp:366)
[09:54:57|Debug] Discovered 1 component(s) (system_impl.cpp:509)
[09:54:57|Info ] System discovered (connection_initiator.h:62)
[09:54:57|Info ] Server started (grpc_server.cpp:169)
[09:54:57|Info ] Server set to listen on 0.0.0.0:50051 (grpc_server.cpp:170)
[09:54:57|Warn ] Vehicle type changed (new type: 1, old type: 0) (system_impl.cpp:217)
[09:55:16|Debug] MAVLink: critical: PreArm: Waiting for RC (system_impl.cpp:243)
[09:55:17|Debug] MAVLink: critical: Arm: Waiting for RC (system_impl.cpp:243)

I found the solution to the problem. The reason for not being able to arm was the absence of the RC (joystick). When the controller is connected, it arms successfully.

1 Like