I have the following setup:

enter image description here

I want to move the "Drill" frame to "Target1" with the opposite Z axis direction. I have calculated translation between "Target1" and "Robot_base". How could I calculate the rotation I need to complete that movement?


1 Answer 1


From what you've said here, the goal pose relative to the robot_base frame has the following properties:

  • Takes the transform of the drill and adds the transform up to target_1
  • Takes the rotation of target_1 and then applies some other rotation to it

It's not clear exactly what that rotation is (you haven't said), so I'll just assume that since it's a drill you want it pointing straight down. If this is the case, your goal is to apply a rotation to the target orientation. We can apply rotations to transforms and/or quaternions by multiplying them (see this similar question).

From that question, assuming your rotations are held in some standard Quaternion implementation (such as tf2):

tf2::Quaternion rotation, approachOrientation;
rotation.setRPY(0, M_PI, 0) // assuming we want to flip around pitch by 180 degrees

approachOrientation = targetOrientation * rotation;

See the related question for more detail.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.