Inverse Kinematics Problems with Exact Hessian Matrices
Total Page:16
File Type:pdf, Size:1020Kb
Inverse Kinematics Problems with Exact Hessian Matrices Kenny Erleben Sheldon Andrews University of Copenhagen École de technologie supérieure [email protected] [email protected] ABSTRACT Popular techniques for solving IK problems typically discount Inverse kinematics (IK) is a central component of systems for mo- the use of exact Hessians, and prefer to rely on approximations of tion capture, character animation, motion planning, and robotics second-order derivatives. However, robotics work has shown that control. The eld of computer graphics has developed fast station- exact Hessians in 2D Lie algebra-based dynamical computations ary point solvers methods, such as the Jacobian transpose method outperforms approximate methods [Lee et al. 2005]. Encouraged by and cyclic coordinate descent. Much work with Newton methods these results, we examine the viability of exact Hessians for inverse focus on avoiding directly computing the Hessian, and instead ap- kinematics of 3D characters. To our knowledge, no previous work in proximations are sought, such as in the BFGS class of solvers. This computer graphics has addressed the signicance of using a closed paper presents a numerical method for computing the exact Hes- form solution for the exact Hessian, which is surprising since IK is sian of an IK system with spherical joints. It is applicable to human pertinent for many computer animation applications and there is a skeletons in computer animation applications and some, but not large body of work on the topic. all, robots. Our results show that using exact Hessians can give This paper presents the closed form solution in a simple and easy performance advantages and higher accuracy compared to standard to evaluate geometric form using two world space cross-products. numerical methods used for solving IK problems. Furthermore, we Compared to robotics work, we target joints with general Euler provide code and supplementary details that allows researchers to angles ordering and use the familiar homogeneous coordinates plug-in exact Hessians in their own work with little eort. representation to describe the kinematics. This technical choice is based on the popularity of Euler angles in character animation appli- CCS CONCEPTS cations, but the theory we present holds equally well for quaternion representation or other parameterizations of rotation angles. We • Computing methodologies → Animation; Motion process- consider the derivation and algorithm for the computation of the ing; exact IK Hessian to be a novel theoretical contribution. Further- more, we investigate numerically whether using the exact Hessian KEYWORDS with a Newton’s method type of approach improves the perfor- inverse kinematics, Hessian, optimization mance and accuracy for IK problems with many degrees of freedom ACM Reference format: and large displacements of end-eectors. Our results suggest that Kenny Erleben and Sheldon Andrews. 2017. Inverse Kinematics Problems using exact Hessians can outperform using approximate Hessians, with Exact Hessian Matrices. In Proceedings of MiG ’17, Barcelona,Spain, or even Hessian free methods, under certain conditions. November 8–10, 2017, 6 pages. We supplement this paper with Python and MATLAB code allow- DOI: 10.1145/3136457.3136464 ing other researchers to harvest the benets of using exact Hessians in their own IK solvers. 1 INTRODUCTION 2 NUMERICAL METHODS FOR IK Inverse kinematics is the problem of computing the conguration In Zhao and Badler [1994] a mathematical formalism is presented (i.e., joint angles) for a kinematic chain, skeleton, or mechanism, for solving IK as a constrained non-linear optimization problem. such that an end eector will reach a prescribed goal. IK methods are fundamental for many robotics and computer graphics applications, as evidenced by literature on the topic dating back several decades ( ) [Craig 1989; Girard and Maciejewski 1985]. In robotics, the problem ( ) is usually phrased as a dynamic system which may lead to dierent schemes [Hsia and Guo 1991]. An overview of numerical methods used in computer graphics can be found in the report by Buss ( ) ( ) = = [2004]. 2 +1 Permission to make digital or hard copies of all or part of this work for personal or 1 min ( ) classroom use is granted without fee provided that copies are not made or distributed 2 for prot or commercial advantage and that copies bear this notice and the full citation 2 − on the rst page. Copyrights for components of this work owned by others than ACM ( ) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specic permission and/or a Figure 1: Conceptualization of the IK problem: nd joint fee. Request permissions from [email protected]. angles θ0;:::;θN that minimize the distance between end- MiG ’17, Barcelona,Spain eector position F¹θº and the goal position g. The distance © 2017 ACM. 978-1-4503-5541-4/17/11...$15.00 DOI: 10.1145/3136457.3136464 is encoded by the residual r¹θº. The non-linear optimization problem is solved using the gradient rf ¹θº = −JT r, and op- tionally the Hessian matrix H. MiG ’17, November 8–10, 2017, Barcelona,Spain K. Erleben and S. Andrews This work allows for general types of constraints. Furthermore, robotic manipulator. However, in the context of computer graphics the optimization model can be used to derive a large spectrum of applications, t can be interpreted as a point with xed position known methods for solving the IK problem. relative to a bone in a skeleton armature (e.g. an optical marker). Our work too takes as its outset the IK optimization model of Each link describes a coordinate frame with respect to the par- Zhao and Badler [1994]. In fact, there exists many methods for ent link, or bone. The parent frame of the root link is the world solving the IK optimization problem. Engell-Nørregård and Erleben coordinate system. Hence, a link is equivalent to a transformation [2011] shows how the Jacobian Transpose (JT) method is equivalent of a point p in the current coordinate frame k to the coordinate to a steepest descent (SD) method without a line-search. Further, frame of its parent k − 1, and we write the transformation as they show that damped least squares (DLS) is obtained from a Gauss- p p Newton (GN) approach, and the damping results in a Levenberg- = T : (1) 1 k 1 Marquardt (LM) type method. Other quasi-Newton type methods k−1 k are readily available such as memory limited BFGS [Zhao and Badler The subscripts on the homogeneous vectors denote the frame of 1994] and a wide range of methods using iterative methods like pre- reference with the world coordinate system (WCS) assigned index conditioned conjugate gradient (PCG) for solving the sub-system k = −1. or approximate the Hessians using low-rank updates. Even cyclic- The homogeneous transform matrix Tk is parameterized with coordinate descent (CCD) [Wellman 1993] can be derived from the Euler angles αk , βk , and γk and position of the joint. We use using a matrix-splitting approach for solving the gradient equation homogeneous coordinates in deriving our equations and when we that forms the basis for the JT method. Interestingly, solving the present our nal results we implicitly homogenize the formulas. gradient equation with pseudo-inverses yields a system of equa- Also, our derivations use ZYZ Euler angle order to be specic and tions similar to the Newton systems that form the basis for GN/LM make derivations less dense. However, in the code and supplemen- type of methods. Hence, these quasi-Newton methods are linked to tary material we generalize to any Euler angle convention and the JT method. Recent work by Harish et al. [2016] investigates how extend our formulation to account for a translational moving root to parallelize a DLS approach for solving the IK problem. The work bone, which is important for working with motion capture data of focuses on creating a parallel line-search that can help eliminate human characters. the need for the many iterations that JT method usually requires Given an N link serial chain and a tool vector t and known to converge for highly nonlinear motions with many degrees of joint parameters, we wish to compute the tool vector position in freedom. This is expected from convergence theorems stating that T T the world coordinate system t 1 WCS . This is called the end- JT/SD method has linear convergence rate [Nocedal and Wright eector position, and is given by 1999]. However, it has also been observed in practice [Callennec e t t 2006]. Other work incorporates higher order information, mimick- ≡ ≡ T T ··· T : (2) 1 1 0 1 N 1 ing the eect of a Hessian, by nonlinear conjugate gradients and WCS N adding non-smoothness allows a full coupling of joint limits too The matrix concatenation in (2) denes the end eector function T [Engell-Nørregård and Erleben 2009]. F¹θº where θ = »α0 β0 γ0 α1 β1 γ1 ::: αN βN γN ¼ is termed the In Fedor [2003], three methods are revisited and evaluated for joint angles or joint parameters. computer game usage: an algebraic method, Cyclic-Coordinate- We now have enough notation and terminology in place to de- Descent [Wellman 1993], and a Newton-Raphson method. The ne what we understand of the unconstrained inverse kinematics Newton-based method is used for complex manipulation and claimed problem. to give the most realistic looking poses, but it is the slowest. How- ever, joint limits were not dealt with in this work. Other formu- 3.1 Non-linear optimization lations have been investigated for instance in Ho et al. [2005] the Given a desired goal position g 2 R3, we seek to nd the joint problem is solved using linear programming. angles θ∗ that minimize the distance between the goal position and Finally, Zordan [2002] notes the importance of tuning parameters the end-eector position for numerical methods in order to achieve good performance, and 2 this is a relevant step in our experiments.