Ask Your Question

What frame_id to put in a sensor_msgs/Imu message?

asked 2011-05-13 08:40:23 -0500

wvonachen gravatar image

I'm working with the Phidgets Spatial 9-DOF IMU, and I'm having some difficulty figuring out exactly which frame_id to stuff into the sensor_msgs/Imu message.

This particular IMU combines a 3-axis accelerometer, 3-axis gyro, and a 3-axis magnetometer. Populating the linear acceleration and angular velocity fields of the IMU msg is trivial. Orientation is calculated (by my code) using data from both the accelerometer (pitch and roll) and magnetometer (yaw).

The part I'm stuck on is that the orientation is by definition absolute, since it's based on gravity and Earth's magnetic field. But the linear acceleration and angular velocities are relative. Since I plan to feed the Imu messages to a pose estimator (e.g. robot_pose_ekf), do I populate the frame_id with a absolute, static frame or a relative one?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-05-13 15:27:47 -0500

Chad Rockey gravatar image

updated 2011-05-23 06:13:02 -0500

tfoote gravatar image

You should populate the frame_id of the sensor_msgs/IMU message with the frame in which the sensor is mounted.

robot_pose_ekf doesn't use the orientation vector in an absolute sense (it actually calculates changes in heading). The frame only relates to orientation not translation for the case of the IMU (since it's inertial). If your IMU is oriented to base link, you can just fill the frame with base link. Otherwise, publish a static tf publisher from base_link to imu_frame for how your IMU is oriented relative to your base_link. This would be the technically correct way.

However, I don't think I've seen a node that uses IMU except in the same frame as base link. So your best bet is to align your IMU with base_link so that code that doesn't transform IMU data won't negatively affect you. If you can't mount your IMU in this way, I suggest you write a simple relay node that transforms it manually into base_link on another topic that you then use with the other nodes.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2011-05-13 08:40:23 -0500

Seen: 3,023 times

Last updated: May 23 '11