Followtarget - How to rotate my robot?

Hi, I want to rotate my robot 90 degrees with the up-axis.
I expected that the robot would still work properly, but It seems there is a frame mismatch.

    def set_robot(self) -> None:
        
        gripper = ParallelGripper(
            end_effector_prim_path="/World/ur5e_gripper/robotiq_85_left_finger_tip_link",
            joint_prim_names=["robotiq_85_left_finger_tip_joint", "robotiq_85_right_finger_tip_joint"],
            joint_opened_positions=np.array([0.1, 0.1]),
            joint_closed_positions=np.array([0.0, 0.0]),
            action_deltas=np.array([0.25, 0.25]))
        
        manipulator = SingleManipulator(prim_path="/World/ur5e_gripper",
                                        name="ur5e",
                                        end_effector_prim_name="End_Effector",
                                        gripper=gripper,
                                        position=np.array([0, 0, 0]), 
                                        orientation=np.array([0.7071068, 0, 0, 0.7071068]))  # Here I changed!
        joints_default_positions = np.zeros(12)
        manipulator.set_joints_default_state(positions=joints_default_positions)
        return manipulator

I would appreciate it if you give me some advice which is the simplest & best way to handle this.

Hi @PARKBONG -
The issue you’re experiencing might be due to the way you’re setting the orientation of the robot. In your code, you’re setting the orientation as a quaternion. Quaternions are a way to perform 3D rotations and are defined by four numbers [x, y, z, w].

The quaternion you’re using [0.7071068, 0, 0, 0.7071068] corresponds to a rotation of 90 degrees around the x-axis. If you want to rotate the robot around the up-axis (which is usually the z-axis), you would need to use a different quaternion.

For a 90 degrees rotation around the z-axis, you can use the quaternion [0, 0, 0.7071068, 0.7071068].

So, you should change the orientation line in your code to:

orientation=np.array([0, 0, 0.7071068, 0.7071068])  # Here I changed!

Please note that the exact axis might depend on the coordinate system used in your specific setup. If the up-axis is not the z-axis in your case, you might need to adjust the quaternion accordingly.

Can you share the whole code?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.