# robot_localization: how to deal with imu data

Recently, i am reading robot_localization and want to understand how it works. Previously, i have read and understood code and logics in robot_pose_ekf package.

I am confused about how imu data is processed in robot_localization. It seems to me that if config of differential was set to false, then imu can't work in robot_localization. The orientation of imu in 'world' fixed frame is transformed to orientation of base_link in 'world' fixed frame and set as measurement and send to ekf or ukf. But how can this data in world frame be fused with other data in other frame(such as 'odom' frame) ?

Hope i was wrong in understanding robot_localization and someone can fix me.

edit retag close merge delete

Sort by » oldest newest most voted

Part of the problem is that IMU data lacks separate frame_id fields for orientation, angular velocity, and linear acceleration, so we have to make some assumptions.

Let's say your IMU's frame_id was set to the same value as your EKF base_link_frame. In that event, the filter would assume that all orientations are being reported in the EKF's world_frame parameter value, e.g., odom or map. If your IMU is rotated w.r.t. the base_link frame and the data is given in a frame like imu_link, then the filter will rotate the orientation data according to that base_link->imu_link transform, and then fuse it.

If you always want the orientation data to start at 0, turn on the _relative parameter for your IMU.

more

Could I continue this thread? I understand that the orientation of an IMU is assumed to be reported in the world_frame, however what about the angular velocity of the IMU? Usually the angular velocity is reported with regard to its own frame or the base_link. However, I can see the transfer functions in the ekf.cpp assume the fixed world_frame for angular velocities. Does this mean the angular velocity should be per-processed into world_frame by a rotation using its current orientation?

Update:I read in https://github.com/cra-ros-pkg/robot_... that the angular velocity and acceleration are assumed in the IMU frame, then do you think this will conflict with the transfer functions that involves the angular velocity? Thanks!

Final update: I have re-calculated and found everything correct (!!), after a friend reminded me that the Euler angle sequence is first psi along z, then theta along y, then phi along ...(more)

( 2021-08-11 09:07:32 -0600 )edit