I am having difficulties sending messages from a Raspberry Pi 3B to a PX4 using mavlink.
I’ve added a custom message called ‘potmeters’ according to this guide https://dev.px4.io/en/middleware/mavlink.html and generated the required libraries using this guide: https://mavlink.io/en/getting_started/generate_libraries.html.
After connecting to the Pixhawk, I’m trying to send custom messages from the Pi using pymavlink’s [message_name]_send(). However, I am not able to receive the messages.
I know that the connection between the two is working by sending an already defined mavlink message (vehicle_attitude). I altered mavlink_receiver.cpp such that after receiving a ‘vehicle_attitude’ message it calls my custom-made function and that publishes the message’s content to my custom-made uorb topic correctly.
For debugging, I added a call to a function in the beginning of MavlinkReceiver::handle_message() that publishes the received message’s ID to an uorb topic. It publishes the ID of the ‘vehicle_attitude’ message correctly, but the ID for my new ‘potmeters’ message is nowhere to be seen. This could be caused by the Raspberry Pi not sending the message, however I was not sure if any preprocessinng before MavlinkReceiver::handle_message() takes place that could also cause the custom-made message to be lost.
I don’t have any equipment to read the actual signals and check whether my custom message is sent by the RPi. I’ve generated the pymavlink libraries according the previously mentioned url, and using [message_name]_send() for my custom message doesn’t give any exceptions or errors. The python code that I use for sending the message is exactly the same as for sending the ‘vehicle_attitude’ message (except for the _send() function obviously), and that works fine.
I have a feeling that it must be the Raspberry Pi not sending the message is the actual problem here, but I don’t know where to look for a cause. The other option is that something on the Pixhawk is wrong, but that must be before the MavlinkReceiver::handle_message() is reached.