So I've been doing a bit of development with Robot Operating
System (ROS) and a while back needed a flexible solution for acquiring inertial
measurement data from multiple sensors. My intention was to have an embedded
controller responsible for collecting IMU data and delivering to a master
controller. Since in ROS it is easy to swap between a laptop and an
embedded-Linux device as your platform, I decided to make a portable Ethernet-based
IMU out of the MPU9150 and a raspberry pi (or pcduino).
I had previously made my own C/C++ Linux-based API interface
for communicating to the MPU9150 (3axis gyrometer, accelerometer,
magnetometer). This project is an extension to have an embedded server which would send
periodic packets containing latest IMU data (so as of now, the embedded-IMU
device does not run ROS). I wrote a ros-node to connect to this
server, receive the data and publish it as a ROS message. Everything seems to be
working out quite well and I currently am receiving IMU data at 100Hz using
Ethernet (less over wifi). I can add additional Ethernet-based IMUs to the
project with little complexity now. Below is my wireless version.
Pcduino-3, MPU9150 and a USB battery pack |
For show, I setup a battery-powered pcduino-3 connected to an
IMU as the server over wifi (eliminating wires which get in the way for a
hand-held demo). On my ROS device (laptop) I have a node running which is
dedicated to receiving the IMU data packets and publishing in ROS as a sensor message that other ROS nodes can subscribe to. Below is a video of real-time plotting of
received IMU data using rqt. The video is not the best quality because my phone is not so great, but you can see that the top plot is the Gyro-Z measurement and the bottom plot is the Accelerometer x-axis measurement.
I also wrote an additional node in ROS to subscribe to the
IMU messages and perform some integration on the gyro data to estimate the
sensor orientation around the z-axis (so what a compass would tell you). You
can see in this short video the integration is somewhat reliable. There is definitely gyro drift over time
which would end up corrupting the estimate in the long term, but that's where filtering techniques will come in to assist in state estimation (for example: Kalman
filtering). Video below:
I will be posting my code for this project on my github soon, I will update this once that is ready (and hopefully making better videos)
No comments:
Post a Comment