I want to orient the robot endeffector using a direction vector that I calculate myself. The robot will always start from the same position with the endeffector pointing straight down. I already have a function that calculates a direction vector that is in the orientation that I want the endeffector to be. I have used the code in this answer to calculate the quaternion from the starting orientation to the goal orientation: https://stackoverflow.com/questions/1171849/finding-quaternion-representing-the-rotation-from-one-vector-to-another. For some example orientation the quaternion that the code calculates is:
0.38268343 0 0 0.92387953
and the correct quaternion that I want is:
0 0.92387953 0.38268343 0
Unfortunately, when I pass the data on to the robot the robot has the right orientation but spins it's endeffector 180 degrees. My goal is to keep the endeffector from spinning and just rotate around it self in the angle that I want it to. I have multiple questions about this:
- What is the reason for the rotation around itself?
- How would I make sure the robot only moves to the correct orientation but does not actually change the way the end effector is facing?
- How can I control the rotation to make the endeffector rotate at an angle that I want? For example: 20 degrees clock or counter clockwise.