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:
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:
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.
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.