FITC Preview – IK With Joint Limits

Continuing the preview of my FITC talk, joint limits are an important part of any IK solver. They may be implemented by modifying the math for the solution or post-solution adjustment via angle offsets. The latter approach is less elegant but conceptually simpler. I will illustrate a simple implementation for the two-bone (in-plane) solver with lower joint limits in the range [0,-pi] and upper limits in the range [0,pi]. If the root bone requires more flexibility, it is likely that it will be completely unconstrained. This is more flexibility than would probably be required in most production rigs.

The following screen shot illustrates an example where the root bone is constrained between -3*pi/5 and pi/2. The second bone is constrained between -pi/2 and 3*pi/4. Note that all constraints are relative to the parent orientation. If the root bone is not connected to any other part of a rig, its orientation is relative to the positive x-axis.

The target can not be reached with this configuration, so the solver attempts to rotate the root bone in the direction of the target, then rotate the second bone by pi to point as near as possible to the target. The root bone, however, can not be rotated beyond its upper limit of pi/2. The solver then attempts to rotate the second bone in the direction of the target, but can not exceed the upper limit of 3*pi/4, so this is as close at the solver can resolve the end effector to the target with the current joint limits.

There are more issues to discuss. It is possible to keep moving the target upwards until it crosses the negative x-axis at which point the solver ‘flips’ the orientation. The root bone points upwards and to the left, based on its lower limit. This behavior is due to the solver being ‘history independent.’ The solver has no visibility to prior solutions when attempting the current solution.

I will discuss history-independent vs. history-dependent solvers and how the ‘flip’ could be avoided. It is also the case that any feasible solution has an alternate solution. A typical solution to this particular problem causes the chain to always be oriented clockwise or counter-clockwise when there are ‘bends’ in the chain. With history-independent solvers for unconstrained problems, there is no reason to prefer one solution over the other.

In my talk, I will provide some indications where one solution might be preferred over the other in the case of joint limits. Details, details, details … it’s all in the details 🙂

See you in Toronto.