In the ninth part of the Jetson RACECAR build, we install the Sparkfun Razor IMU ROS package. Looky here:
Background
After installing the Sparkfun Razor IMU on the Jetson RACECAR, we’re ready to prepare the driver software packages which enable the IMU to communicate with ROS.
The ROS wiki page for the Razor IMU 9DOF provides excellent instructions for installing the razor_imu_9dof package. There are also instructions on how to calibrate the IMU which we will visit at a later time.
The Sparkfun Razor IMU 10736 that we are using in this project has a built-in micro controller. The micro controller is programmed using Arduino software. For this ROS application, an AHRS Ardunio sketch will be uploaded to the IMU micro controller. Here is a great read about how the sketch actually works.
Installation
The Razor IMU interfaces with the Jetson using a FTDI serial to USB converter. This article assumes that the kernel supports FTDI, and that ROS is installed on the Jetson. Here is an article which covers how to build the kernel with FTDI support and install ROS.
The installRazorIMUROS repository on the JetsonHacks Github account contains helper scripts for the install process. First clone the repository and switch to the repository directory:
$ git clone https://github.com/jetsonhacks/installRazorIMUROS.git
$ cd installRazorIMUROS
If you have not already built a Catkin Workspace for the project, you may run the script:
$ ./setupCatkinWorkspace.sh jetsonbot
which will setup a Catkin Workspace named ‘jetsonbot’ in the ~/ directory. You may name the workspace with whatever you feel comfortable with. If you leave the name off of the command line the script is running from, then a default ‘catkin_ws’ directory will be created.
The setupCatkinWorkspace shell file modifies the .bashrc file in ~/ to include the some extra information about the ROS environment. You will want to review that information to make sure that it matches your installation.
Install the Razor IMU ROS Package
Next, we’re ready to install the razor_imu_9dof ROS package. There is a convenience script:
$ ./installRazor.sh
Let’s take a look at it:
#!/bin/sh
# Install the Razor IMU ROS package
sudo apt-get install ros-indigo-razor-imu-9dof -y
# For visualizing, you’ll need these python packages
sudo apt-get install python-visual python-wxgtk2.8 -y
# To put firmaware on the Razor, you’ll need the Arduino software
sudo apt-get install arduino arduino-core -y
The script first installs the ROS Indigo package razor_imu_9dof.
Next, the script installs a python visualization package. In the video, the demonstration uses the visualizer to show the orientation of the IMU and heading in a graphics environment. The visualizer is optional.
Finally the script installs the Arduino software, version 1.0. The Arduino software uploads compiled sketches to the Razor IMU.
Note: In the video I used the term ‘flash’ interchangeably with upload the sketch.
Uploading the Arduino Script
After installation, prepare to upload the AHRS script to the Razor IMU.
Switch to the Catkin Workspace, i.e.
$ cd ~/jetsonbot
# source the devel
$ source devel/setup.bash
Note: During development you may want to place the ‘source devel/setup.bash’ into your .bashrc file so you do not have to source it every time you open a new Terminal.
Next, copy the script to the Arduino sketchbook directory:
$ roscd razor_imu_9dof
$ cp -r src/Razor_AHRS ~/sketchbook/Razor_AHRS // Jetson TK1 uses Arduino 1.0 software
You can then use a file browser to navigate to the ~/sketchbook directory and open the Razor_AHRS folder. Double click on the Razor_AHRS.ino file, which will bring up the Arduino software.
In the sketch editor, find ‘Hardware Options’. Uncomment which device is being used, in this case the 10736. Save the sketch.
Now is the time to setup the Arduino software to talk with the IMU:
- Go to “Tools” → “Board” and select “Arduino Pro or Pro Mini (3.3v, 8mhz) w/ATmega328”. Note: in Aduino 1.5+, the board menu doesn’t allow selecting the voltage/frequency; go to the Processor menu after selecting “Arduino Pro or Pro Mini” and select “ATMega 328 (3.3V, 8Mhz)”
- Go to “Tools” → “Serial Port” and select the port used with the Razor.
- Go to “File” and hit “Upload”. After a short while at the bottom of the Arduino code window it should say “Done uploading”.
Once the sketch is done uploading, it’s ready to talk with ROS!
Demo
To run the demos, you should make a copy of the configuration data. In a Terminal, go to the jetsonbot directory and source the devel. Then:
$ roscd razor_imu_9dof/config
$ sudo cp razor.yaml my_razor.yaml
You can then go back to the jetsonbot directory. Then start roscore:
$ roscore
To publish the IMU data, open another Terminal, go to the jetsonbot directory, and source the devel. Then:
$ roslaunch razor_imu_9dof razor-pub.launch
You can then use the commands ‘rostopic list’ and ‘rostopic echo /imu’ to see the data being published.
In order to see the visualization, stop the razor-pub.launch process (CtrlC does nicely here) then:
$ roslaunch razor_imu_9dof razor-pub-and-dislay.launch
After a few moments, the IMU will begin publishing data and you will be able to change the orientation of the IMU sensor and see the results on a monitor.
Conclusion
Like most ROS packages, actually installing the Razor IMU ROS package is fairly easy. The one thing that’s a little different in this install is that the AHRS firmware needs uploading to the IMU before running the device. The ROS wiki instructions are very good, you should read them for further information.
7 Responses
Hi.
Thanks for all your work…
I plan to buy a tx1 pretty soon.
Could I answer 3 questions ?
– what do you really think of it power for a 1000 pocketsphinx questions ? (Under 5000 words)
– is it enough powered to do a realtime face tracking with 2 dynamixels on camera (roi process)
And this question where i tried a lot of things, without results…hard for an autodidact:
– i bought too a razor imu for my robot (a qbo). The imu publishes ok (imu_state\data)
But, how to insert it in the urdf/xacro to make robot move like imu does in rviz???
I see my imu on rviz rotating, but robot not.
I linked base_imu to base_link, and started a robot pose ekf with correct imu topic..
I need imu with wheels encoders, to improve my rtabmap depth camera gmapping (xtion pro live)
Perhaps i should do anything with tf ?
Thanks a lot, impatient to read you again.
Vincent
i too have the same problem..can u help with thid
Hi,
I am trying to use latest IMU : https://www.sparkfun.com/products/14001
But on Jetson TX2 there is older version of Arduino (1.0.5) and to use latest IMU, I have to upgrade Arduino.
I was able to install the Arduino IDE doing:
sudo apt-get install arduino
Unfortunately, that is arduino version 1.0.5. I need the features provided in the newer IDEs. After downloading from https://www.arduino.cc/en/main/software the ARM64 package, and using install.sh, the IDE fails to launch. Launching from a terminal reveals this error:
./arduino: line 35: /opt/arduino-1.8.1/java/bin/java: No such file or directory
Is there a special version of Java or some Path modification that will be necessary?
Thanks for any help you can offer, it is much appreciated!
Do I still need a custom kernel for the Razor IMU / FTDI if I’m using L4T 28.2 on a TX2? Building my own kernel sounds scary.
Trying out the IMU on a standard Ubuntu machine (instead of a Jetson), when I try to run “roslaunch razor_imu_9dof razor-pub-and-display.launch”, I get this error: “[ERROR] [1525842655.072800]: IMU not found at port /dev/ttyACM0. Did you specify the correct port in the launch file?”
As far as I know, I’ve done everything correctly, and data is available on /dev/ttyACM0 (via screen or cat on that device). Any idea why the ROS node wouldn’t be able to see it?
Not quite sure why you are using this article. This is for a Jetson TK1 from 2 years ago with an IMU which is no longer being sold.
Depending on which version of the SparkFun IMU you are using, you will also need a different driver.
For example, the RACECAR/J MIT RACECAR uses a SparkFun SEN14001 which is installed in the article: https://jetsonhacks.com/2018/02/05/software-install/
If you have an earlier version of the SparkFun IMU, then you should be able to use the code from the master branch in the https://github.com/mit-racecar/racecar branch.
Version L4T 28.1 (Which is the version of L4T which the RACECAR software supports) requires a CDC-ACM driver.
Thanks Jim! Sorry, I commented on the wrong article. I am using a SEN14001 unit, but plugged into an Ubuntu laptop, not a Jetson (just to load the firmware and test things out). But the visualizer is not able to “see” the imu, even though it’s correctly configured and visible as /dev/TTYACM0. Would I need this same ACM driver on a regular x86 laptop for Ubuntu 16.04? (I had assumed not, but you never know)
Related question: is the ACM driver also required on L4T 28.2?