As the title says, how to give a local orientation to my end effector, but global position?

Basically this would mimic the goal orb in RVIZ, where you can drag it around to give global position, but the orientation is still relative to the end effector itself.

For example here is a simple command to set pose target:

ref_frame = "base"
# Arm in front of robot
pose_goal.position.x = 0.5
pose_goal.position.y = 0
pose_goal.position.z = 0

# Pitched 45 degree
quat_local.quaternion.x = 0
quat_local.quaternion.y = 0.707
quat_local.quaternion.z = 0
quat_local.quaternion.w = 0.707


Where I can set the reference frame to the base for global pos & quat goals with 45degree pitch to the end effector when the goal position is in front of the robot.

But as you'd expect, if I the goal position is not directly in front, or even 90degree to the side, then the end effector goal orientation is no longer 45degree to itself, but 45 degree roll.

So is there a way to give it global position while using local orientation? Is it using the tf library to transform an OrientationStamped from local to the global?


1 Answer 1


Turns out there's no direct solution to this. Overall I have to transform (using the tf library) my desired orientation from a local frame, into a world frame.

There are various mathematical ways to do it, the route I took is this:

  1. Define the goal orientation around Y-axis, relative to X-axis (my eef at neutral angle).
  2. Get the expected Y-axis angle of the goal position by using tan(y/x).
  3. Rotate the goal orientation by the expected Y-axis angle.
  • $\begingroup$ May I ask how you came to this conclusion? $\endgroup$
    – Robotawi
    Feb 22 at 0:28
  • $\begingroup$ @Robotawi Is there any other way? Let me know if there's another way to do this, as I've been searching around for weeks for this. I want a solution which basically combine set_position_target & set_rpy_target. But ofc you know moveit will only execute the last target. So the only way for the IK to solve for my target position & orientation was set_pose_target, but I can only provide it with values in the same frame. So I had to convert my local orientation goal to a global one, hence the steps above. $\endgroup$
    – Ezeuz
    Feb 23 at 23:29

Your Answer

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

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