Fundamentals of Computer Animation Inverse Kinematics
Example: 2-Link Structure
Forward Kinematics
Forward Kinematics
Example: 2-Link Structure
Inverse Kinematics
Inverse Kinematics
Inverse Kinematics : When useful? Want character to push a button or take a step can give the animator a good first step that he/she can later fine tune
Inverse Kinematics (IK) Examples Balance – keep center of mass over support polygon Control – positions vaulter’s hands on line between shoulder and vault Compute knee angles that will give runner the right leg length
What Makes IK Hard? Goal of "natural looking" motion Singularities Redundancy
Inverse Kinematics
Inverse Kinematics
Inverse Kinematics
What is Inverse Kinematics? Forward Kinematics End Effector ? Base
What is Inverse Kinematics? End Effector Base
Inverse Kinematics (IK) Analytical Solutions Iterative Methods (optimization-based methods) Incremental Constructions (matrix inversion techniques) Textbook
Inverse Kinematics (IK) Analytical Solutions Iterative Methods (optimization-based methods) Incremental Constructions (matrix inversion techniques)
Analytical Solutions
What does looks like? ? Base End Effector
Solution to Our example Number of equations : 2 Unknown variables : 3 Infinite number of solutions !
Redundancy System DOF > End Effector DOF Our example System DOF = 3
Redundancy A redundant system has infinite number of solutions Human skeleton has 70 DOF Ultra-super redundant How to solve highly redundant system?
Inverse Kinematics (IK) Analytical Solutions Iterative Methods (optimization-based methods) Incremental Constructions (matrix inversion techniques)
Iterative Methods for Complex IK Analytical solutions for IK problems are desirable because of their speed and exactness of solution. However, for complex kinematic problems, an analytical solution may not be possible. Simply adding another joint to the system greatly increases the complexity. A more general solution Iterative Methods
Iterative Methods for Complex IK In an iterative solution, small adjustments are made to the joints to solve the inverse kinematics in a series of steps. This process is finished when the end effector reaches the goal within some tolerance.
Matrix Inversion or Optimization? The robotics community has established methods for solving the IK of an arbitrary system. Matrix inversion techniques: Complicated process Computationally very expensive Various problems due to numerical instabilities. Optimization-based methods: Avoid matrix inversion completely. Attempt to minimize the error in the system. More likely to produce Real-Time results Optimization-based IK method: Minimize the distance between the goal point and the end effector of the chain. How? by adjusting the joint angles CCD Method
Cyclic-Coordinate Descent (CCD) Method (NOT in textbook) Wang and Chen. “A Combined Optimization Method for Solving the Inverse Kinematics Problem of Mechanical Manipulators.” IEEE Transactions on Robotics and Automation. Vol. 7, No. 4, August 1991, pp. 489-499. Welman, Chris. Inverse Kinematics and Geometric Constraints for Articulated Figure Manipulation. Masters Thesis,Simon Fraser University, 1993.
Cyclic-Coordinate Descent (CCD) Method Minimizing the system error by adjusting each joint angle one at a time. Starts at the last link in the chain and works backwards, adjusting each joint along the way.
Cyclic-Coordinate Descent (CCD) Method Create vector RE R: root of current link E: effector position Create Vector RD D: desired endpoint Angle a, so that RE becomes RD? PS : Common in games player needs to face the opponent
Cyclic-Coordinate Descent (CCD) Method Direction to rotate about R?
Now move one link up the chain and repeat the process, continuing up the chain until the base joint is reached…
Cyclic-Coordinate Descent (CCD) Method This process is repeated until either the end effector is close enough to the desired position or the loop has repeated a set number of times. This break count is needed to allow for positions that are not reachable.
} while (quit_condition) do { Move one link up the chain; } while (quit_condition) // QUIT IF I AM CLOSE ENOUGH OR BEEN RUNNING LONG ENOUGH quit_condition = (tries++ < MAX_IK_TRIES && VectorSquaredDistance(&curEnd, &desiredEnd) > IK_POS_THRESH); #define MAX_IK_TRIES 100 // TIMES THROUGH THE CCD LOOP #define IK_POS_THRESH 1.0f // THRESHOLD FOR SUCCESS
Improving CCD (1) RESTRICTIONS ON DEGREES OF FREEDOM In many character hierarchies you may want to impose limits on the degrees of freedom (DOF) of an individual joint. This would keep an individual joint from rotating into a position that is physically impossible for a character to achieve. In some other IK methods, this can be a bit complicated. However, in the CCD method, such restrictions are easy!
Improving CCD (1) RESTRICTIONS ON DEGREES OF FREEDOM Each joint is a single analytical geometry problem any limits on individual joints are simply figured into the problem. Updating the joint rotation: If (joint is outside the limits) then joint is clamped to those limit angles. The rest of the joints are then used to satisfy the problem during later steps.
Improving CCD (2) DAMPING The CCD method will rotate an individual joint to any angle needed to satisfy the problem at any step. Since the routine starts from the last joint and works in, the method tends to favor later joints. This bias may not always look natural.
Improving CCD (2) DAMPING Further, since each joint can swing wildly at each step, kinks are sometimes present in the resulting chain. By limiting the amount a single joint angle can change at each step, both of these effects can be controlled somewhat. Let’s see the effect both DOF restrictions and damping
Inverse Kinematics (IK) Analytical Solutions Iterative Methods (optimization-based methods) Incremental Constructions (matrix inversion techniques)
IK Incremental Constructions Configurations too complex for analytical solution ? Motion can be incrementally constructed At each time step, compute best way to change each joint angle to match the desired endpoint This computation forms the matrix of partial derivatives (Jacobian)
IK Incremental Constructions
IK -> Incremental Constructions w2 d2 End Effector q2 w2 x d2 - Compute instantaneous effect of each joint - Linear approximation to curvilinear motion - Find linear combination to take end effector towards goal position
IK -> Incremental Constructions
IK -> Incremental Constructions Solution only valid for an instantaneous step Angular affect is really curved, not straight line Once a step is taken, need to recompute solution
IK Incremental Constructions : Mathematics Unknowns End effector position and orientation Joint angles
IK Incremental Constructions : Mathematics V vector of linear and rotational velocities and represents the desired change in the end effector Desired change difference between current position/orientation to that specified by the goal configuration Unknowns (joint angle velocities)
IK Incremental Constructions : Mathematics
Using the Jacobian
IK Incremental Constructions : Example
IK Incremental Constructions : Example
Conflict Between Multiple Goals base
Conflict Between Goals base
Conflict Between Goals base
Conflict Between Goals base
Conflict Between Goals base
Handling Multiple Goals Weighted sum of each goal potential function Jacobian-based method Same formulation No weighting
Summary