Inverse Kinematics Programming Assignment

Similar documents
Animation. Keyframe animation. CS4620/5620: Lecture 30. Rigid motion: the simplest deformation. Controlling shape for animation

Animation. CS 4620 Lecture 32. Cornell CS4620 Fall Kavita Bala

Articulated Characters

CS 775: Advanced Computer Graphics. Lecture 3 : Kinematics

Kinematics and Orientations

Kinematics. CS 448D: Character Animation Prof. Vladlen Koltun Stanford University

Keyframing an IK Skeleton Maya 2012

This week. CENG 732 Computer Animation. Warping an Object. Warping an Object. 2D Grid Deformation. Warping an Object.

Robots are built to accomplish complex and difficult tasks that require highly non-linear motions.

Computer Animation Fundamentals. Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics

Introduction to Robotics

Kinematical Animation.

Animation. CS 4620 Lecture 33. Cornell CS4620 Fall Kavita Bala

COMPUTER ANIMATION 3 KEYFRAME ANIMATION, RIGGING, SKINNING AND CHARACTER ANIMATION. Rémi Ronfard, Animation, M2R MOSIG

Reading. Topics in Articulated Animation. Character Representation. Animation. q i. t 1 t 2. Articulated models: Character Models are rich, complex

Game Programming. Bing-Yu Chen National Taiwan University

CMSC 425: Lecture 10 Skeletal Animation and Skinning

A 12-DOF Analytic Inverse Kinematics Solver for Human Motion Control

Animation Lecture 10 Slide Fall 2003

ME/CS 133(a): Final Exam (Fall Quarter 2017/2018)

Animations. Hakan Bilen University of Edinburgh. Computer Graphics Fall Some slides are courtesy of Steve Marschner and Kavita Bala

Animation. Traditional Animation Keyframe Animation. Interpolating Rotation Forward/Inverse Kinematics

CS-184: Computer Graphics. Today. Forward kinematics Inverse kinematics. Wednesday, November 12, Pin joints Ball joints Prismatic joints

SM2231 :: 3D Animation I :: Basic. Rigging

Interactive Computer Graphics

Beginners Guide Maya. To be used next to Learning Maya 5 Foundation. 15 juni 2005 Clara Coepijn Raoul Franker

Quaternions and Rotations

Rotations (and other transformations) Rotation as rotation matrix. Storage. Apply to vector matrix vector multiply (15 flops)

Inverse Kinematics (part 1) CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2018

Chapter 5.2 Character Animation

Visualizing Quaternions

ME5286 Robotics Spring 2014 Quiz 1 Solution. Total Points: 30

Quaternions and Rotations

autorob.github.io Inverse Kinematics UM EECS 398/598 - autorob.github.io

Inverse Kinematics. Given a desired position (p) & orientation (R) of the end-effector

Rigging / Skinning. based on Taku Komura, Jehee Lee and Charles B.Own's slides

Animation. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 4/23/07 1

12.1 Quaternions and Rotations

3-D D Euclidean Space - Vectors

Visualizing Quaternions

Advanced Graphics and Animation

INSTITUTE OF AERONAUTICAL ENGINEERING

CS 231. Basics of Computer Animation

Animation. CS 465 Lecture 22

Lecture 18 Kinematic Chains

02/22/02. Assignment 1 on the web page: Announcements. Test login procedure NOW!

Homework 2 Questions? Animation, Motion Capture, & Inverse Kinematics. Velocity Interpolation. Handing Free Surface with MAC

Quaternions and Rotations

Final Project Report

Inverse Kinematics of a Rhino Robot

Industrial Robots : Manipulators, Kinematics, Dynamics

Inertial Measurement Units II!

CS354 Computer Graphics Rotations and Quaternions

CS 445 / 645 Introduction to Computer Graphics. Lecture 21 Representing Rotations

ECE569 Fall 2015 Solution to Problem Set 2

CS354 Computer Graphics Character Animation and Skinning

IMAGE-BASED RENDERING AND ANIMATION

CS 231. Inverse Kinematics Intro to Motion Capture. 3D characters. Representation. 1) Skeleton Origin (root) Joint centers/ bones lengths

Forward kinematics and Denavit Hartenburg convention

Part II: OUTLINE. Visualizing Quaternions. Part II: Visualizing Quaternion Geometry. The Spherical Projection Trick: Visualizing unit vectors.

MTRX4700 Experimental Robotics

Keyframe Animation. Computer Animation. Outline. Computer Animation. Keyframe Animation. Keyframe Animation

COMP371 COMPUTER GRAPHICS

Computer Animation. Courtesy of Adam Finkelstein

Lab # 3 - Angular Kinematics

To Do. History of Computer Animation. These Lectures. 2D and 3D Animation. Computer Animation. Foundations of Computer Graphics (Spring 2010)

Character Animation COS 426

Kinematics of the Stewart Platform (Reality Check 1: page 67)

Motion Capture. Motion Capture in Movies. Motion Capture in Games

Lecture «Robot Dynamics»: Kinematic Control

Jane Li. Assistant Professor Mechanical Engineering Department, Robotic Engineering Program Worcester Polytechnic Institute

Analysis of Euler Angles in a Simple Two-Axis Gimbals Set

Dynamics Analysis for a 3-PRS Spatial Parallel Manipulator-Wearable Haptic Thimble

Coordinate Transformations. Coordinate Transformation. Problem in animation. Coordinate Transformation. Rendering Pipeline $ = $! $ ! $!

Retargetting Motion to New Characters. Project Report Xin LI

Exercise 1: Kinematics of the ABB IRB 120

INFOMCANIM Computer Animation Motion Synthesis. Christyowidiasmoro (Chris)

Keyframe Animation. Animation. Computer Animation. Computer Animation. Animation vs Modeling. Animation vs Modeling

Jane Li. Assistant Professor Mechanical Engineering Department, Robotic Engineering Program Worcester Polytechnic Institute

animation projects in digital art animation 2009 fabio pellacini 1

CS 231. Inverse Kinematics Intro to Motion Capture

CS184: Using Quaternions to Represent Rotation

Kinematics & Motion Capture

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Last Time? Inverse Kinematics. Today. Keyframing. Physically-Based Animation. Procedural Animation

Reading. Hierarchical Modeling. Symbols and instances. Required: Angel, sections , 9.8. Optional:

Quaternions and Rotations

Maya Lesson 8 Notes - Animated Adjustable Desk Lamp

Thiruvarangan Ramaraj CS525 Graphics & Scientific Visualization Spring 2007, Presentation I, February 28 th 2007, 14:10 15:00. Topic (Research Paper):

Kinematics, Kinematics Chains CS 685

Lecture 22 of 41. Animation 2 of 3: Rotations, Quaternions Dynamics & Kinematics

Lecture 22 of 41. Animation 2 of 3: Rotations, Quaternions Dynamics & Kinematics

Animation Curves and Splines 2

MEAM 520. More Denavit-Hartenberg (DH)

3D Character animation principles

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

Inverse Kinematics Analysis for Manipulator Robot With Wrist Offset Based On the Closed-Form Algorithm

[9] D.E. Whitney, "Resolved Motion Rate Control of Manipulators and Human Prostheses," IEEE Transactions on Man-Machine Systems, 1969.

Articulated Robots! Robert Stengel! Robotics and Intelligent Systems! MAE 345, Princeton University, 2017

Last Time? Animation, Motion Capture, & Inverse Kinematics. Today. Keyframing. Physically-Based Animation. Procedural Animation

Transcription:

Inverse Kinematics Programming Assignment CS 448D: Character Animation Due: Wednesday, April 29 th 11:59PM 1 Logistics In this programming assignment, you will implement a simple inverse kinematics solver to compute poses for an articulated skeleton. The assignment is intended to be completed in Matlab. Matlab is installed on all of the Myth computers in the teaching lab in the basement of Gates, room B08. If you are unfamiliar with Matlab, you may want to glance at some of the tutorials available here: http://www.mathworks.com/academia/student_center/tutorials/launchpad.html. You should begin by obtaining the starting code from the course website. To submit the assignment, e-mail all relevant files to cs448d-spr0809-staff@lists.stanford.edu. Specifically, the following files should be included in your submission: InitialPoseHuman.m, Jacobian.m, ComputeIK.m, InterpolateFrame.m, EulerToQuat.m, QuatToEuler.m, QuatSlerp.m, README. You are welcome to play around with modifying the other *.m files, but please do not submit them. We should be able to run your solution simply by replacing the default InitialPoseHuman.m, Jacobian.m, ComputeIK.m, InterpolateFrame.m, EulerToQuat.m, QuatToEuler.m and QuatSlerp.m files with your implementation. This assignment is meant to be completed individually. 2 Introduction In this assignment, you will implement the iterative IK solver described in class using the Matlab linear system solver, and then implement spherical quaternion interpolation to interpolate between keyframes computed with IK. Specifically, the following components must be completed: 1. ComputeIK.m - this function should implement an iterative IK algorithm that uses the Jacobian to compute a pose satisfying specified end effector constraints. 2. Jacobian.m - this function should compute the Jacobian given the state of the system. 3. InitialPoseHuman.m - this function should set the initial pose of the human character in a way that allows the system to converge to a good optimum. 4. InterpolateFrame.m - this function should smoothly interpolate between two sets of parameters, using a spherical quaternion interpolation to interpolate the ball and socket joint of the right hip. 5. EulerToQuat.m, QuatToEuler.m, QuatSlerp.m - these utility functions should be implemented to convert between Euler angles and quaternions and perform spherical interpolation. 1

6. README - this file should contain answers to questions in Section 9. 3 The Iterative IK Algorithm In order to implement the basic iterative IK algorithm, you will need to fill in the missing code in ComputeIK.m and Jacobian.m. Jacobian.m contains the framework for a function to compute the Jacobian, and the comments in ComputeIK.m contain some hints for useful functions you may need to call in your iterative algorithm. You are not required to implement good convergence checks (it is sufficient to just have the algorithm run for a certain sufficiently large number of iterations), but it may be a good idea in order to get the animation test running fast enough. 4 Setting Initial Pose In order to pass TestMedium.m, you may need to modify the starting values of θ in your algorithm. Do not tailor these values to the specific tests, but rather select values that improve the algorithm s chances of convergence. You will be asked to justify your choices in the README file. 5 Keyframe Interpolation In the next component, you will improve the keyframe interpolation in InterpolateFrame.m. To do this, you will first need to implement EulerToQuat.m, QuatToEuler.m, and QuatSlerp.m to perform the necessary quaternion operations. Remember to always interpolate across the smaller angle. The formula for generating a quaternion q 1 + iq 2 + jq 3 + kq 4 from Euler angles α, β, γ is: q 1 = cos(α/2)cos(β/2)cos(γ/2) + sin(α/2)sin(β/2)sin(γ/2) q 2 = sin(α/2)cos(β/2)cos(γ/2) cos(α/2)sin(β/2)sin(γ/2) q 3 = cos(α/2)sin(β/2)cos(γ/2) + sin(α/2)cos(β/2)sin(γ/2) q 4 = cos(α/2)cos(β/2)sin(γ/2) sin(α/2)sin(β/2)cos(γ/2) And the formula for generating Euler angles from a quaternion is: ( ) 2(q1 q 2 + q 3 q 4 ) α = arctan2 1 2(q2 2 + q2 3 ) β = arcsin(2(q 1 q 3 q 4 q 2 )) ( ) 2(q1 q 4 + q 2 q 3 ) γ = arctan2 1 2(q3 2 + q2 4 ) With these three functions implemented, you should modify InterpolateFrame.m to use spherical interpolation for the right hip, which consists of joints 17, 18, and 19. To do this, convert the two keyframes for the joint into quaternions, interpolate between them, and convert back to parameter angles. This is somewhat inefficient, but is sufficient for this assignment. You will also need to modify the interpolation so that the angular velocity of all joints is 0 at each keyframe. This can be accomplished with Hermite interpolation as discussed in lecture 2. 2

6 Evaluation Your assignment will be evaluated on how well it can find an IK solution for each of the three tests. A correct solution will converge to a pose that very nearly satisfies the end effector constraints for each of the tests. In addition, TestAnimation.m should run fast enough to render the walking character on the Myth machines at a reasonable pace. There is no hard requirement, but if the animation is taking more than a few minutes to complete, your implementation may not be correct. Finally, the interpolation test should interpolate between the three keyframes, slowing down at each keyframe and interpolating the right hip smoothly through the shortest path, as is the case with spherical quaternion interpolation. 7 Useful Matlab Tips Some useful Matlab tips you may need to use in this assignment: x = A\b - this command solves the linear system Ax = b, even when A is not a square matrix. v = A(:) - this command converts a N M matrix A into a NM-dimensional vector v which consists of the concatenation of the columns of A. If you would like to rotate your view in the plot viewer to see the skeleton from different angles, go to View and select Camera Toolbar. To rotate the camera, select the leftmost tool in the new camera toolbar and click and drag inside the plot. 8 The Skeleton While your IK algorithm should be general enough to handle any skeleton, you may want to look more closely at the skeleton structure for determining a good initial pose. This assignment uses a simplified human skeleton with 20 degrees of freedom to represent the character. Each joint is a rotational joint that rotates about either the x, y, or z axis. The root, shoulders, and hips actually consist of three joints, each rotating about a different axis. Some of these joints have a link length of 0 and therefore appear to occupy the same physical space. No rotational constraints are placed on any of the joints. Figure 1 shows the skeleton in the default initial position, with each joint and its axis of rotation v i labeled. You may also refer to HumanSkeleton.m for a list of all joints and their indices. 9 Questions You should include a plain text file entitled README with your submission that contains answers to the following questions: 9.1 Question 1 Justify your choice of starting pose in InitialPoseHuman.m. Why did you choose this specific pose? What problems did you find with the default initial pose? Why does your solution solve these problems? 3

9.2 Question 2 What other unexpected problems did you encounter with your IK implementation? How did you solve these problems? 10 Code Overview ComputeIK.m - this file should contain an implementation of an iterative IK algorithm. You will need to fill in the missing code to complete this function. ComputeMatrices.m - this function accepts the parameters of the current state and generates complete transformation matrices for each joint. You will not need to modify this function. ComputeRelation.m - this function accepts skeleton parameters and generates the matrix C, which describes which joints influence which other joints. You will not need to modify this function. DrawSkeleton.m - this function draws the skeleton and end effector constraints in a specified configuration. The end effector constraints are shown as red circles. You will not need to modify this function. ForwardKinematics.m - this function computes the forward kinematics of a skeleton given the current configuration, producing joint positions p, world-space joint axes v, and end effector positions s. You will not need to modify this function. HumanSkeleton.m - this function creates the human skeleton. See Section 8 for details on the specific skeleton used in this assignment. You will not need to modify this function. Rotation.m - this function returns a rotation matrix given an axis and an angle. You will not need to modify this function. InitialPoseHuman.m - this function sets the initial pose for the skeleton. You will need to implement this function to set an initial pose that is general enough to solve all of the poses. Jacobian.m - this function computes a Jacobian given joint positions p, joint axes v, end effector positions s, relations matrix C, and the numbers of joints and end effectors (N and K respectively). You will need to implement this function. InterpolateFrame.m - this function interpolates between the parameters of two keyframes, specified by theta1 and theta2, according to parameter u. You will need to modify this function to interpolate with a smooth cubic and use spherical quaternion interpolation for the right hip. QuatToEuler.m - this function converts a quaternion into three Euler angles. You will need to implement this function. EulerToQuat.m - this function converts three Euler angles into a quaternion. You will need to implement this function. 4

QuatSlerp.m - this function performs spherical interpolation between quaternions q1 and q2 according to parameter u. You will need to implement this function. TestEasy.m - this function uses your IK code to test an easy pose. TestMedium.m - this functino uses your IK code to test a more difficult pose. If implemented correctly, your IK code should satisfy all of the constraints - the end effectors should overlap exactly with the red circles. TestAnimation.m - this function uses your IK code to animate a walking character. If implemented correctly, your IK code should cause the character to walk in a believable manner. TestInterpolation.m - this function uses your IK code to animate a kicking character using keyframing. If both the IK and interpolation portion are implemented correctly, the character should swing his right leg in two smooth motions. 5

R Shoulder Open/Close (10) L Shoulder Open/Close (6) V 10 V 9 V 4 V 5 V 6 R Shoulder Twist(11) V 11 R Shoulder Swing (9) Head (4) L Shoulder Swing (5) V 7 L Shoulder Twist (7) V 3 V 12 Body Twist (3) V 8 Effector #2 R Elbow (12) R Hip Swing (17) V 2 Body Side to Side (2) L Hip Swing (13) L Elbow (8) Effector #1 L Hip Open/ Close (18) V 18 V 17 V 1 V 13 V 14 L Hip Open/ Close (14) R Hip Twist (19) Body Fwd/Bwd (1) L Hip Twist (15) V 19 V 15 V 20 V 16 R Knee (20) L Knee (16) Effector #4 Effector #3 Figure 1: Schematic illustration of the skeleton used in this assignment. The axes and pivots of all joints are labeled. 6