# Define end-effector pose by point and vector

Hi all,

I am using a UR10 with Moveit! for motion planning (move group interface C++). I want to align my end-effector with a vector in space. I read a lot about quaternions and rotation in 3d space, but at the moment I struggle to find out the best way to do this.

I have a given point (x,y,z) and a given vector for orientation (a,b,c), how can I set a target pose for the end-effector? Tried to use a geometry_msg but it needs a point and a quaternion. Also tried to calculate a quaternion between the current vector and the goal vector using cross product etc. but therefore I would need the vector of the current pose and I struggled to find it out -.- Does anybody know a clean solution for my problem?

Thank you very much in advance!

Hannes

Originally posted by HannesIII on ROS Answers with karma: 27 on 2017-01-31

Post score: 1

If you know the direction of the tool's approach vector then yes you can use the cross product to "produce" the other two orthogonal vectors needed to define an orthonormal 3x3 orientation matrix. The 3x3 orientation matrix R can be represented as R = [tx ty tz] where each entry is a 3x1 unit vector and all vectors are perpendicular to each other. Assuming that the known tool vector [a,b ,c] is the tz vector then you can obtain tx as the cross product of tz and [0 1 0]' . Then ty is just the cross product between tz and tx. You can then form the matrix R. The Eigen library has very powerful tools for doing these sort of calculations and its well integrated into MoveIt!

Originally posted by jrgnicho with karma: 486 on 2017-01-31

This answer was ACCEPTED on the original site

Post score: 2

thanks for the nice answer @jrgnicho, I have one question, What if we don't have that goal vector [a,b,c]? Is there any way to solve it? like using for loop or something else?