Getting SCALED_IMU from Copter

Hi everyone,

Hope this is in the right place.

I am attempting to get the SCALED_IMU and HIGHRES_IMU MAVLink message from Arducopter 3.6 on a Pixhawk 2. I have implemented the MAVLink libraries in C++, am talking to the Pixhawk via a serial port at 57600 baud (telem1) via MAVLink 1 protocol and have tried a variety of methods to get this message to appear to me but nothing has worked yet.

I was hoping the community would be able to check my sanity and methods, please let me know if I’m missing anything.

  1. I’ve tried to to a mavlink_request_data_stream with MAV_DATA_STREAM_ALL set, this get’s me a bunch of messages RAW_IMU, GPS_RAW_INT, GLOBAL_POSITION_INT, SYSTEM_TIME, SCALED_PRESSURE, ATTITUDE. However other messages such as SCALED_IMU, HIGHRES_IMU are not received.

  2. I’ve tried the new mavlink_command method using MAV_CMD_SET_MESSAGE_INTERVAL to enable SCALED_IMU and HIGHRES_IMU however I get a mavlink_command_ack back with MAV_RESULT status as 3 = “Unsupported feature”.

For both above methods I have target_system and target_component both set to zero as recommend by the Ardupilot docs as a “broadcast” address (aka make everything receiving the messages/commands execute them).

I tried looking through the source code for MavRos and a few other projects which seem to be able to get access to the data in these messages, however wasn’t able to track down any specific tricks to requesting the data from the autopilot. Anything I am missing?

Cheers,

J

Method 2 will not work.

The easiest way is to change the source code a bit and go with method 1.
take a look at libraries/GCS_Mavlink*.cpp files.

Thanks for the hint, I’m looking into that now although was hoping not to have to change the firmware side of things.

In lieu of receiving scaled IMU information from either of these messages, is there a way to know what the units are for the RAW_IMU data? MAVLink documentation doesn’t provide this and I assume that it changes depending on the hardware since different accelerometers and gyros may have different levels of precision etc. Is that correct?

Yes, AFAIK you will need to read the sensor datasheet, and ardupilot source code in order to determine what units are used in those fields.