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

Phidget IMU Magnetic Heading?

asked 2020-10-23 10:07:33 -0500

nabatta gravatar image

Hello! I am new to ROS so please forgive the simplicity of this question. I am trying to get a Phidget IMU to output a magnetic heading (0-360 deg). I currently have the phidgets_imu package installed which reads linear acceleration, angular velocity, and magnetic field. I am also using imu_filter_madgwick which fuses the data to get the orientation. However, I am not sure how to calculate the magnetic heading from this. The literature on the filter says it outputs a quaternion but then the screen displays the orientation in x, y, z, w. Anyone have some experience with this? Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-10-27 15:05:40 -0500

pratman gravatar image

The Madgwick filter fuses raw magnetometer data (by subscribing to /imu/mag) to compute orientation. This orientation happens to be a quaternion instead of roll/pitch/yaw. The easiest way for you to obtain magnetic heading from this, without having to write your own node to do trigonometric calculations, would be to transform the orientation vector from quaternion to Euler angles. In the resulting Euler pose, yaw angle will be the magnetic heading of your robot. The tf2 ROS packagecan do the conversion from quaternion to Euler (Roll/Pitch/Yaw). See below for implementation examples: https://answers.ros.org/question/6975...

https://answers.ros.org/question/1154...

edit flag offensive delete link more

Comments

Thank you!

nabatta gravatar image nabatta  ( 2020-10-30 10:44:27 -0500 )edit

Question Tools

Stats

Asked: 2020-10-23 10:07:33 -0500

Seen: 407 times

Last updated: Oct 27 '20