I'm trying to add a new message to the MAVLink interface. Following this page, there are the steps I took:

  1. Added the message to ardupilotmega.xml. Right at the end of the file:

    <message name="TESTING_TESTING_TESTING" id="182">
      <description>A testing message</description>
      <field type="int16_t" name="placeholder">Does nothing. Simply a placeholder</field>
  2. Regenerated the mavlink messages headers using ./libraries/GCS_MAVLink/generate.sh. It worked okay and the new headers appeared.

  3. Then I added a function to the GCS class to make sure I'm sending on the right channel:

    void GCS_MAVLINK::send_testing_testing_testing()
        mavlink_msg_testing_testing_testing_send(chan, 0);
  4. Now it's time to send the message, I added my own function to the scheduler (on last priority). I made sure the function is called by sending text first and seeing it on the mission planner console. Here is the function I added:

    static void a_testing_loop(void)
        for (uint8_t i=0; i<num_gcs; i++) 
            if (gcs[i].initialised)
                // gcs[i].send_text_P(SEVERITY_HIGH,PSTR("Testing String"));

My message, however, isn't received on the mission planner end. It might have been received and ignored by the mission planner, but anyway it doesn't appear on the console window (even with 'Mavlink Message Debug' on)

Is there configuration to be made to the Mission Planner for it to receive new messages? Or am I sending the message wrong?

Also, is there a way to filter out messages from the console when using 'Mavlink debug mode'?

I'm using SITL for testing

(I don't have enough reputation - But this should be under the tag 'mavlink')

  • $\begingroup$ Hi I have the same problem, I need to send by apm a sensor value, i follow the guide like you but I don't know how I can recognize my custom message. Have you find a solution? $\endgroup$
    – Enzo Buono
    May 19, 2015 at 13:37
  • $\begingroup$ I'm not sure as this was a while ago - But have you recompiled the mission planner MAVlink XMLs as well? Also, I've got a tool I've developed that might be usefull to you. I'll try to upload it today or tomorrow $\endgroup$
    – Nitay
    May 21, 2015 at 8:32
  • $\begingroup$ I wanted to comment, but I don't have enough reputation. I'm struggling with the same thing. I have done the same things you did in the Ardupilot. I have also created the definition of the message in ardupilotmega.xml. Still no good result when I try to read it with MainV2.comPort.MAV.getPacket() method in the middle of the mainloop() in FlightData.cs. $\endgroup$ Jun 16, 2017 at 15:58
  • $\begingroup$ @JonathanLopesFlorêncio I'm sorry but I can't remember exactly what I did. I remember fixing it though. I ended up implementing my own GCS, meaning I had more control over the messages and was able to see all messages received. A good workaround, however, is to send text messages (gcs_send_text_fmt) with what you need and adding code on the client side to parse these. If you need more debug info - You can add custom logs (I can extract the logs part from my code if you need more guidance) $\endgroup$
    – Nitay
    Jun 16, 2017 at 20:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.