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

Revision history [back]

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 package can do the conversion from quaternion to Euler (Roll/Pitch/Yaw). See below for implementation examples: https://answers.ros.org/question/69754/quaternion-transformations-in-python/?answer=69799#post-id-69799

https://answers.ros.org/question/11545/plotprint-rpy-from-quaternion/#17106