How to do transformation to get correct linear velocity from linear acceleration IMU data?

asked 2021-09-22 06:52:03 -0500

Astronaut gravatar image

updated 2021-09-22 07:02:54 -0500

Hi I have IMU sensor that gives me the raw data such as orientation, Angular and Linear acceleration. Im using ROS and doing some Gazebo UUV simulation. Furthermore, I want to get linear velocity from the raw IMU data. If I do integration over time there will be accumulated error and will not be accurate with the time when for example the robot makes turns. So If I use

acceleration_x = (msg->linear_acceleration.x + 9.81 * sin(pitch)) * cos(pitch); 
acceleration_y = (msg->linear_acceleration.y - 9.81 * sin(roll)) * cos(roll);

So integrating linear acceleration is very bad,

Velocity_x= Velocity_old_x+acceleration_x*dt;

because integrates the acceleration without taking into account any possible rotation of the sensor, which means that the results will probably be terrible if the sensor rotates at all. So I need some ROS package that takes into account all this transformation and gives me the most accurate estimation of the linear velocity. Any Help? Thanks

edit retag flag offensive close merge delete