Attic:SoCInverseKinematics Inverse Kinematics

提供: wiki
移動先: 案内検索

Summer of Code : Inverse Kinematics

Goals

The goals of this project are (as in the proposal):

  • Translational joints
  • Rotational limits for joint
  • Parameters like joint stiffness and end effector influence
  • Tree structured IK chains, with multiple end effectors (joint pinning)

The emphasis of this project will be not so much on the user interface, but more on the IK engine itself.

Progress

At this point the code in the soc-blender tree has the following new features compared to bf-blender:

  • 0,1,2,3 DOF joints
  • tree structure IK
  • orientation control
  • overall speed up (roughly 7x)
  • rotation limits
  • translational joints (only in the ui)

Implementation

Most of the work will be done in the iksolver/ module with integration of the functionality in blenderkernel/, src/. The iksolver/ module integration in blender is simple: everytime the depgraph (in blenkernel/) decides to run the solver, a tree of IK segments is constructed, the system is solved, and the rotation updates are retrieved.

There is already a user interface for Inverse Kinematics, but it will be changed. IK will no longer be a constraint, but becomes a 'built-in' posing feature, with it's own panel. Internally it is already executed separate now, after all constraints are evaluated. A different user interface is needed especially to deal with tree structures transparently. Joint limits, choice of joint degrees of freedom's, ..., will be integrated/stored on pose mode level. Ton will work on the IK user interface changes, as part of the animation recode project.

More info on the animation system: [[1]],|[[2]].

IK Solver Internals

The goal of the IK solver is as follows: given a set of tasks, and a set of segments, find the angles of the segments satisfying the tasks as close as possible.

Here is a quick (probably confusing) intro in how the IK solver works. For a more detailed overview, see:

For a single chain, the forward kinematics problem can be mathematically represented as follows (the extension to trees and other tasks is straightforward):

x = f(q)

Where =x= is a vector with the coordinates of an end effector, and =q= is a vector of joint angles. So an end effector position =x= is computed from joint angles =q=. The inverse kinematics problem is thus:

q = f<sup>-1</sup>(x)

The function =f= is non-linear, and for general chains too complex to solve/invert directly. So a solution is found using an iterative numerical method, looking for a local minimum. =f= is linearized in the form of a [[6]], relating the derivatives of =x= and =q=:

x' = Jq'

The initial angles =q= can then be iteratively updated by computing:

q' = J<sup>-1</sup>x', q += q'

There is, however, a remaining problem. =J= is in general not invertible (in most cases it's not even square). This makes sense, since there might be infinitely many solutions, or none at all. Instead of the inverse, a [[7]] of =J= is used, which is defined for all matrices.

But, =J= can get ill conditioned near singularities, resulting in large oscillations. To deal with singularities, a damped pseudo-inverse is used. Computing an appropriate damping factor is essential to ensure stability, without sacrificing performance.

The internal structure of the IK solver follows directly from the above explanation. There is a tree structure of segments, a list of tasks, and a Jacobian matrix with associated vectors/matrices. The IK solver then runs the following loop:

pub/diagram.png

-- DeveloperWikiBrechtVanLommel - 21 Jul 2005