Universal Robots Forum

How to make Z axis parallel to a random vector - Kinematics

Hello guys…
I’m trying to make my tool point to a certain direction given by the orientation of a vector. But I’m quite stuck in the math about the rotation.

A general question will be:
Suppose I have an point A=[0,0,0] and an point B=[10,4,0], thus the vector AB = [-10,-4,0],

How to come out with the pose’s rotation that align my Z axis with this vector AB?

Can anybody help me, pleaseeee!

Pose rotation is given by rotation vector [rx, ry, rz].

They can be obtained by calculating rotation matrix.
I studied from here and read “Rotation vector”(page 17) of “Robotics in UR Robots_March 2019.pdf”.

https://forum.universal-robots.com/t/robot-theory-and-how-to-use-it-in-ur-robots/3863