Presentation is loading. Please wait.

Presentation is loading. Please wait.

Character Animation Forward and Inverse Kinematics

Similar presentations


Presentation on theme: "Character Animation Forward and Inverse Kinematics"— Presentation transcript:

1 Character Animation Forward and Inverse Kinematics
CSE 3541 Matt Boggus

2 Overview Concepts Defining forward and inverse kinematics
Example calculations for forward kinematics Inverse kinematics algorithms Other topics Ragdoll physics Dynamics

3 Simplifies motion specification
Hierarchical Modeling Parent-child relationship Simplifies motion specification Relative motion Constrains motion Reduces dimensionality

4 Modeling & animating hierarchies
3 aspects Linkages & Joints – the relationships Data structure – how to represent such a hierarchy Converting local coordinate frames into global space

5 Terms Joint – allowed relative motion & parameters
Joint Limits – limit on valid joint angle values Link – object involved in relative motion Linkage – entire joint-link hierarchy End effector – most distant link in linkage Pose – configuration of linkage using given set of joint angles

6 Forward vs. Inverse Kinematics
Forward Kinematics Input: joint angles Output: link positions and orientations end effector position Inverse Kinematics Input: end effector Output: joint angles

7 Joints – relative movement
Every joint allowing motion in one dimension is said to have one degree of freedom (DOF) Example: flying (Six DOF) x, y, and z positions (prismatic or translation) roll, pitch, and yaw (revolute or rotation)

8 Hierarchical structure

9 Forward Kinematics: A Simple Example
Forward kinematics map as a coordinate transformation The body local coordinate system of the end-effector was initially coincide with the global coordinate system Forward kinematics map transforms the position and orientation of the end-effector according to joint angles Example from Jehee Lee

10 A Chain of Transformations

11 Thinking of Transformations
In a view of global coordinate system

12 Thinking of Transformations
In a view of global coordinate system

13 Thinking of Transformations
In a view of global coordinate system

14 Thinking of Transformations
In a view of global coordinate system

15 Thinking of Transformations
In a view of global coordinate system

16 Thinking of Transformations
In a view of body-attached coordinate system

17 Thinking of Transformations
In a view of body-attached coordinate system

18 Thinking of Transformations
In a view of body-attached coordinate system

19 Thinking of Transformations
In a view of body-attached coordinate system

20 Thinking of Transformations
In a view of body-attached coordinate system

21 Real-time forward kinematics
QWOP

22 Inverse kinematics Given goal position for end effector
Compute internal joint angles Simple linkages  analytic solution Otherwise  numeric iterative solution

23 IK solution uniqueness
Zero One Two Many Images from

24 Inverse kinematics – spaces
Configuration space Reachable workspace

25 Analytic Inverse Kinematics
Given target position (X,Y) Compute angle with respect to origin of linkage Solve for angle of rotation for each joint See reference text for solution and derivation

26 IK - numeric Solve iteratively – numerically solve for step toward goal Remember: a pose is the position and orientation of all links for given a set of joint angles - Compute the desired change from this pose Vector to the goal, or Minimal distance between end effector and goal - Compute set of changes to joint angles to make that change

27 Inverse Kinematics - Numeric
Given Current configuration Goal position Determine Goal vector Positions & local coordinate systems of interior joints (in global coordinates) Solve for change in joint angles & take small step, optionally clamp acceleration or clamp velocity Repeat until: Within epsilon of goal Stuck in some configuration Taking too long

28 Given the values for each xi, we can compute each yi
IK math notation Given the values for each xi, we can compute each yi

29 IK – chain rule The change in output variables (y) relative to the change in input variables (x)

30 Inverse Kinematics - Jacobian
Desired motion of end effector Unknown change in articulation variables The Jacobian is the matrix relating the two: describing how each coordinate changes with respect to each joint angle in our system

31 Inverse Kinematics - Jacobian
Change in position Change in orientation Change in articulation variables Jacobian

32 If J is not square, use of pseudo-inverse of Jacobian
Solving If J square, compute inverse, J-1 If J is not square, use of pseudo-inverse of Jacobian

33 Another example linkage

34 IK – compute positional change vectors induced by changes in joint angles
Instantaneous positional change vectors Desired change vector One approach to IK computes linear combination of change vectors that equal desired vector

35 Jacobian psuedocode while ( Distance(endEffector,goal) > threshold && time < timeLimit) { vel = goal – endEffector; j = ComputeJacobian(linkage); pj = ComputePseudoinverse(j); deltaTheta = pj * vel; rotateJoints(deltaTheta,linkage); } In addition to the reference text, should you want to implement this I also recommend

36 IK - singularity Some singular configurations are not so easily recognizable

37 IK – cyclic coordinate descent
Heuristic solution Consider one joint at a time, from outside in At each joint, choose update that best gets end effector to goal position In 2D – pretty simple Goal axisi Ji EndEffector

38 Cyclic-Coordinate Descent
- Starting with the root of our effector, R, to our current endpoint, E. - Next, we draw a vector from R to our desired endpoint, D - The inverse cosine of the dot product gives us the angle between the vectors: cos(a) = RD ● RE

39 Cyclic-Coordinate Descent
Rotate our link so that RE falls on RD

40 Cyclic-Coordinate Descent
Move one link up the chain, and repeat the process

41 Cyclic-Coordinate Descent
The process is basically repeated until the root joint is reached. Then the process begins all over again starting with the end effector, and will continue until we are close enough to D for an acceptable solution.

42 Cyclic-Coordinate Descent

43 Cyclic-Coordinate Descent
We’ve reached the root. Repeat the process

44 Cyclic-Coordinate Descent

45 Cyclic-Coordinate Descent

46 Cyclic-Coordinate Descent

47 Cyclic-Coordinate Descent

48 Cyclic-Coordinate Descent

49 Cyclic-Coordinate Descent
We’ve reached the root again. Repeat the process until solution reached.

50 IK – cyclic coordinate descent
Other orderings of processing joints are possible Because of its procedural nature Lends itself to enforcing joint limits Easy to clamp angular velocity

51 Dynamics – Featherstone equations

52 Dynamics – Featherstone equations
Forces + linkage constraints For the details of the equations, see

53 Approximating dynamics
Archived reference of 2003 Gamasutra article: Archived IO interactive slides: Human particle/stick model Video example Not shown (points can be matched/rigged to 3D character model)

54 Stick position constraint solving
Figure and code from reference in previous slide

55 Stick angle constraint solving
Figure and code from reference in previous slide (x2 – x1) ∙ (x2 – x1) > d -OR- (x2 – x0) ∙ (x1 – x0) < a Where a and d are constants, representing limits

56 Additional slides

57 Derivation for analytical IK example

58 Complex Joints

59 IK – 3D cyclic coordinate descent
EndEffector Goal Ji axisi Projected goal First – goal has to be projected onto plane defined by axis (normal to plane) and EF Second– determine angle at joint


Download ppt "Character Animation Forward and Inverse Kinematics"

Similar presentations


Ads by Google