# Inverse kinematic solution with constraints on Rotation for Homogeneous Matrix

I have a 4 degree of freedom robot arm with 3 revolute joints and one prismatic joint as shown in the image:

I can give just Target Point position to the Inverse kinematic chain and find a solution for the 4 DOF robot. Which moves 4 joints to touch the Target Point (Red Dot). However I also want certain condition for the rotation of the last Joint. I don't want to find a solution where the orientation of the last joint rotate along Z axis. In other words orientation of the end effector is important for me.

I am given a H.M to the inverse kinematic chain for the robot show above. My H.M is something like this (Target_x, Target_y, Target_z represents the red dot position):

[X X X Target_x]
[X X X Target_y]
[X X X Target_z]
[0 0 0 1       ]


As you can see Rotation in H.M, not set (I wrote Xs) and solution is found only for the position. But I would like to set a orientation, so that end-effector would not rotate over its own Z axis. In other words rotation in Yaw should be zero. What kind of a rotation matrix should I set inside the H.M. to achieve this?

                  [X_? X_? X_?]
Rotation =     [X_? X_? X_?]
[X_? X_? X_?]


P.S: I am using IKPY inverse kinematic python library which allows me to find inverse kinematic solution by Position, Orientation, or Position and Orientation together. I don't think it is directly related with the question it self, but I wanted to point out.

• Is this a planar arm? What IK library are you using? Are you only trying to get the end-effector to reach the target point or do you want to achieve a target pose? In other words, does the orientation of the end-effector matter?
– Ben
Nov 18, 2021 at 17:09
• @Ben This is UR5 robot. I added a prismatic joint to end of it and simulate it over Gazebo, I gave gave constraints to the first three joint of the UR5. In other words my robot becomes last three joints of UR5 robot, and a prismatic joint. I am using ikpy python library for inverse kinematic solutions. Lastly yes, orientation of the end-effector is important. Nov 18, 2021 at 18:27
• @Ben I edited the question, I simplified the the problem not to confuse you. You can ignore my comment and re-read the question. Nov 18, 2021 at 18:34
• ikpy tutorial for orientation shows aligning an eef axis with a target axis. Is this not what you want? Just choose the axis that gets you aligned the way you want? Nov 18, 2021 at 18:51
• @andymcevoy Problem is not aligning the axis with target axis, problem is giving constraint to the orientation of the I.K solution. Nov 19, 2021 at 6:48