ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How do you convert a quaternion into an axis-angle representation?

asked 2012-09-20 13:13:05 -0600

derekjchow gravatar image

updated 2012-09-20 17:06:52 -0600

joq gravatar image


I'd like to convert an orientation from geometry_msgs::Quaternion to an axis-angle representation ( Similarly, I'd like to convert back to a quaternion from an axis-angle value. What ROS libraries are available to preform these conversions?


edit retag flag offensive close merge delete


I answered this question, then edited that and it disappeared. It does not allow me to answer again! The best I could do:

Mani gravatar image Mani  ( 2012-09-20 15:00:51 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2012-09-20 17:43:49 -0600

jbohren gravatar image

updated 2012-09-20 17:46:18 -0600

TF datatypes are actually re-cast Bullet Datatypes. If you have a tf::Quaternion, you can use any of the functions dejan linked to above, but specifically, you want these two:

double btQuaternion::GetAngle()

btVector3 btQuaternion::GetAxis()

When you want to change the value of a tf::Quaternion from an axis/angle representation, you can use this member function:

void btQuaternion::SetRotation(const btVector3 &axis, const double &angle)

edit flag offensive delete link more

answered 2012-09-20 14:39:01 -0600

dejanpan gravatar image
edit flag offensive delete link more

Question Tools


Asked: 2012-09-20 13:13:05 -0600

Seen: 4,886 times

Last updated: Sep 20 '12