Mavlink instance running on Custom mode

I’d like to provide an update on a topic we discussed during the Q&A session.

Here’s a brief overview:

I’m currently working on a project that involves an external board communicating with PX4 over UART. The code for the external board is based on the c_uart_interface example provided by MAVLink. This code receives heartbeat messages from the autopilot and sends vehicle commands. However, instead of the standard MAVLink messages, my board sends a custom MAVLink message, which PX4 successfully receives and streams.

on the PX4 side, I’ve added a preflight check that reads this custom message and acts on it.

Now, I want to take another step and send commands from PX4 to the external board. In a Q&A session, I was advised to send a heartbeat message to PX4, which I implemented as follows:

mavlink_message_t msg;
// Serialize the MAVLink message
uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);

And in the commander as follows:

void Commander::send_latch_command()
vehicle_command_s vcmd{};
vcmd.command = vehicle_command_s::VEHICLE_CMD_DO_WINCH;
vcmd.source_system = _vehicle_status.system_id;
vcmd.target_system = 99;
vcmd.source_component = _vehicle_status.component_id;
vcmd.target_component = 169;  /* Winch component. | */
uORB::Publication<vehicle_command_s> vcmd_pub{ORB_ID(vehicle_command)};
vcmd.timestamp = hrt_absolute_time();

However, when I set my MAVLink instance to custom mode, I’m only receiving the MISSION_CURRENT message (message ID 42), rather than the expected vehicle command routed through the MAVLink instance connected to my UART port.

I’d consider using MAVSDK instead as it tries to make that sort of thing easier.