I’m trying to send some custom messages via mavlink.
My setup:
Pixhawk cube black has a RFD 868x on Telem1 port. And a raspberry pi on Telem2 port
RFD is connected to ground station running MAVSDK, and so is the RPI.
Every other message is received just fine, i can also send the custom message from MAVSDK to the pixhawk.
But when i try to send a message from the pixhawk to a MAVSDK instance, using the “mavlink_msg_MESSAGE_send” function, only the RPI receives my message?
I tried to send the message with different channels (MAVLINK_COMM_1 and 2) but both are received by the RPI.
To send the message i created a method in the MavlinkReceiver class which just sends relays the message to the other channels:
void
MavlinkReceiver::handle_message_MY_MESSAGE(mavlink_message_t* msg)
{
PX4_INFO("Message received");
mavlink_MY_MESSAGE_t m;
mavlink_msg_MY_MESSAGE_decode(msg, &m);
# received by both MAVSDK clients
mavlink_msg_debug_send(MAVLINK_COMM_0, hrt_absolute_time(), 1, 1);
mavlink_msg_debug_send(MAVLINK_COMM_1, hrt_absolute_time(), 1, 1);
mavlink_msg_debug_send(MAVLINK_COMM_2, hrt_absolute_time(), 1, 1);
# received only on RPI (onboard)
mavlink_msg_MY_MESSAGE_send_struct(MAVLINK_COMM_0, &m);
mavlink_msg_MY_MESSAGE_send_struct(MAVLINK_COMM_1, &m);
mavlink_msg_MY_MESSAGE_send_struct(MAVLINK_COMM_2, &m);
}