-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quaternion NED to ENU conversion seems incorrect #2
Comments
This discussion in an issue for a driver for a different device is related: ros-drivers/microstrain_mips#4 They indeed swap x and y and negate z. However, the argument in the issue is that that cannot be right, because a an identity quaternion [z, x, y, z] = [1, 0, 0, 0], which would indicate alignment with the respective frame, stays the same under this transformation. Meaning that the device would be aligned with both the NED and the ENU frame. It seems that after the issue was created, they did add a parameter to transform using a proper quaternion multiplication: |
The convention has been there in the ROS 1 driver as well, and looking at the README it is intended: https://github.com/SBG-Systems/sbg_ros_driver#frame-convention There is a PR with somebody putting in a fix, by what looks like a quaternion multiplication similar to the previous comment, though for the IMU data rather than for the odometry: |
The following code base for 'field robotics' also performs a swap of x and y and negation of z: |
OxTS converts RPY measurement from their device to a quaternion, then (left) multiplies that with a quaternion that represents a 90 degree yaw and 180 degree roll: There is also an issue with some very long derivations about how the orientations are or aren't correct: |
Interestingly, the ROS 1 version of the SBG driver has a closed but unmerged PR, that also flips x and y and negates z: Specific section: It looks however like a bunch of the changes from there still made it into the driver. The following commit changed the quaternion transformation from initially swapping x and y and negating z, to negating y and z: |
The output of the quaternion based EKF filter is converted from NED to ENU convention here:
sbg_ros2_driver/src/message_wrapper.cpp
Lines 646 to 652 in f6c476a
It simply negates the y and z components. Compare this to the conversion of the Euler angle based output here:
sbg_ros2_driver/src/message_wrapper.cpp
Lines 569 to 574 in f6c476a
Given an axis/angle representation of a rotation with angle$\theta$ and axis:
the quaternion representation is:
So flipping the y and z components of the quaternion is equivalent to mirroring the axis of rotation through the x/z and the x/y planes.
For example, if the axis of rotation in NED is$[0, \frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2}]$ , in ENU that is $[\frac{\sqrt{2}}{2}, 0, -\frac{\sqrt{2}}{2}]$ , however, the current implementation results in $[0, -\frac{\sqrt{2}}{2}, -\frac{\sqrt{2}}{2}]$ .
So from this, I think the correct implementation should be:
The text was updated successfully, but these errors were encountered: