Forward and Inverse Kinematics

This note covers the core kinematic problems for manipulators. Forward Kinematics (FK) is the process of calculating the end-effector's position and orientation from a given set of joint angles. Inverse Kinematics (IK) is the reverse and more challenging problem of finding the required joint angles to place the end-effector at a desired pose. These calculations rely heavily on the principles of Co-ordinate-Transforms.

Forward Kinematics (FK)

The goal of forward kinematics is to find the function K that maps the robot's configuration in joint space, q, to the end-effector's pose, TBE, in the task space.

TBE=K(q)

The fundamental method for solving the FK problem is by chaining together the homogeneous transformation matrices for each link, starting from the base and moving outward to the end-effector. For a robot with n joints, the transformation is:

TWE=TW1T12Tn1,E

Each transformation Ti1,i represents the pose of frame {i} relative to frame {i1}.

Derivation for a 2R Planar Arm

For a 2-joint planar arm with link lengths L1 and L2, the transformation for the end-effector pose is found by composing the transformations across each link. This involves a rotation by the joint angle followed by a translation along the link's length.

TWE=(R(θ1)Trans(L1,0))(R(θ2)Trans(L2,0))

Multiplying the homogeneous matrices gives us the final end-effector position equations:

xE=L1cosθ1+L2cos(θ1+θ2)yE=L1sinθ1+L2sin(θ1+θ2)

The final orientation of the end-effector is the sum of the joint angles, θ1+θ2. This orientation can be represented in various ways, check EULER ANGLES and Quaternions.

The Denavit-Hartenberg (DH) Convention

For more complex 3D manipulators, creating these transformations manually can be error-prone. The Denavit-Hartenberg (DH) convention provides a standardized, systematic method for assigning coordinate frames to each link and defining the transformation between them using just four parameters. This makes the FK problem much more manageable.


Inverse Kinematics (IK)

Inverse kinematics is the inverse problem: given a desired pose for the end-effector, TBE, we need to find the joint angles, q, that achieve it.

q=K1(TBE)

IK is generally much harder than FK because:

Analytical IK Solution for a 2R Planar Arm

For simple manipulators like a 2R arm, we can find a closed-form analytical solution.

Geometric Approach

The most intuitive method is geometric. We can form a triangle between the robot's base, its elbow joint, and the target end-effector position (x,y).

Using the Law of Cosines, we can solve for the angle at the elbow, which directly relates to θ2:

x2+y2=L12+L222L1L2cos(πθ2)

Since cos(πθ2)=cosθ2, we can rearrange to solve for cosθ2:

cosθ2=x2+y2L12L222L1L2

Because cos(θ2)=cos(θ2), there are two possible solutions for θ2, corresponding to the elbow-up and elbow-down poses. Once we have a value for θ2, we can use trigonometry to solve for θ1.

Algebraic Approach

Alternatively, we can start with the FK equations and solve them algebraically.

x=L1cosθ1+L2cos(θ1+θ2)y=L1sinθ1+L2sin(θ1+θ2)

By squaring and adding these two equations and simplifying with trigonometric identities, we can isolate cosθ2 and arrive at the exact same solution as the geometric method.

Numerical IK Solutions

For manipulators with more joints, an analytical solution is often impossible. In these cases, we rely on iterative numerical methods to find an answer. These methods start with an initial guess for the joint angles and iteratively refine it to minimize the error between the current end-effector pose and the desired pose.

This turns the IK problem into a root-finding or optimization problem. The methods used are forms of non-linear optimization, this is present in NLS.

Velocities and the Jacobian

To understand the relationship between the speed of the joints and the speed of the end-effector, we use the Jacobian matrix. The Jacobian, J(θ), is the matrix that maps joint velocities (θ˙) to end-effector linear and angular velocities (v).

v=J(θ)θ˙

The Jacobian is found by taking the partial derivatives of the forward kinematics equations with respect to each joint variable. For our 2R arm, differentiating the FK equations with respect to time yields:

[x˙y˙]=[L1s1L2s12L2s12L1c1+L2c12L2c12][θ˙1θ˙2]

The 2×2 matrix in this equation is the Jacobian for the 2R planar arm.

Singularity

A manipulator is in a singularity when the Jacobian matrix loses rank and cannot be inverted. At a singularity, there are certain directions in the task space that the end-effector cannot move in, no matter how the joints move. This means the robot has momentarily lost a degree of freedom.

This happens when the determinant of the Jacobian is zero. For the 2R arm, the determinant is det(J)=L1L2sinθ2. This becomes zero when sinθ2=0, which occurs when θ2=0 or θ2=π. Geometrically, this is when the arm is fully stretched out or folded back on itself.

This concept is directly analogous to the problem of Gimbal Lock in EULER ANGLES note, which is a singularity in an orientation representation.