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

Orientate orthogonal to point [closed]

asked 2015-12-11 13:11:03 -0600

Brick gravatar image


I am having some trouble regarding tf and orientation. I am trying to have one of my manipulators point directly towards another point in space. By this I mean that the new orientation of the manipulator should be such that the given point is on the x-axis of its reference frame.

How would this be accomplished, for example using quaternions? I imagine this could, for example be done by obtaining the Euler angles from the vector in the current reference frame and converting that into a quaternion. But perhaps there is a more elegant solution?

Cheers, Brick

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2017-04-20 13:44:48.798851


Assuming the position of your manipulator is fixed, finding RPY from the vector (directed to interest point from manipulator position) seems the way to go. If manipulator position is not fixed, there are many solutions.

2ROS0 gravatar image 2ROS0  ( 2015-12-11 15:15:39 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-12-12 08:39:41 -0600

Brick gravatar image

updated 2015-12-12 09:10:14 -0600

I have tried the following but I'm not getting any correct results so far:

tf::Vector3 fwd{1.0, 0.0, 0.0};
tf::Vector3 newFwd{(pointToHere - pointFromHere).normalized()};
tf::Vector3 ax{fwd.cross(newFwd)};
double alpha = acos(;
tf::Quaternion newOrientation{ax.normalized(), alpha};

My idea is to construct the orientation with respect to my world frame, so all vectors I am using here have been appropriately transformed into my world coordinate system. My steps (as detailed in the code above) are as follows:

  1. Get the new pointing direction via pointToHere-pointFromHere
  2. Calculate the axis of rotation using the cross product of what I consider my old and new forward vector (which is the x-axis of my manipulator)
  3. Get the corresponding angle using the dot product
  4. Build the quaternion

In most cases where I get a valid pose, the direction of my forward axis is actually completely wrong. It should be pointing the other way...

Any ideas on what I may be missing here? The only thing I can think of right now is that the rotation axis may end up being incorrect..

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-12-11 13:11:03 -0600

Seen: 194 times

Last updated: Dec 12 '15