Inverse kinematics is an animation technique where an
animator specifies a **desired end position** of a character's arm/leg,
etc. and wants to compute the **proper joint configuration** to reach
this position.
In this example, we wish to have a character **trace
the word "animation" on a chalkboard** with its hand. The character
is modeled as an articulated rigid body attached by joints using quaternions
for rotations. Given a position on the chalkboard at a given time
during the animation, we need to calculate the proper shoulder, elbow, and
wrist rotations of the right arm so that the hand is touching the correct
place on the board at the right time.
In general, there are an **infinite amount of
solutions** to this problem since a single hand position yields an
infinite amount of arm poses. To solve this we apply an iterative
technique to help us converge to a solution representing the "shortest path"
of joint rotations.
We first define a **transformation matrix** that
converts a point in the world reference frame to the hand reference frame
through a series of translations and rotations. For each iteration, we
compute the current **Jacobian** matrix of this transformation matrix
which contains all partial derivatives relative to each input joint angle.
The Jacobian represents an *instantaneous* relationship between the arm
angle velocities and hand position velocity.
After computing an approximate inverse to the Jacobian
using a **pseudo-inverse** technique, we are able to solve for an angle
change given a desired hand position change. This allows us to
iteratively move the hand to a desired position on the chalkboard by
applying our calculated angle changes.
As a side task, we also used an alternative animation
technique called **cyclic coordinate descent** to solve the same problem.
This method solves the joint configuration analytically from one end of the chain to the
other. This method is much faster than the iterative solution but sometimes
yields unpleasant results (arm is bent strangely). |