# How to transform the acceleration data from IMU to velocity

I am currently using Xsens MTi-28A53G35 IMU for the the motion tracking on our robot. The IMU only puts out linear and angular acceleration and orientation data. Is there an node that can transform this to linear velocity so I can use it to localize the robot and help improve the accuracy of odometry.

Originally posted by [email protected] on ROS Answers with karma: 1 on 2014-09-18

Post score: 0

Comment by Mekateng on 2018-01-07:
Hi, Did you do it Mr. @[email protected]

I'm guessing your IMU puts out linear acceleration, angular velocity, and absolute orientation. While I have a branch of robot_localization that will take in linear acceleration data, I should point out that the double integration of linear acceleration as your only source of absolute position will produce a really poor estimate. If you had some estimate of your vehicle's linear velocity, such as from your robot's wheel encoder odometry, then you'd definitely benefit from the linear acceleration data.

Originally posted by Tom Moore with karma: 13689 on 2014-09-19

This answer was ACCEPTED on the original site

Post score: 1

Comment by Tom Moore on 2014-12-16:
Update: the released version of robot_localization now supports this feature.

Comment by Holger on 2017-04-10:
So robot_localization supports calculating the velocity with an IMU. How can I use this feature? I don't see a parameter that I can set. I understand that the imu0_config only describes which data should be used from imu0, am I wrong?

Comment by Tom Moore on 2017-04-11:
The IMU provides linear acceleration. Set those values to true, and the filter's kinematic model will integrate them into velocities. Be warned, though: there is no bias estimation, so biases will quickly cause the velocity to grow without bound (unless you have another velocity reference).

Comment by toqa elshahat on 2017-04-22:
can i use "IMU" in linear movement to create a 2D map or calculate the linear velocity??

This is the task of the robot_pose_ekf (http://wiki.ros.org/robot_pose_ekf).

Originally posted by Wolf with karma: 7555 on 2014-09-19

This answer was NOT ACCEPTED on the original site

Post score: 1

Comment by Tom Moore on 2014-09-19:
I don't believe robot_pose_ekf uses linear acceleration from the IMU, but rather only the absolute orientation. See the "imu_data" section of its wiki page.

Comment by lxg on 2020-08-12:
@Tom Moore, hello. How can i go about this manually? Assuming I do have the linear_acceleration and orientation from the IMU sensor as you said. I have also generated a reference velocity from the robot wheel. Am more interested in ultimately finding the displacement. Thanks.

Comment by Tom Moore on 2020-08-31:
What are you trying to go about manually?

Comment by lxg on 2020-08-31:
Converting the accelerometer and gyroscope data from IMU to displacement (distance ultimately). Speaking of which the data I got from the gazebo pluggin seems to be erroneous and the time_stamp is so inconsistent. You can check out this post about the kind of data I have: https://answers.gazebosim.org/question/25726/symmetric-imu-gyroscope-and-accelerometer-data-and-oscillating-time_stamp/

Comment by Tom Moore on 2020-09-29:
You just need to integrate the values into velocities and then again into position. The data is in the sensor frame, so you'll need to transform the velocities into the world frame before you integrate them into position. Double integration won't work well, though, just be warned. Trying to get position data from accelerometers and gyros alone is, IMO, a waste of time, unless you only need it over a very short period. But YMMV.

Comment by lxg on 2020-10-02:
Hello. I understood everything you said but I have no idea about how I should convert the data from the sensor frame to the world frame. Well there's nothing varying since this is the first time I will be doing this. I am looking at the hector plugin currently as a way to add gps simulation for my robot. As you pointed out, acceleration and gyro alone are indeed insufficient, furthermore, gazebo's IMU is not doing well at all for me right now. It gives symmetric gyroscope data as I pointed out in my earlier comment. a pain honestly. Thanks for the hints btw. How exactly do I go about converting my data from the sensor frame to the world frame? Again, thanks.

Comment by Tom Moore on 2020-10-02:
This should really be its own question, and it really belongs on robotics.stackexchange.com, as it's not really a ROS question. There is ample documentation on the web for coordinate transformations.

Comment by lxg on 2020-10-02:
ah no worries then. thanks. I will handle that.

Comment by lxg on 2020-10-02:
Ah you are right. Then I guess am all set. Thanks.