Hi, I’ve got my laptop running the c_uart_interface_example over a wireless Mavlink dongle. The program will communicate with the drone successfully, and I see the drone arm and disarm.
The problem is that the “-a” command line option to perform take off does not work.
Does anyone have any suggestions what might be going wrong?
Most MAVLink commands are compatible. Unfortunately there is a small set of commands that are either ArduPilot-only or PX4-only.
Your issue is one such example - the c_uart_interface_example uses the PX4 OFFBOARD flight mode. To work with ArduPilot, the example would have to be changed to instead use the more generic GUIDED flight mode.
In GCS_MAVLINK_Copter::handleMessage we see the following different bits of type_mask being checked:
1<<2
1<<6
1<<7
MAVLINK_SET_POS_TYPE_MASK_POS_IGNORE
MAVLINK_SET_POS_TYPE_MASK_VEL_IGNORE
MAVLINK_SET_POS_TYPE_MASK_ACC_IGNORE
MAVLINK_SET_POS_TYPE_MASK_YAW_IGNORE
MAVLINK_SET_POS_TYPE_MASK_YAW_RATE_IGNORE
The latter macros are defined in include/mavlink/v2.0/common/common.h which tellingly does not have any set to 0x1000 == 4096 (MAV_CMD_NAV_GUIDED_ENABLE)!
This suggests the example code is broken for takeoff for all Mavlink platforms.
The latter macros are defined in include/mavlink/v2.0/common/common.h which tellingly does not have any set to 0x1000 == 4096 (MAVLINK_MSG_SET_POSITION_TARGET_LOCAL_NED_TAKEOFF)!