ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

IMU initial orientation and drift problem

asked 2015-05-06 10:23:55 -0500

Naman gravatar image

updated 2015-05-06 16:08:31 -0500

Hi all,

I am using Phidgets Spatial 3/3/3 along with this launch file. I have couple of doubts regarding it:
1. How is the initial orientation decided, is it always the same (default orientation) or is there any way to find the exact initial orientation?
2. When I use the magnetic orientation vector <param name="use_mag" value="true"/>, I have noticed that there is lot of drift when I rotate the IMU which does not happen when use_mag parameter is false. Can anyone tell me why is this happening or am I misinterpreting something?

Thanks in advance.
Naman Kumar

edit retag flag offensive close merge delete


  1. is probably not drift but a different fixed offset for each angle. Meaning: Same angle = same value.Cause are magnetic parts on your robot/environment. Move your sensor away from any magnetic objects and/or try to calibrate the compass.
Humpelstilzchen gravatar image Humpelstilzchen  ( 2015-05-07 03:02:02 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2015-05-08 03:44:24 -0500

Hi Naman,

I'm the author/maintainer of that package.

  1. The initial rotation is just the default orientation, since we disabled the magnetometer in that launch file, so there is no external reference. When you use this in combination with robot_pose_ekf, like we do, this doesn't matter, since robot_pose_ekf doesn't care for the absolute angles reported by the IMU, it only uses the difference between measurements.

  2. @Humpelstilzchen is right, it's not drift. Instead, in the default magnetometer calibration, there is a huge offset in the Phidgets devices. If you imagine the magnetometer readings as a sphere, it's not centered around the origin, instead it's shifted completely into one quadrant. The result is that the magnetometer vector always points into that quadrant, which the filter tries to compensate for, but fails of course.

The solution is to calibrate the phidgets device (if possible, while it is mounted on the robot, but without switching the robot motors on) using the Windows tool described in the Phidgets user guide. You'll end up with a set of parameters that you'll have to pass to the phidgets driver in the cc_* (compass correction) params; look at the commented out code in this launch file.

This will calibrate for hard iron and soft iron correction; however, changing magnetic fields will still give you problems (e.g., from the robot's motors or when driving indoors, where there are ferromagnetic materials in the building structure). That's why we chose not to use the magnetometer in our case.

edit flag offensive delete link more


Thanks a lot for great explanation!

Naman gravatar image Naman  ( 2015-05-11 07:30:53 -0500 )edit

Question Tools

1 follower


Asked: 2015-05-06 10:23:55 -0500

Seen: 2,372 times

Last updated: May 08 '15