Ask Your Question

Define end-effector pose by point and vector

asked 2017-01-31 05:27:26 -0600

HannesIII gravatar image

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!


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-31 15:29:36 -0600

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!

edit flag offensive delete link more


Hi, thank you for your answer! It is the correcht approach. The next step is just to create a quaternion out of the matrix from your post and set it as orientation for the goal pose. Unfortunately I thought a bit to complicated. I will mark your answer as correct!

HannesIII gravatar image HannesIII  ( 2017-01-31 16:41:21 -0600 )edit

Hi jrgnicho, would you mind sharing the source of your answer? I'm working on a very similar problem and would like more details about your solution. Is it from a book or something else? Thanks!

chriszzh gravatar image chriszzh  ( 2018-05-04 20:00:44 -0600 )edit

Thanks. Best answer!

vamshi666 gravatar image vamshi666  ( 2019-12-10 14:58:12 -0600 )edit

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?

askkvn gravatar image askkvn  ( 2020-03-02 07:22:57 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-01-31 05:27:26 -0600

Seen: 993 times

Last updated: Jan 31 '17