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

Revision history [back]

click to hide/show revision 1
initial version

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(fwd.dot(newFwd)); tf::Quaternion newOrientation{ax, alpha}; newOrientation.normalize();

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 and normalize it

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?

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(fwd.dot(newFwd));
tf::Quaternion newOrientation{ax, alpha};
newOrientation.normalize();

newOrientation.normalize();

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. follows:

  1. Get the new pointing direction via pointToHere-pointFromHere 2. 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. manipulator)
  3. Get the corresponding angle using the dot product 4. product
  4. Build the quaternion and normalize it

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?

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(fwd.dot(newFwd));
tf::Quaternion newOrientation{ax, newOrientation{ax.normazed(), alpha};
newOrientation.normalize();

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 and normalize it

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?

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(fwd.dot(newFwd));
tf::Quaternion newOrientation{ax.normazed(), alpha};
newOrientation.normalize();

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 and normalize itquaternion

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?

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(fwd.dot(newFwd));
tf::Quaternion newOrientation{ax.normazed(), 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?

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(fwd.dot(newFwd));
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?

here? The only thing I can think of right now is that the rotation axis may end up being incorrect..