: Unable to Control Drone via MAVSDK, Though QGC Works Fine

Hello all,

I’m currently experiencing an issue with MAVSDK where I can successfully connect and retrieve telemetry data (like battery levels) from my drone, but I’m unable to send commands for actions like arming or mode switching. Notably, I don’t encounter these control issues when using QGroundControl (QGC).

Details:

  1. Connection Setup: I connect to my drone using telemetry via udp://:19856.
  2. QGC Status: No issues. I can control the drone and retrieve telemetry data.
  3. MAVSDK Status: I can fetch data, but commands to control the drone (e.g., arming or switching to offboard mode) timeout.

Error Messages: When attempting to arm the drone using MAVSDK, I get the following error:

mavsdk.action.ActionError: TIMEOUT: 'Timeout'; origin: arm(); params: ()

Similarly, when trying to switch to offboard mode:

mavsdk.offboard.OffboardError: TIMEOUT: 'Timeout'; origin: start(); params: ()

I also notice some grpc related errors and an Event loop is closed error.

Environment:

  • MAVSDK-Python version: 1.4.8
  • Drone firmware version: 1.14.0beta
  • Operating System: Ubuntu
  • Programming Language: Python3.8

Would appreciate any insights or solutions on this issue. Thanks in advance!

Please start the mavsdk_server separately as explained in MAVSDK-Python API reference — MAVSDK-Python 1.4.9 documentation and then paste the output of it here. That might tell us more.

here is the output of mavsdk_serve:

rana@rana-Legion-7-16IAX7:~$ ~/.local/lib/python3.8/site-packages/mavsdk/bin/mavsdk_server udp://:19856
[03:36:37|Info ] MAVSDK version: v1.4.17 (mavsdk_impl.cpp:20)
[03:36:37|Info ] Waiting to discover system on udp://:19856... (connection_initiator.h:20)
[03:36:38|Info ] New system on: 192.168.144.12:10847 (with sysid: 1) (udp_connection.cpp:192)
[03:36:38|Debug] New: System ID: 1 Comp ID: 1 (mavsdk_impl.cpp:496)
[03:36:38|Debug] Component Autopilot (1) added. (system_impl.cpp:377)
[03:36:38|Warn ] Vehicle type changed (new type: 13, old type: 0) (system_impl.cpp:225)
[03:36:38|Debug] Discovered 1 component(s) (system_impl.cpp:578)
[03:36:38|Info ] System discovered (connection_initiator.h:63)
[03:36:38|Info ] Server started (grpc_server.cpp:53)
[03:36:38|Info ] Server set to listen on 0.0.0.0:50051 (grpc_server.cpp:54)
[03:36:38|Warn ] sending again after 0.504471 s, retries to do: 3  (520). (mavlink_command_sender.cpp:287)
[03:36:39|Warn ] sending again after 1.00775 s, retries to do: 2  (520). (mavlink_command_sender.cpp:287)
[03:36:39|Warn ] sending again after 1.51062 s, retries to do: 1  (520). (mavlink_command_sender.cpp:287)
[03:36:40|Error] Retrying failed (520) (mavlink_command_sender.cpp:307)
[03:36:42|Warn ] sending again, retries to do: 3  (CAL_GYRO0_ID). (mavlink_parameters.cpp:1291)
[03:36:42|Warn ] sending again, retries to do: 2  (CAL_GYRO0_ID). (mavlink_parameters.cpp:1291)
[03:36:43|Warn ] sending again, retries to do: 1  (CAL_GYRO0_ID). (mavlink_parameters.cpp:1291)
[03:36:43|Error] Error: Retrying failed get param busy timeout: CAL_GYRO0_ID (mavlink_parameters.cpp:1320)
[03:36:43|Error] Error: Param for gyro cal failed. (telemetry_impl.cpp:1569)
[03:36:44|Warn ] sending again, retries to do: 3  (CAL_ACC0_ID). (mavlink_parameters.cpp:1291)
[03:36:44|Warn ] sending again, retries to do: 2  (CAL_ACC0_ID). (mavlink_parameters.cpp:1291)
[03:36:45|Warn ] sending again, retries to do: 1  (CAL_ACC0_ID). (mavlink_parameters.cpp:1291)
[03:36:45|Error] Error: Retrying failed get param busy timeout: CAL_ACC0_ID (mavlink_parameters.cpp:1320)
[03:36:45|Error] Error: Param for accel cal failed. (telemetry_impl.cpp:1580)
[03:36:46|Warn ] sending again, retries to do: 3  (CAL_MAG0_ID). (mavlink_parameters.cpp:1291)
[03:36:46|Warn ] sending again, retries to do: 2  (CAL_MAG0_ID). (mavlink_parameters.cpp:1291)
[03:36:47|Warn ] sending again, retries to do: 1  (CAL_MAG0_ID). (mavlink_parameters.cpp:1291)
[03:36:47|Error] Error: Retrying failed get param busy timeout: CAL_MAG0_ID (mavlink_parameters.cpp:1320)
[03:36:47|Error] Error: Param for mag cal failed. (telemetry_impl.cpp:1591)
[03:36:48|Warn ] sending again, retries to do: 3  (SYS_HITL). (mavlink_parameters.cpp:1291)
[03:36:48|Warn ] sending again, retries to do: 2  (SYS_HITL). (mavlink_parameters.cpp:1291)
[03:36:49|Warn ] sending again, retries to do: 1  (SYS_HITL). (mavlink_parameters.cpp:1291)
[03:36:49|Warn ] sending again after 0.503118 s, retries to do: 3  (511). (mavlink_command_sender.cpp:287)
[03:36:49|Warn ] sending again after 0.503154 s, retries to do: 3  (400). (mavlink_command_sender.cpp:287)
[03:36:49|Error] Error: Retrying failed get param busy timeout: SYS_HITL (mavlink_parameters.cpp:1320)
[03:36:49|Error] Error: Param to determine hitl failed. (telemetry_impl.cpp:1728)
[03:36:50|Warn ] sending again after 1.00596 s, retries to do: 2  (511). (mavlink_command_sender.cpp:287)
[03:36:50|Warn ] sending again after 1.00597 s, retries to do: 2  (400). (mavlink_command_sender.cpp:287)
[03:36:50|Warn ] sending again, retries to do: 3  (CAL_GYRO0_ID). (mavlink_parameters.cpp:1291)
[03:36:50|Warn ] sending again after 1.51112 s, retries to do: 1  (400). (mavlink_command_sender.cpp:287)
[03:36:50|Warn ] sending again after 1.51117 s, retries to do: 1  (511). (mavlink_command_sender.cpp:287)
[03:36:50|Warn ] sending again, retries to do: 2  (CAL_GYRO0_ID). (mavlink_parameters.cpp:1291)
[03:36:51|Error] Retrying failed (511) (mavlink_command_sender.cpp:307)
[03:36:51|Error] Retrying failed (400) (mavlink_command_sender.cpp:307)
[03:36:51|Warn ] sending again, retries to do: 1  (CAL_GYRO0_ID). (mavlink_parameters.cpp:1291)
[03:36:51|Error] Error: Retrying failed get param busy timeout: CAL_GYRO0_ID (mavlink_parameters.cpp:1320)
[03:36:51|Error] Error: Param for gyro cal failed. (telemetry_impl.cpp:1569)
[03:36:52|Warn ] sending again, retries to do: 3  (CAL_ACC0_ID). (mavlink_parameters.cpp:1291)
[03:36:52|Warn ] sending again, retries to do: 2  (CAL_ACC0_ID). (mavlink_parameters.cpp:1291)
[03:36:53|Warn ] sending again, retries to do: 1  (CAL_ACC0_ID). (mavlink_parameters.cpp:1291)
[03:36:53|Error] Error: Retrying failed get param busy timeout: CAL_ACC0_ID (mavlink_parameters.cpp:1320)
[03:36:53|Error] Error: Param for accel cal failed. (telemetry_impl.cpp:1580)
[03:36:54|Warn ] sending again, retries to do: 3  (CAL_MAG0_ID). (mavlink_parameters.cpp:1291)
[03:36:54|Warn ] sending again, retries to do: 2  (CAL_MAG0_ID). (mavlink_parameters.cpp:1291)
[03:36:55|Warn ] sending again, retries to do: 1  (CAL_MAG0_ID). (mavlink_parameters.cpp:1291)
[03:36:55|Error] Error: Retrying failed get param busy timeout: CAL_MAG0_ID (mavlink_parameters.cpp:1320)
[03:36:55|Error] Error: Param for mag cal failed. (telemetry_impl.cpp:1591)
[03:36:56|Warn ] sending again, retries to do: 3  (SYS_HITL). (mavlink_parameters.cpp:1291)
[03:36:56|Warn ] sending again, retries to do: 2  (SYS_HITL). (mavlink_parameters.cpp:1291)
[03:36:57|Warn ] sending again, retries to do: 1  (SYS_HITL). (mavlink_parameters.cpp:1291)
[03:36:57|Error] Error: Retrying failed get param busy timeout: SYS_HITL (mavlink_parameters.cpp:1320)
[03:36:57|Error] Error: Param to determine hitl failed. (telemetry_impl.cpp:1728)
[03:36:58|Warn ] sending again, retries to do: 3  (CAL_GYRO0_ID). (mavlink_parameters.cpp:1291)
[03:36:59|Warn ] sending again, retries to do: 2  (CAL_GYRO0_ID). (mavlink_parameters.cpp:1291)
[03:36:59|Warn ] sending again, retries to do: 1  (CAL_GYRO0_ID). (mavlink_parameters.cpp:1291)
[03:37:00|Error] Error: Retrying failed get param busy timeout: CAL_GYRO0_ID (mavlink_parameters.cpp:1320)
[03:37:00|Error] Error: Param for gyro cal failed. (telemetry_impl.cpp:1569)
[03:37:00|Warn ] sending again, retries to do: 3  (CAL_ACC0_ID). (mavlink_parameters.cpp:1291)
[03:37:01|Warn ] sending again, retries to do: 2  (CAL_ACC0_ID). (mavlink_parameters.cpp:1291)
[03:37:01|Warn ] sending again, retries to do: 1  (CAL_ACC0_ID). (mavlink_parameters.cpp:1291)
[03:37:02|Error] Error: Retrying failed get param busy timeout: CAL_ACC0_ID (mavlink_parameters.cpp:1320)
[03:37:02|Error] Error: Param for accel cal failed. (telemetry_impl.cpp:1580)
[03:37:02|Warn ] sending again, retries to do: 3  (CAL_MAG0_ID). (mavlink_parameters.cpp:1291)
[03:37:03|Warn ] sending again, retries to do: 2  (CAL_MAG0_ID). (mavlink_parameters.cpp:1291)
[03:37:03|Warn ] sending again, retries to do: 1  (CAL_MAG0_ID). (mavlink_parameters.cpp:1291)
[03:37:04|Error] Error: Retrying failed get param busy timeout: CAL_MAG0_ID (mavlink_parameters.cpp:1320)
[03:37:04|Error] Error: Param for mag cal failed. (telemetry_impl.cpp:1591)
[03:37:04|Warn ] sending again, retries to do: 3  (SYS_HITL). (mavlink_parameters.cpp:1291)
[03:37:05|Warn ] sending again, retries to do: 2  (SYS_HITL). (mavlink_parameters.cpp:1291)
[03:37:05|Warn ] sending again, retries to do: 1  (SYS_HITL). (mavlink_parameters.cpp:1291)
[03:37:06|Error] Error: Retrying failed get param busy timeout: SYS_HITL (mavlink_parameters.cpp:1320)
[03:37:06|Error] Error: Param to determine hitl failed. (telemetry_impl.cpp:1728)

I tried to connect my drone using usb and run the MAVSDK script, and it worked fine. Moreover, I noticed that when I connect over telemetry and print health, the atribute ’ is_accelerometer_calibration_ok’ stays False, while when connectine whith usb it became True.
Telemetry health output:
Health: [is_gyrometer_calibration_ok: True, is_accelerometer_calibration_ok: False, is_magnetometer_calibration_ok: True, is_local_position_ok: True, is_global_position_ok: True, is_home_position_ok: True, is_armable: True]

USB health output:
Health: [is_gyrometer_calibration_ok: True, is_accelerometer_calibration_ok: True, is_magnetometer_calibration_ok: True, is_local_position_ok: True, is_global_position_ok: True, is_home_position_ok: True, is_armable: True]

Hm. Is this using PX4?

Yes, on orangecube+.

Which PX4 version? And have you tried with something else like QGC whether the communication works both ways?

its 1.14.0beta. the connection works with QGC correctly.

What’s the communication setup? Any forwarding anywhere? Can you draw a diagram?


here is the communication setup. I don’t know what do you mean by ‘forwarding’ to be honest.
Appreciated.

Got it, thanks for that, it helps to understand your situation.

So the question is if some of the MAVLink messages are not properly forwarded by the SIYI air unit. I don’t have this hardware, so I can’t reproduce this, unfortunately.