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

tf2 How to generate rotation matrix from axis-angle rotation?

asked 2018-06-23 12:11:20 -0500

tanasis gravatar image

Is there a build-in tf2 functionality where we can generate a rotation matrix given an axis (tf2::Vector3) and an angle (double). E.g. Suppose you have:

tf2::Vector3 vec(2,3,4); // by axis I mean - any - axis, not just x,y,z
double angle_rads=1.57;
tf2::Matrix3x3 rotation_matrix(vec,rads); // <-- is there an easy way like this?

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2018-06-23 12:26:11 -0500

tanasis gravatar image

OK found it my self :) For people that are wondering (it goes through Quaternions):

tf2::Quaternion q;
q.setRotation(rot_vec,angle);
tf2::Matrix3x3 R(q);
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-06-23 12:11:20 -0500

Seen: 956 times

Last updated: Jun 23 '18