JetsonHacks

Developing on NVIDIA® Jetson™ for AI on the Edge

Inertial Measurement Unit (IMU) – Part I

Here’s a little series on integrating an Inertial Measurement Unit (IMU) onto the I2C GPIO pins of the NVIDIA Jetson TK1. First, we’ll build an interface library, RTIMULib, to enable the IMU to talk to the Jetson. Looky here:

Background

As a child of the space age, I was always fascinated with rockets and the hardware built for going to the moon. It didn’t help that my father was a rocket scientist, which next to being an astronaut at the time was probably the coolest job in the world. My father put it into perspective when he told me, “You can teach a chimpanzee to be an astronaut, but you can’t train one to be a rocket scientist”. Or at least that’s how I remember it. This made me a little uneasy. Apparently I wanted to grow up to be a chimpanzee so I could ride rockets into space. I’m not sure how the guidance counselors would take that.

One of the fascinating bits of rocket hardware is the Intertial Measurement Unit, which is, as Wikipedia describes it:

An inertial measurement unit (IMU) is an electronic device that measures and reports a craft’s velocity, orientation, and gravitational forces, using a combination of accelerometers and gyroscopes, sometimes also magnetometers.

Full Wikipedia article here.

On the Apollo rockets, here’s what the assemblies looked like:

The IMU with the top removed. Three gimbals, platform electronics, and the accelerometer and gyro package can be seen in this picture.
the IMU with the top removed. Three gimbals, platform electronics, and the accelerometer and gyro package can be seen in this picture.

The Inertial measurement unit and the optical system (scanning telescope and sextant) mounted on the precision navigation base which maintains accurate angular orientation between the two subsystems. The optical system is used to align the inertial system and for navigation in earth oribt, lunar orbit, and in cislunar space. The inertial measurement unit is used as a primary attitude reference and is used for guidance purposes during all maneuvers and during reentry.
The Inertial measurement unit and the optical system (scanning telescope and sextant) mounted on the precision navigation base which maintains accurate angular orientation between the two subsystems. The optical system is used to align the inertial system and for navigation in earth oribt, lunar orbit, and in cislunar space. The inertial measurement unit is used as a primary attitude reference and is used for guidance purposes during all maneuvers and during reentry.

Here’s some more background on the Apollo Navigation and Guidance Systems.

Considering that the IMU structure is inside of a 6 inch cube of beryllium, you know it’s a formidable piece of hardware. What child wouldn’t be interested in that kind of thing? A lot of children were given gyroscopes to play with and learn, but it didn’t seem the same.

Forward about half a century. Today, most people carry an IMU with them in their pocket or purse in the form of a smartphone. This is the best thing ever!

IMU and the Jetson TK1

Unfortunately the Jetson does not have a built in IMU, but that’s easy to rectify. First we need an appropriate IMU. There are all sorts, but ideally it would have 10 Degrees Of Freedom (DOF), that is, accelerometer, magnetometer, and gyroscope, along with a barometer pressure sensor. 10 DOF is a bit of a misnomer, but a cool name nonetheless. A lot of these devices are made for I2C (serial computer bus) communication with a computer. Fortunately, the Jetson has that sort of access. It would also be nice if the IMU has level shifting, so that we don’t have to worry too much about voltages and the such.

Here’s one that fits the bill. The Adafruit 10-DOF IMU Breakout is about the size of an American quarter, and costs about $30 USD. Go read up about it, I know your curious. Now it doesn’t have a beryllium box, but it does have some header pins. And the header pins are gold (plated, maybe)! A future article will cover how to connect the IMU to the Jetson.

Before we can get data out of the IMU, we’ll have to build and install some software. For the initial foray, we’ll use the excellent Richards-Tech IMU library for Linux embedded systems, RTIMULib which is available on Github. Here’s the Richards-Tech blog notes on the library.

Installation

For the video, I forked the RTIMULib into the JetsonHacks repository. I suggest you use the Richards-Tech repository if you have long term projects that need the library, as it is well maintained there and updated frequently.

All you have to do is clone the appropriate repository, i.e. :

$ git clone https:://github.com/jetsonhacks/RTIMULib.git

Then go to the RTIMULib/Linux/RTIMULibDemoGL directory. There you will find the file RTIMULibDemoGL.pro, which is the Qt Creator project file that can be used to build the library and sample demonstration program. Here’s the blog post to Install Qt Creator on NVIDIA Jetson TK1.

As in the video, run Qt Creator on the RTIMULibDemoGL.pro file, ‘Build All’ and then run the program. Note that to access an IMU on I2C, the program must be run as super user, ‘sudo’ the program in other words from a Terminal. Also, it will need an IMU attached, but that’s another post! Click here for Part II.

Facebook
Twitter
LinkedIn
Reddit
Email
Print

11 Responses

  1. I am encountering an error when I try to build the RTIMULibDemoGL project in QT Creator. When I open the project, I get a message saying:
    “Error while parsing file …/RTIMULib/Linux/RTIMULibDemoGL/RTIMULibDemoGL.pro. Giving up.
    Could not find qmake configuration file default.”
    I am not sure what is causing this issue, as I am not familiar with QT Creator. I installed QT Creator using the instructions you provided in the blog post you linked to.

    Any help would be greatly appreciated!

      1. I set the compiler to GCC upon install as explained in the QT Creator Install Tutorial, and the Desktop (default) Kit shows GCC as my compiler accordingly. However, when I try to configure the project, QT Creator says no valid kits are found for use with the RTIMULibDemoGL project.

  2. I follow this guide and it’s working probably with Raspberry Pi but when I install it on Jetson nano, no .ini file was created after calibration, what I can do in this case?

Leave a Reply

Your email address will not be published. Required fields are marked *

Disclaimer

Some links here are affiliate links. If you purchase through these links I will receive a small commission at no additional cost to you. As an Amazon Associate, I earn from qualifying purchases.

Books, Ideas & Other Curiosities