MAVLink sending HIGHRES_IMU data to computer but not to Arduino companion board

Hi, this is my first post here, so I’m sorry if this is badly formatted, or if it’s not posted on the correct topic.

I’ve been trying to send acceleration and attitude quaternion data from a Pixhawk 2.4.8 using PX4 Firmware to an Arduino Mega board via the TELEM2 port.

When checking on QGroundControl, MAVLink is indeed sending HIGHRES_IMU data at a rate of 50Hz:

However, when trying to recover the same data on my Arduino board, I never receive that same data, even though I have configured MAV_0 (MAV channel communicating to the computer) and MAV_1 (MAV channel communicating to the Arduino) with the exact same parameters (same baud rate, etc…)

Here is the code I use on my Arduino :

I am using code from this library :

There is an example Arduino code in the library (Acceleration.ino) that basically does what I’m trying to do. It uses two main functions from the library :

  • Stream() that sends a request to stream MAV_DATA_STREAM_ALL
  • ReadAcceleration() that recovers HIGHRES_IMU and ATTITUDE_QUATERNION like so:
    while(_MAVSerial->available() > 0){
      mavlink_message_t msg;
      mavlink_status_t status1;
      uint8_t ch = _MAVSerial->read();
      if(mavlink_parse_char(MAVLINK_COMM_0, ch, &msg, &status1)){
        //Serial.println("Message Parsing Done!");
              Serial.println("Sending Highres IMU Data");
              mavlink_highres_imu_t data;
              mavlink_msg_highres_imu_decode(&msg, &data);
              xa = (data.xacc);
              ya = (data.yacc);
              za = (data.zacc);
              flagI = 0;
              Serial.println("Sending Quaternion Attitude");
              mavlink_attitude_quaternion_t data;
              mavlink_msg_attitude_quaternion_decode(&msg, &data);
              q0 = data.q1;
              q1 = data.q2;
              q2 = data.q3;
              q3 = data.q4;
              flagA = 0;

  *xacc = xa + (9.80665)*2*(q1*q3-q0*q2);
  *yacc = ya + (9.80665)*2*(q0*q1+q3*q2);
  *zacc = za + (9.80665)*(1-2*(q1*q1+q2*q2));

When using this code, the Serial monitor only prints “Sending Quaternion Attitude” and never prints “Sending Highres IMU Data”.

In order to understand the problem, I am using the following line to print the ID of every single message I receive :


The serial monitor then randomly prints message IDs like so :

As you can see, I indeed receive the ATTITUDE_QUATERNION message (ID #31) very often, but I never receive the HIGHRES_IMU message (ID #105). I don’t understand why this one message in particular is never received, given that it is sent at a 50hz rate, which is the exact same rate as for attitude quaternions.

Any idea why ?