The objective of this tutorial is to introduce some key concepts pertaining the inverse kinematics for the ABB robot solved by the Jeneratiff digital design and fabrication library. While this is a theoretical chapter the ideas are very important for understanding the behavior or misbehavior of the machine.

## Preparation Work

Use the previous setup to establish the robot model and its visualization as the forward kinematics tutorial. In addition, you will need to place a point into the Rhino document and import it into Grasshopper. Construct a plane using the imported point as origin and World X as normal vector.

In an Inverse Kinematics solver plug the Robot model and Target plane upon which you shall receive 8x joint angle vectors (packed in a special data structure for easy transport). Below is the output of the eight difference configurations as dumped by the Inverse Kinematics solver.

1 2 3 4 5 6 7 8 9 10 |
// Joint 1 Joint 2 Joint 3 Joint 4 Joint 5 Joint 6 Pose Type Result 24.868 -0.302 -4.768 100.794 -25.347 -11.912 B:1 E:1 W:0 Success 24.868 80.138 -164.591 155.029 -84.969 -87.662 B:1 E:0 W:0 Success 24.868 -0.302 -4.768 -79.206 25.347 168.088 B:1 E:1 W:1 Success 24.868 80.138 -164.591 -24.971 84.969 92.338 B:1 E:0 W:1 Success -155.132 -80.138 -4.768 155.046 94.621 87.853 B:0 E:0 W:1 Success -155.132 0.302 -164.591 120.293 29.145 146.222 B:0 E:1 W:1 Success -155.132 -80.138 -4.768 -24.954 -94.621 -92.147 B:0 E:0 W:0 Success -155.132 0.302 -164.591 -59.707 -29.145 -33.778 B:0 E:1 W:0 Success |

The inverse kinematics solver takes in a full coordinate system (of the TCP with respect to the robot’s basis) and outputs the angles of the robot joints. It is a function map of the form f( [pos, rot] ) → [ j1, j2, j3, j4, j5, j6 ]. However, due to geometric symmetries there are eight potential different poses that satisfy this relationship. The figure below illustrated those configurations. Notice that you can use a List Item component and a slider to select the joint vector from an inverse kinematics solution as if it was a regular list.

We can more intuitively grasp the symmetries if we focus on the base (J1), elbow (J3) and wrist (J4) joints. For a given joint angle vector we can translate those angle by +/-180 around the circle while retaining the same forward kinematics solution. For instance we can turn the base 180 degrees and still reach the same plane, or pull the elbow above or below the line connecting J2 and J4, or twist the wrist half a circle around. In total the combinations of three binary variables produces 2^3 = 8 combinations.

## When Solutions Fall Apart

Theoretically there are infinite inverse kinematics solution due to the cyclical nature of joint rotations. But as mentioned there are eight *potential* solutions and in some cases none. In the example below the Target point is beyond the reach of the robot and as such all solutions are flagged as invalid. The robot joints are stretched along the line from J2 to the Target frame and an orange line shows the error distance.

In addition, there are scenarios where the internal limits of the joint angles are violated. In those cases the robot joints that cannot achieve the theoretical configuration are marked red as seen below. The text dump of the inverse kinematics solution presents all the cases where a solution is invalid along with the joint that failed to resolve.