ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
A quaternion represents a relative difference in orientation rather than an orientation itself. Rviz
displays that difference by applying the quaternion to the canonical axes.
To "convert" an axis to a quaternion you need to create a convention for what the default axis should be and producing a quaternion that represents the rotation from one to the other. Eigen::Quaternion<d or f>::setFromTwoVectors
will do this do this for you. This leaves out one piece of the orientation which is the rotation about the source/destination vector, but you don't care about this since a cylinder is axially symmetric.
TL;DR: use Eigen::Quaternion<d or f>::setFromTwoVectors