When extracting the pose vector [x y z qx qy qz qw] from the dual quaternion [q_r, q_t], the method DualQuaternion.to_pose() first gets the rotation quaternion q_r and inverts its components in case the scalar part is negative (q_r_minus). This should be fine as it describes the same rotation. However, when extracting the translation vector t from the "translation quaternion" q_t = 1/2 * t * q_r, we need to use the exact same quaternion q_r. Using the q_r_minus for instead of q_r for the computation of t leads to an inverted translation vector. Is this correct?
Summary
Compute translation vector using q_r (which is self.q_rot in the code).
Extend test_conversions unit test to also cover the case where the scalar part of the quaternion is negative.
Use integer instead of float for index accessing (unrelated, but this unit test failed on my machine).
Problem Description
When extracting the pose vector
[x y z qx qy qz qw]
from the dual quaternion[q_r, q_t]
, the methodDualQuaternion.to_pose()
first gets the rotation quaternionq_r
and inverts its components in case the scalar part is negative (q_r_minus
). This should be fine as it describes the same rotation. However, when extracting the translation vectort
from the "translation quaternion"q_t = 1/2 * t * q_r
, we need to use the exact same quaternionq_r
. Using theq_r_minus
for instead ofq_r
for the computation oft
leads to an inverted translation vector. Is this correct?Summary
q_r
(which isself.q_rot
in the code).test_conversions
unit test to also cover the case where the scalar part of the quaternion is negative.