Issues Adding Custom MAVLink Message to QGroundControl (QGC) and PX4

Hello everyone, I’m a bit of a novice in PX4 and I’ve been trying to create a new MAVLink message following this guide.

This is what I have done so far:

  1. I have generated my own batmsg.msg.
uint64 timestamp                # time since system start (microseconds)
uint64 timestamp_sample         # the timestamp of the raw data (microseconds)
float32 datos

# TOPICS batmsg
  1. I created my MAVLink message in mavlink/message_definitions/v1.0/commons.xml with ID=3, which is currently unused.
<message id="3" name="BATMSG">
      <field type="uint64_t" name="timestamp" ></field>
      <field type="uint64_t" name="timestamp_sample" ></field>
      <field type="uint64_t" name="datos" ></field>
  1. I added it to mavlink_messages.cpp.
#include <uORB/topics/batmsg.h>
class MavlinkStreambatmsg : public MavlinkStream
    const char *get_name() const
        return MavlinkStreambatmsg::get_name_static();
    static const char *get_name_static()
        return "BATMSG";
    static uint16_t get_id_static()
        return MAVLINK_MSG_ID_BATMSG;
    uint16_t get_id()
        return get_id_static();
    static MavlinkStream *new_instance(Mavlink *mavlink)
        return new MavlinkStreambatmsg(mavlink);
    unsigned get_size()

    uORB::Subscription _sub{ORB_ID(batmsg)};

    // do not allow top copying this class
    MavlinkStreambatmsg(MavlinkStreambatmsg &);
    MavlinkStreambatmsg& operator = (const MavlinkStreambatmsg &);

    explicit MavlinkStreambatmsg(Mavlink *mavlink) : MavlinkStream(mavlink)

    bool send() override
        struct batmsg_s _batmsg;    //make sure [..._struct_s] is the definition of your uORB topic

        if (_sub.update(&_batmsg)) {
            mavlink_batmsg_t _msg_batmsg;  //make sure mavlink_ca_trajectory_t is the definition of your custom MAVLink message

            _msg_batmsg.timestamp = _batmsg.timestamp;
            _msg_batmsg.timestamp_sample = _batmsg.timestamp_sample;
            _msg_batmsg.datos  = _batmsg.datos;

            mavlink_msg_batmsg_send_struct(_mavlink->get_channel(), &_msg_batmsg);

            return true;

        return false;
  1. I enabled the stream.
static const StreamListItem streams_list[] = {
  1. Additionally, I added the following code to mavlink_main.cpp.
configure_stream_local("BATMSG", 0.1f);

The problem arises when I compile it for px4_fmu-v2, upload it to my Pixhawk, and check it in QGroundControl (QGC). I don’t see the MAVLink message anywhere. Could it be a problem with the MAVLink versions? What command can I use in NSH (NuttShell) to view all the MAVLink messages being sent? So far, I have been using the MAVLink inspector and “mavlink status streams” where it does apear my batmsg but not de current message. I haven’t done anything from the QGC side. Should I?