# Chapter 15: Forward and Inverse Kinematics ## About This Chapter UR is a six-axis robot. Therefore, there is no one-to-one correspondence between: - TCP position - Individual joint angles This chapter explains: - Forward kinematics - Inverse kinematics - Singularities These are important fundamentals for understanding moveL, servoL, and Force Mode. --- # 15.1 Joint Space and Cartesian Space UR operates in two main spaces: ``` Joint Space [q1 q2 q3 q4 q5 q6] ``` and ``` Cartesian Space [x y z rx ry rz] ``` moveJ controls motion in Joint Space. moveL controls motion in Cartesian Space. --- # 15.2 Forward Kinematics Forward kinematics calculates: ``` Joint angles ↓ TCP position ``` For example: ``` q ↓ FK ↓ Pose ``` The result is unique. For the same joint angles, the TCP will always be at the same position. --- # 15.3 Inverse Kinematics Inverse kinematics calculates: ``` TCP ↓ Joint angles ``` In other words: ``` Pose ↓ IK ↓ q ``` Unlike forward kinematics, the solution is not unique. --- # 15.4 Why Multiple Solutions Exist For example, the robot may reach the same location with an: ``` Elbow-up configuration ``` or an: ``` Elbow-down configuration ``` ``` ○ / Base ``` and ``` ○ \ Base ``` may have the same TCP position but different joint angles. --- # 15.5 Wrist Flip Multiple solutions also exist for the wrist. For example, a wrist rotation of: ``` 180° ``` may leave the TCP pose unchanged. Thus, multiple IK solutions can exist. --- # 15.6 Why moveL Is Difficult moveL performs: ``` Pose ↓ IK ↓ Joint ``` at every control cycle. If IK cannot be solved, motion stops partway through. --- # 15.7 Unreachable Positions For example, if a target is: ``` Outside the workspace ``` no IK solution exists. ``` Pose ↓ × ``` moveL fails. --- # 15.8 Joint Limits Even within the workspace, an IK solution may not exist if reaching the target would exceed a: ``` Joint Limit ``` For example, if J1 would need to rotate: ``` 400° ``` the target cannot actually be reached. --- # 15.9 Singularities A singularity is a condition in which: ``` Small TCP movement ↓ Very large joint rotation ``` is required. Because the required joint velocity approaches infinity, the controller imposes speed limits. --- # 15.10 Wrist Singularity The best-known example is a: Wrist Singularity. When the wrist axes become aligned, an orientation degree of freedom is lost. moveL may slow down, or speed limits may be applied. --- # 15.11 Elbow Singularity A configuration in which the arm is fully extended is also a singularity. ``` Base ──────TCP ``` In such a fully extended configuration, control tends to become unstable. --- # 15.12 Differences Between moveJ and moveL moveJ controls the joints directly and does not use IK. It is therefore relatively easier to avoid singularities. moveL solves IK at every cycle and is more susceptible to singularities. --- # 15.13 getInverseKinematics() With ur_rtde, IK can be calculated in advance: ```python q = rtde_c.getInverseKinematics(pose) ``` This enables a safer design: ``` Before moveL ↓ Check IK ↓ Abort if unsuccessful ``` --- # 15.14 Forward Kinematics Conversely: ```python pose = rtde_c.getForwardKinematics(q) ``` can be used to determine the TCP position from joint angles. This is useful in teaching software and similar applications. --- # 15.15 Safety Check For example: ```python rtde_c.isPoseWithinSafetyLimits(pose) ``` can be used to check in advance whether a pose is within the workspace and configured safety limits. Checking before executing a move can reduce errors. --- # 15.16 Typical Usage Example ``` Generate Pose ↓ Safety Check ↓ IK ↓ MoveL ``` This sequence is recommended. --- # 15.17 Implementation in ur_ctrl.py A high-level API could expose methods such as: ```python check_pose() inverse_kinematics() forward_kinematics() ``` This would eliminate the need for users to call the RTDE API directly. Automatically performing safety checks and IK checks before a move is also an effective design. --- # 15.18 Common Problems - A target thought to be reachable has no IK solution. - moveL fails after changing the tool. - Motion stops upon reaching a joint limit. - Speed drops dramatically near a singularity. - A large rotation occurs when only a small orientation change was intended. --- # Summary Forward kinematics maps: ``` Joint ↓ TCP ``` Inverse kinematics maps: ``` TCP ↓ Joint ``` moveJ controls Joint Space and therefore does not require IK. In contrast, moveL, servoL, and Force Mode control Cartesian Space and are affected by IK, joint limits, and singularities. For highly reliable applications, it is therefore recommended to check IK feasibility and safety limits before executing a move. The next chapter explains the differences between the Safety System, Protective Stop, Emergency Stop, and Fault, as well as error recovery from Python.