Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCE 441: Computer Graphics Forward/Inverse kinematics

Similar presentations


Presentation on theme: "CSCE 441: Computer Graphics Forward/Inverse kinematics"— Presentation transcript:

1 CSCE 441: Computer Graphics Forward/Inverse kinematics
Jinxiang Chai

2 Outline Animation basics: Forward kinematics Inverse kinematics

3 Kinematics The study of movement without the consideration of the masses or forces that bring about the motion

4 Animation Robot arm animation (click here)
Pixar lamp animation (click here)

5 Degrees of Freedom (Dofs)
The set of independent displacements that specify an object’s pose

6 Degrees of Freedom (Dofs)
The set of independent displacements that specify an object’s pose How many degrees of freedom when flying?

7 Degrees of Freedom (Dofs)
The set of independent displacements that specify an object’s pose How many degrees of freedom when flying? So the kinematics of this airplane permit movement anywhere in three dimensions Six x, y, and z positions roll, pitch, and yaw

8 Degrees of Freedom How about this robot arm? Click (here) Six
2-shoulder, 1-elbow, 3-wrist

9 Configuration Space vs. Work Space
The space that defines the possible object configurations Degrees of Freedom The number of parameters that are necessary and sufficient to define position in configuration Work space The space in which the object exists Dimensionality R3 for most things, R2 for planar arms

10 Forward vs. Inverse Kinematics
Forward Kinematics Compute configuration (pose) given individual DOF values Inverse Kinematics Compute individual DOF values that result in specified end effector’s position

11 Example: Two-link Structure
Two links connected by rotational joints θ2 l2 l1 θ1 X=(x,y) End Effector Base

12 Example: Two-link Structure
Animator specifies the joint angles: θ1θ2 Computer finds the position of end-effector: x θ2 l2 l1 θ1 X=(x,y) End Effector Base (0,0) x=f(θ1, θ2)

13 Example: Two-link Structure
Animator specifies the joint angles: θ1θ2 Computer finds the position of end-effector: x θ2 θ2 l2 l1 θ1 X=(x,y) End Effector Base (0,0) x = (l1cosθ1+l2cos(θ2+ θ2) y = l1sinθ1+l2sin(θ2+ θ2))

14 Forward Kinematics Create an animation by specifying the joint angle trajectories θ2 θ2 l2 l1 θ1 X=(x,y) End Effector Base (0,0) θ1 θ2

15 Forward Kinematics A 2D lamp with 6 degrees of freedom lower arm
middle arm Upper arm base 15

16 Inverse Kinematics What if an animator specifies position of end-effector? θ2 θ2 l2 l1 End Effector θ1 X=(x,y) Base (0,0)

17 Inverse Kinematics Animator specifies the position of end-effector: x
Computer finds joint angles: θ1θ2 θ2 θ2 l2 l1 End Effector θ1 X=(x,y) Base (0,0) (θ1, θ2)=f-1(x)

18 Inverse Kinematics Animator specifies the position of end-effector: x
Computer finds joint angles: θ1θ2 θ2 θ2 l2 l1 End Effector θ1 X=(x,y) Base (0,0)

19 Why Inverse Kinematics?
Motion capture Basic tools in character animation - key frame generation - animation control - interactive manipulation Computer vision (video-based mocap) Robotics Bioinfomatics (Protein Inverse Kinematics) Etc.

20 Inverse Kinematics Given end effector’s positions, compute required joint angles In simple case, analytic solution exists Use trig, geometry, and algebra to solve

21 Inverse Kinematics Analytical solution only works for a fairly simple structure Numerical/iterative solution needed for a complex structure

22 Numerical Approaches Inverse kinematics can be formulated as an optimization problem

23 Function Optimization
Finding the minimum for nonlinear functions F(x) x

24 Optimization As a Tool How to use optimization to solve the following linear system? 3x + 2y = 5; 4x – 5y = 6

25 Optimization As a Tool How to use optimization to solve the following linear system? 3x + 2y = 5; 4x – 5y = 6 Define a function: F(x,y) = (3x+2y-5)2+(4x-5y-6)2

26 Optimization As a Tool How to use optimization to solve the following linear system? 3x + 2y = 5; 4x – 5y = 6 Could be nonlinear equations! Define a function: F(x,y) = (3x+2y-5)2+(4x-5y-6)2 Finding the minimum for F(x,y) : x+,y+= argminx,y (3x+2y-5)2+(4x-5y-6)2

27 Optimization As a Tool How to use optimization to solve the following linear system? f(x, y) = 0; g(x,y) = 0 Could be nonlinear equations! Define a function: F(x,y) = f(x,y)2+g(x,y)2 Finding the minimum for F(x,y) : x+,y+= argminx,y f(x,y)2+g(x,y)2

28 Formulation So how to convert the IK process into an optimization function? Find the pose satisfying: θ2 θ2 l2 l1 θ1 C=(Cx,Cy) Base (0,0)

29 hypothesized position
Iterative Approaches Find the joint angles θ that minimizes the distance between the hypothesized character position and user specified position hypothesized position specified position θ2 θ2 l2 l1 θ1 C=(Cx,Cy) Base (0,0)

30 Iterative Approaches Find the joint angles θ that minimizes the distance between the hypothesized character position and user specified position θ2 θ2 l2 l1 θ1 C=(c1,c2) Base (0,0)

31 Iterative Approaches Mathematically, we can formulate this as an optimization problem: The above problem can be solved by many nonlinear optimization algorithms: - Steepest descent - Gauss-newton - Levenberg-marquardt, etc

32 Gradient-based Optimization

33 Gauss-Newton Approach
Step 1: initialize the joint angles with Step 2: update the joint angles until the solution converges:

34 Gauss-Newton Approach
Step 1: initialize the joint angles with Step 2: update the joint angles until the solution converges: How can we decide the amount of update? 34

35 Gauss-Newton Approach
Step 1: initialize the joint angles with Step 2: update the joint angles:

36 Gauss-Newton Approach
Step 1: initialize the joint angles with Step 2: update the joint angles: Known!

37 Gauss-Newton Approach
Step 1: initialize the joint angles with Step 2: update the joint angles: Taylor series expansion

38 Gauss-Newton Approach
Step 1: initialize the joint angles with Step 2: update the joint angles: Taylor series expansion rearrange

39 Gauss-Newton Approach
Step 1: initialize the joint angles with Step 2: update the joint angles: Taylor series expansion: linear approximation rearrange Can you solve this optimization problem?

40 Gauss-Newton Approach
Step 1: initialize the joint angles with Step 2: update the joint angles: Taylor series expansion rearrange This is a quadratic function of

41 Gauss-Newton Approach
Optimizing an quadratic function is easy It has an optimal value when the gradient is zero

42 Gauss-Newton Approach
Optimizing an quadratic function is easy It has an optimal value when the gradient is zero J b Δθ Linear equation!

43 Gauss-Newton Approach
Optimizing an quadratic function is easy It has an optimal value when the gradient is zero J b Δθ

44 Gauss-Newton Approach
Optimizing an quadratic function is easy It has an optimal value when the gradient is zero J b Δθ

45 Jacobian Matrix Dofs (N) Jacobian is a M by N matrix that relates differential changes of θ to changes of C (Δθ-->Δf) Jacobian maps the velocity in joint space to velocities in Cartesian space Jacobian depends on current state The number of constraints (M)

46 Jacobian Matrix Jacobian maps the velocity in joint angle space to velocities in Cartesian space (x,y) θ2 θ1

47 Jacobian Matrix Jacobian maps the velocity in joint angle space to velocities in Cartesian space (x,y) A small change of θ1 and θ2 results in how much change of end-effector position (x,y) θ2 θ1

48 Jacobian Matrix Jacobian maps the velocity in joint angle space to velocities in Cartesian space (x,y) A small change of θ1 and θ2 results in how much change of end-effector’s position (x,y) θ2 θ1

49 Jacobian Matrix Jacobian maps the velocity in joint angle space to velocities in Cartesian space (x,y) A small change of θ1 and θ2 results in how much change of end-effector position (x,y) θ2 θ1

50 Jacobian Matrix Jacobian maps the velocity in joint angle space to velocities in Cartesian space (x,y) A small change of θ2 results in how much change of end-effector position f=(x,y) θ2 θ1

51 Jacobian Matrix: 2D-link Structure
θ2 θ2 l2 l1 θ1 C=(c1,c2) Base (0,0)

52 Jacobian Matrix: 2D-link Structure
θ2 θ2 l2 l1 θ1 C=(c1,c2) Base (0,0) f2 f1

53 Jacobian Matrix: 2D-link Structure
θ2 θ2 l2 l1 θ1 C=(c1,c2) Base (0,0)

54 Jacobian Matrix: 2D-link Structure
θ2 θ2 l2 l1 θ1 C=(c1,c2) Base (0,0)

55 Jacobian Matrix: 2D-link Structure
θ2 θ2 l2 l1 θ1 C=(c1,c2) Base (0,0)

56 Jacobian Matrix: 2D-link Structure
θ2 θ2 l2 l1 θ1 C=(c1,c2) Base (0,0)

57 Jacobian Matrix: 2D-link Structure
θ2 θ2 l2 l1 θ1 C=(c1,c2) Base (0,0)

58 Gauss-Newton Approach
Step 1: initialize the joint angles with Step 2: update the joint angles: Step size: specified by the user

59 When to stop Option #1: When the change of solution from previous iteration to the current one is below a user-specified threshold. Option #2: When the number of iteration reaches a user-specified threshold. Option #3: either #1 or #2 is satisfied. 59

60 Iterative Approaches for IK
Mathematically, we can formulate this as an optimization problem: The above problem can be solved by many nonlinear optimization algorithms: - Steepest descent - Gauss-newton - Levenberg-marquardt, etc

61 C/C++ Optimization Library
levmar : Levenberg-Marquardt nonlinear least squares algorithms in C/C+ - Works with/without analytical Jacobian matrix - Speeds up the optimization process with analytical Jacobian matrix.

62 Another Example A 2D lamp character 62

63 Another Example A 2D lamp character 63

64 ? Forward Kinematics A 2D lamp character
Given , , how to compute the global position of the point A? 64

65 ? Forward Kinematics A 2D lamp with 6 degrees of freedom lower arm
middle arm ? Upper arm base

66 Inverse Kinematics A 2D lamp with 6 degrees of freedom lower arm
middle arm Upper arm If you do inverse kinematics with position of this point What’s the size of Jacobian matrix? base

67 Inverse Kinematics A 2D lamp with 6 degrees of freedom lower arm
middle arm Upper arm If you do inverse kinematics with position of this point What’s the size of Jacobian matrix? 2-by-6 matrix base

68 Human Characters 68

69 Inverse Kinematics Analytical solution only works for a fairly simple structure Iterative approach needed for a complex structure

70 Inverse Kinematics Is the solution unique?
Is there always a good solution?

71 Ambiguity of IK Multiple solutions

72 Ambiguity of IK Infinite solutions

73 Failures of IK Solution may not exist

74 Inverse Kinematics Generally ill-posed problem when the number of Dofs is higher than the number of constraints

75 Inverse Kinematics Generally ill-posed problem when the number of Dofs is higher than the number of constraints Additional objective Minimal Change from a reference pose θ0

76 Inverse Kinematics Generally ill-posed problem when the number of Dofs is higher than the number of constraints Additional objective Minimal Change from a reference pose θ0

77 Minimize the difference between the solution and a reference pose
Inverse Kinematics Generally ill-posed problem when the number of Dofs is higher than the number of constraints Additional objective Minimal Change from a reference pose θ0 Minimize the difference between the solution and a reference pose Satisfy the constraints

78 Inverse Kinematics Generally ill-posed problem when the number of Dofs is higher than the number of constraints Additional objective Minimal Change from a reference pose θ0 Naturalness g(θ) (particularly for human characters)

79 Inverse Kinematics Generally ill-posed problem when the number of Dofs is higher than the number of constraints Additional objective Minimal Change from a reference pose θ0 Naturalness g(θ) (particularly for human characters)

80 How natural is the solution pose?
Inverse Kinematics Generally ill-posed problem when the number of Dofs is higher than the number of constraints Additional objective Minimal Change from a reference pose θ0 Naturalness g(θ) (particularly for human characters) Satisfy the constraints How natural is the solution pose?

81 Interactive Human Character Posing
Video (click here)

82 Summary of IK Very simple structure allows an analytic solution
Most of complex articulated figures requires a numerical solution May not always get the “right” solution - need additional objectives


Download ppt "CSCE 441: Computer Graphics Forward/Inverse kinematics"

Similar presentations


Ads by Google