ros / roslisp_common

Clone of the old roslisp_common SVN repo from code.ros.org.
8 stars 14 forks source link

Added a quaternion->euler conversion function. #51

Closed mpomarlan closed 7 years ago

mpomarlan commented 8 years ago

Function is defined so that (except for numerical precision error)

(lambda (arg) (apply #'cl-tf:euler->quaternion (cl-tf:quaternion->euler arg)))

is equal to arg when arg is of type cl-tf:quaternion. Also

(lambda (arg) (cl-tf:quaternion->euler (apply #'cl-tf:euler->quaternion arg)))

is equal to arg, except in cases where the pitch is +/-0.5*pi. In such cases, the resulting roll is set to zero and the resulting yaw is set to the difference (pitch pi/2) or sum (pitch pi/-2) of the yaw and roll values in arg.

gaya- commented 7 years ago

Could you please add the comments from this PR as a doc string to the function? In my humble opinion that would be really useful.

gaya- commented 7 years ago

I can't be bothered going into the math details, so I trust @mpomarlan on that one. But I did test if the euler->quaternion and the proposed quaternion->euler are an inverse of each other and they are.