M2 IMU Setup

Hi all,

I just went through the pain of setting up an M2 with IMU support. None of the existing guides were complete, so I thought I’d share my steps here for others to use. Enjoy!

EMLID Reach M2, IMU setup

My environment:

Ubuntu 20.04, x86_64

Follow the following steps to read data from the IMU on the M2 (with the bulleted caveats)

toolchain.cmake

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(Qt5Core_DIR /home//Qt/5.12.11/android_armv7/lib/cmake/Qt5Core/)
set(Qt5Widgets_DIR /home//Qt/5.12.11/android_armv7/lib/cmake/Qt5Widgets/)
set(Qt5Gui_DIR /home//Qt/5.12.11/android_armv7/lib/cmake/Qt5Gui/)
set(_qt5gui_OPENGL_INCLUDE_DIR /usr/include/libdrm/)

set(tools /home//XC-reach/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf)
set(CMAKE_C_COMPILER ${tools}/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${tools}/bin/arm-linux-gnueabihf-g++)

set(sysr /home//XC-reach/sysroot-glibc-linaro-2.25-2019.12-arm-linux-gnueabihf)
set(CMAKE_SYSROOT ${sysr})

set(QT5 true)
set(CMAKE_PREFIX_PATH /home//Qt/5.12.11/android_armv7/lib/)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

4 Likes

With some minor modification to RTIMULib2 I was able to get this working to stream this data into ROS. If you’re interested in this step I would recommend looking over the source code for the ROS node, to understand what changes need to be made.

1 Like

Interesting. Have you tested IMU accuracy?

Only visually thus far. It seems pretty good, but I have yet to actually try to use it for control.

Hi John,

We regularly release new firmware versions with significant features and fixes, so we recommend keeping your Reach updated. If you upload a custom script to Reach to access IMU, the next firmware update will erase it. That’s why I’d suggest choosing another way to work with IMU.

You can get IMU readings from SPI without running custom scripts on the receiver. Also, you can consider using an external sensor as the most straightforward way to obtain IMU data.

Hi Kseniia,

Thanks for your response.

Can you share instructions on how to get IMU readings from SPI without running custom scripts on the receiver? I would prefer to do it this way, but was unable to find any documentation on how to do it.

2 Likes

Hi John,

To use SPI, you can SSH into Reach and get data from /dev/spidev0.0.

We indeed don’t have any instructions on it, as this process may be quite complicated and vary in detail for different setups. But I’ve seen that some of our users shared that they succeeded in setting such a connection.