Applying yaw_offset and mag_declination in IMU driver
Hello,
I am writing an IMU driver (for an IMU that will be fused with GPS using robot_localization) and want to make sure I am applying yaw_offset and mag_declination the same way robot_localization does it so there is no need to set those parameters in robot_localization. The data from the IMU (called raw_imu
) has been set to the right ROS convention but forward is North (therefore the need for yaw offset).
Is the right way to create a yaw rotation quaternion with the two parameters and then apply that to the raw IMU data as follows?
YAW_OFFSET = 1.570796327
MAG_DECL = -0.1455605 # at my location declination is 8° 17' E
yaw_transform = tf.transformations.quaternion_from_euler(0, 0, YAW_OFFSET+MAG_DECL)
imu_transformed = tf.transformations.quaternion_multiply(yaw_transform, raw_imu)