: 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.

@Rana_Abu_Eisheh
Hi Rana

I have encountered exactly the same issue as yours.
Same hardware, same software (mavsdk)

Did you find any way to solve it?

Thank you!

@Neil_Chou what part doesn’t work? Do you know which message don’t go through?

Hi @JulianOes

Thank you so much for your respond!

Unfortunately, I don’t know which message does not go through.
Or I should say I don’t know how to do it.
I am relatively new to drone area.
Could you please guide me or is there a way to check which message doesn’t go through?

I have exactly the same software setup, wiring, errors, QGC, px4, everything as Rana.

Thank you!

A start is to look in QGC → Analyze tools → MAVLink inspector and check what does come through.

When you say that it works with QGC. Is that normal/upstream QGC, or the SIYI QGC.

Hi @JulianOes, thanks for the instructions.

I use the official QGC 4.3.0 to check.
It seems like no mavlink message is missing.

I compare their difference and every type of mavlink is the same.
Is that possible?

I can confirm that the variable is_accelerometer_calibration_ok is always False.
That’s so far the only difference I found just like here.

Do you think I can ignore the variable is_accelerometer_calibration_ok , e.g., set it as True at my side to bypass the error?

Hi @JulianOes

I have a new discovery.

When I use mavlink-router or MAVProxy to redirect the mavlink package from port A to port B.
When using port B, QGC pops out “Vehicle 1 did not respond to request for parameters. This will cause QGroundControl to be unable to display its full user interface”

However, when I don’t use mavlink-router or MAVProxy, QGC works normally.

So I think when I use mavlink-router or MAVProxy, QGC can not receive some mavlink either. (just like the mavsdk not working issue)

I open the mavlink inspector in QGC and check what’s the difference between them.
And this mavlink message “COMMAND_ACK” only appears when QGC works.

So I think the issue is that QGC never receives “COMMAND_ACK” when using mavlink-router or MAVProxy.

Do you have any idea how does it happen?
Does it relate to the original mavsdk not working issue?

Thank you!


That’s interesting. It might be something wrong with target sysid and target compid being wrong somewhere but I don’t quite understand where that would be. I assume the COMMAND_ACKs get filtered because they don’t have the correct target address.

Where do you run the mavlink-router? On your desktop?

Yes I run my mavlink-router on my computer.

Never mind.
I change the connection method from network (UDP) to USB wiring and everything us working right now.

I think it’s something related to SIYI HM30, that its UDP package re-forwarding has fault.
Causing some of mavlink package loss.

Still thanks for your reply!

1 Like

I’m having a similar problem but I’m not using a SIYI HM30, but my problem seems to be only with the command 211 (MAV_CMD_DO_GRIPPER) and I can control the gripper just fine on the QGC.

[07:48:52|Warn ] Received ack for not-existing command: 211! Ignoring... (D:\a\MAVSDK\MAVSDK\src\mavsdk\core\mavlink_command_sender.cpp:283)
[07:48:53|Warn ] sending again after 0.569896 s, retries to do: 3  (211). (D:\a\MAVSDK\MAVSDK\src\mavsdk\core\mavlink_command_sender.cpp:312)
[07:48:53|Warn ] Received ack for not-existing command: 211! Ignoring... (D:\a\MAVSDK\MAVSDK\src\mavsdk\core\mavlink_command_sender.cpp:283)
[07:48:53|Warn ] sending again after 1.09786 s, retries to do: 2  (211). (D:\a\MAVSDK\MAVSDK\src\mavsdk\core\mavlink_command_sender.cpp:312)
[07:48:53|Warn ] Received ack for not-existing command: 211! Ignoring... (D:\a\MAVSDK\MAVSDK\src\mavsdk\core\mavlink_command_sender.cpp:283)
[07:48:54|Warn ] sending again after 1.62407 s, retries to do: 1  (211). (D:\a\MAVSDK\MAVSDK\src\mavsdk\core\mavlink_command_sender.cpp:312)
[07:48:54|Warn ] Received ack for not-existing command: 211! Ignoring... (D:\a\MAVSDK\MAVSDK\src\mavsdk\core\mavlink_command_sender.cpp:283)
[07:48:54|Error] Retrying failed (211) (D:\a\MAVSDK\MAVSDK\src\mavsdk\core\mavlink_command_sender.cpp:339)