ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to convert IMU data to quaternion orientation

asked 2018-03-20 11:40:05 -0500

Robbe_C gravatar image


I'm trying to fuse my IMU data (and GPS data) with the package robot_localization. Therefore, I have to put my IMU data into a sensor_msgs/Imu message. I know it is possible to convert my IMU data (accelerometer, gyroscope and magnetometer) into a quaternion orientation message. However, I wonder if there is a package available to do this transformation for me, or do I have to write code myself? If so, how would I start?

Thanks in advance! Kind regards Robbe

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-20 13:33:33 -0500

stevejp gravatar image

Just to clarify - you are not converting your accelerometer / gyros / magnetometer measurements into an orientation, you are using those raw measurements to estimate your orientation. The madgwick and complementary filter are both capable of doing exactly what you need.

edit flag offensive delete link more


The robot_localization package that the OP originally suggested can also do this.

ahendrix gravatar image ahendrix  ( 2018-03-20 14:14:37 -0500 )edit

@ahendrix I didn't think robot_localization dealt directly with magnetometer measurements. Can you explain how you would do this?

stevejp gravatar image stevejp  ( 2018-03-20 15:05:53 -0500 )edit

I believe the navsat_transform_node can handle magnetometer measurements:

ahendrix gravatar image ahendrix  ( 2018-03-21 00:15:47 -0500 )edit

Thank you for the quick respone! I think you are talking about the use_odometry_yaw parameter of navsat_transform_node, right? Maybe that's even easier.

Robbe_C gravatar image Robbe_C  ( 2018-03-21 06:06:22 -0500 )edit

I don't think the navsat_transform_node is what you need. Navsat_transform is used to transform GPS measurements into odometry which you can fuse in robot_localization.

stevejp gravatar image stevejp  ( 2018-03-21 06:31:46 -0500 )edit

Question Tools

1 follower


Asked: 2018-03-20 11:40:05 -0500

Seen: 6,821 times

Last updated: Mar 20 '18