I am working on a driver for the CH Robotics UM7 Inertial Measuring Unit. It is becoming apparent that there are some differences of opinion on how IMU data is to be interpreted for the ROS system.
Following is my opinion on how it should be done, hoping for some discussion confirming or correcting my understanding.
An IMU is mounted in a fixed location and orientation relative to the vehicle. It uses a body axes coordinate system. REP –103 defines these axes as: x = forward, y = left, and z = up.
Forward should be interpreted as being pointed in the “forward” vehicle direction of motion.
Left is lateral motion perpendicular to the X axis and pointed toward the left.
Up is directly away from the Earth’s center.
Only the Z axis has a relationship to the outside world and is usually determined using accelerometers that measure the direction of gravity during unaccelerated motion. The X and Y axes, being orthogonal to the Z axis, are tangent to an idealized Earth’s surface but have no specified direction relative to the Earth.
If the vehicle is level on the Earth’s surface, the X and Y accelerometers should report about 0 m/sec^2 and the Z axis accel should be approx +9.8 m/sec^2 reflecting an apparent upward acceleration away from gravity force.
The rate gyros should be in accordance with the right hand rule as stated in REP –103.
Rotation about the Y axis (pitch motion) should be positive in the nose down direction.
Rotation about the X axis (roll motion) should be positive for right side down motion.
Rotation about the Z axis (yaw) should be positive for CCW rotation looking down on the vehicle.
An IMU will commonly calculate attitude information using its rate gyro and accelerometer data. Such attitude data, whether in the form of Euler angles, Quaternions or other means should be with respect to the body axes and polarities are the same as for the rate gyros above. Data values should vary over the range of +/- pi radians.
IMUs also commonly provide magnetometer and/or compass information. For ROS, such data should reflect the direction of North relative to X axis. I.e. if the robot is pointed northeast, a compass reading should be –pi/4. (note: the preceding is a strawman since I don’t have a firm opinion) Range should be +/- pi. Magnetometer data should also indicate North with respect to the body axes.
An IMU often provides an optional feature in which the zero angle of yaw is set and maintained at the North direction as indicated by the magnetometer. This is a convenience to the user since it provides long term stability of the yaw angle as opposed to continuous integrator drift. It does not convert the IMU into an NED (or ENU) system. A driver should allow selection of this option or not. .
Use of either NED or ENU navigation coordinates has no effect on the data sent from an IMU. Transformation from IMU body axis to either NED or ENU coordinate systems is the responsibility of navigation software, not the IMU.
I come from the autopilot world and body oriented data is useful for direct control of the vehicle, Earth axis oriented data does not replace body data.
I don’t go into IMU use of gps data, since I haven’t used it (my robots are indoors people). That data probably needs definition too.
I think the standards provided for ROS are too general to define clear interfaces using the standard messages. E.g. imu/data is used for different purposes, like body and various earth axes, There should probably be specific data definitions for each proposed use.
Thanks, Alex Brown
Post score: 9
Comment by Alex Brown on 2015-01-07:
I missed one of the most important issues: Most IMU sensors provide data in an X (forward), Y(right) and Z(down) coordinates. The proper transformation to ROS coordinates is a 180 degree rotation about the X axis, or more simply, negate (change sign) of Y and Z.
Comment by Martin Günther on 2015-01-08:
Agree, but as long as it's a right-handed coordinate system, it doesn't matter. Where "up" is is defined by the IMU output and not where the screws are. If you mount the IMU "upside down" on a robot, you can reflect that in the robot's URDF.
Comment by Alex Brown on 2015-01-09:
Ah, but for we people who build simpler robots, we use the data directly with no URDF transformations. So it only works one way.
Comment by Thomas D on 2015-01-12:
Due to different mounting positions the IMU message should have no concept of "forward vehicle direction of motion" or any other vehicle characteristics. That would imply that the source code would have to be modified if the IMU was mounted in any position other than that assumed by the driver.
Comment by Alex Brown on 2015-01-12:
I think I agree. The IMU itself has no concept of mounting. But the robot has to know the transform between an arbitrary mounting orientation and the robot. Specifying/suggesting a standard location eliminates the need for a transform. Or correct it in the URDF as martin suggests
Comment by natejgardner on 2017-05-23:
Was #6 ever solved? What is the usual best practice for IMUs with magnetometers? My IMU orientation vector is relative to earth, but angular velocity and acceleration are relative to the IMU frame. How do I rectify this in a single message, which obviously can't live in two frames?