# 游戏人生

### Blog Stats

• Posts - 146
• Stories - 1
• Comments - 169
• Trackbacks - 0

## [摘译] IK: 操纵关节式物体的反向动力学和几何约束

http://graphics.ucsd.edu/courses/cse169_w04/welman.pdf

http://www.cnblogs.com/crazii/p/4662199.html

[译者: 根据个人需要, 只仔细阅读了部分内容, 所以只翻译 基本概念(3.1)和 CCD相关(4.2, 4.3) 的部分. 后面如果有空的话, 可能选择翻译一下第5章 约束(Incorporating Constraints)的问题.
p.s.本人渣数学, 很多术语可能翻译不准确. 还有一些句子是意译.

The inverse kinematic problem has been studied extensively in the robotics literature, which remains the best source of information on the subject. In this chapter we formally state the problem and review the most common approaches to solving it. Previous applications of these approaches to computer graphics are also described.



3.1 反向动力学问题 - The Inverse Kinematic Problem

Section 2.1.2 showed that a skeleton can be modelled as a hierarchical collection of rigid objects connected by joints. We will refer to a kinematic chain of segments within a skeleton as a manipulator, and will assume that the joints connecting segments within this chain are revolute joints rotating about a single axis. One end of the manipulator, the base, is fixed and cannot move; the distal end of the chain is free to move. The end effector is embedded in the coordinate frame of the most distal joint in the chain; the end-effector position is a point within this frame and the end-effector orientation refers to the orientation of the frame itself.

Mi = T(xi, yi, zi) Ri)　　(3.1)

At each joint in the chain a joint variable determines a transformation M between the two adjacent coordinate frames sharing the joint. The transformation Mi at a rotation joint i is a concatenation of a translation and a rotation, both of which are relative to the coordinate frame of joint is parent. That is,

Mi = T(xi, yi, ziRi)　　(3.1)
where T(xi, yi, zi) is the matrix that translates by the offset of joint i from its parent joint i,  and Ri) is the matrix that rotates by θi about joint is rotation axis

Mij MiMi+1...Mj-1Mj　　(3.2)

The relationship between any two coordinate systems i and j in the chain is found by concate nating the transformations at the joints encountered during a traversal from joint i to joint j:

Mij = MiMi+1...Mj-1Mj　　(3.2)

So the position and orientation of the end-effector with respect to the base frame is found by simply concatenating the transformations at each joint in the manipulator.

x = f(q)　　(3.3)

q = f-1(x)　　(3.4)

Given a vector q of known joint variables, then, the forward kinematic problem of computing the position and orientation vector x of the end-effector, is a simple matter of matrix concatenation, and has the form

x = f(q)　　(3.3)

But if the goal is to place the end-effector at a specied position and orientation x, then determining the appropriate joint variable vector q to achieve the goal requires a solution to the inverse of(3.3)

q = f-1(x)　　(3.4)

Solving this inverse kinematic problem is not so simple. The function f is nonlinear and while there is a unique mapping from q to x in equation(3.3),  the same cannot be said for the inverse mapping of(3.4) - there may be many qs for a particular x. The most direct approach for solving the problem would be to obtain a closed-form solution to (3.4). But closed-form solutions can only be derived for a restricted set of manipulators with specfic characteristics, and even these result in a set of nonlinear equations to be solved[Pau81]. A general analytic solution for arbitrary manipulators does not exist; instead the problem must be solved with numerical methods for solving systems of nonlinear equations. The most common solution methods are based on either matrix inversion or optimization techniques.

4.1 一个简化的动态模型 A Simplied Dynamic Model

4.1.1 雅可比转置法 The Jacobian Transpose Method

[以上暂不翻译...]

4.2 一个补充的启发式解法 - A Complementary Heuristic Approach

The force-based approach of the preceding method has some appealing characteristics for interactive manipulation. There are some cases, however, for which the method does not perform well. Figure 4.2 illustrates one such case. On the left is a manipulator in a singular conguration with a new desired position for the tip shown as a black dot. The conguration on the right shows a reasonable solution to this inverse kinematic problem, and probably reflects what a user expects to get by dragging the tip in towards the goal. However as the user attempts to drag the tip inwards the applied force exerted on the tip points straight down the singular direction it is in effect cancelled out and the tip will not move. This behaviour is reasonable given the physical analogy of the Jacobian transpose method, but may not really match the users expectation. An alternative inverse kinematic algorithm is presented here, suitable for interactive positioning and capable of providing reasonable behaviour in cases such as that in Figure 4.2. It is based on a heuristic method which has been proposed to quickly find an initial feasible solution for a standard minimization based algorithm[WC91]. However it can stand on its own as an inverse kinematic positioning tool. Like the Jacobian transpose method the technique is efficient, simple, and immune to problems with singularities. However its behaviour is quite different from that exhibited by the previous algorithm, and it is suggested here as a complement to, rather than a replacement for, the Jacobian transpose method.

4.2.1 循环坐标下降法  The Cyclic Coordinate Descent Method

The cycliccoordinate descent (CCD) method is an iterative heuristic search technique which attempts to minimize position and orientation errors by varying one joint variable at a time. Each
iteration involves a single traversal of the manipulator from the most distal link inward towards the manipulator base. Each joint variable qi is modied in turn to minimize an objective function. The minimization problem at each joint is simple enough that an analytic solution can be formulated, so each iteration can be performed quickly.

As a solution is obtained at each joint the end-effector position and orientation are updated immediately to reect the change. Thus the minimization problem to be solved at any particular joint incorporates the changes made to more distal joints during the current iteration. This differs from the previously described method, which in eect determines the changes to each joint simultaneously2 (2: ie although the changes are computed sequentially, the state of the manipulator remains constant during the iteration).

[译注: CCD是将末端效应器与目标的距离作为启发函数, 通过每次迭代时, 通过调整旋转, 不断逼近目标, 将与目标的旋转和位移误差最小化, 最后达到目标. 由于每次迭代是从末端开始到基座, 靠近基座的关节会对靠近末端的节点产生影响, 在处理每个关节点之前, 其子节点的误差已经最小化. 下面是对每次个关节上问题的分析, 实际使用中可以根据原理, 作出各种应用和工程的算法.]

Pc = (xc, yc, zc)

Oc = [ u1c, u2c, u3c]T [译注: 原文中是列向量, 这里不好表示, 故写作行转置]

E(q) = Ep(q) + Eo(q)　　　　　　(4.13)

Ep(q) = ||(Pd - Pc)||2　　　　　　(4.14)

Eo(q) = ∑j=13 ((ujd·ujc) - 1)2　　(4.15)

Suppose that the current end-effector position is

Pc = (xc, yc, zc)

and that the current orientation of the end-effector is specified by the three orthonormal rows of the rotation matrix Oc

Oc = [ u1cu2cu3c]T

The end-effector can be placed as close as possible to some desired position Pd and orientation Od by finding a joint vector q which minimizes the error measure

E(q) = Ep(q) + Eo(q)　　　　　　(4.13)

which is just the sum of a positional error measure

Ep(q) = ||(Pd - Pc)||2　　　　　　(4.14)

and an orientation error measure

Eo(q) = ∑j=13 ((ujd·ujc) - 1)2　　(4.15)

The method proceeds by considering one joint at a time, from the tip to the base. Each joint variable qi is modified to minimize equation (4.13), before proceeding to the next joint i -1.  At each joint, minimizing (4.13) becomes a simple onedimensional optimization problem, since only qi is allowed to change while the other elements of q are fixed. Since joint i is either a rotation or a translation joint, there are two cases to be considered. P'ic(Φ) = Raxisi(Φ)Pic

g1(Φ) = Pid·P'ic(Φ)　　(4.16)

g2(Φ) =  ∑j=13 ujd·u'jc(Φ)　　(4.17)

g(Φ) = wpg1(Φ) + wog2(Φ)　　(4.18)

wo = 1

wp = α(1+ρ)

α = k / W

ρ = min ( ||Pid||, ||Pic|| ) / max( ||Pid||, ||Pic|| )

g(Φ) = k1(1-cosΦ) + k2cosΦ + k3sinΦ　　(4.19)

其中常量k1, k2, k3 的值分别为:

k1 = wp(Pid·axisi)(Pic·axisi) + woj=13(ujd·axisi)(ujc·axisi)　　(4.20)

k2 = wp(Pid·Pic) woj=13(ujd·ujc)　　　　　　　    　　　　　　　(4.21)

k3 = axisi·[wp(Pic x Pid) + woj=13(ujc x ujd)]　　  　　　　　　(4.22)

(k1 - k2)sinΦ + k3cosΦ = 0

Φ = tan-1(k3/(k2-k1))　　(4.23)

qi = qi + wiΦ

Figure (4.3) illustrates the situation for rotation joint i during an iteration. The vector Pic is the vector from the joint  position ji to the current end-effector position and, Pid is the vector from ji to the desired end-effector position. We are free to rotate the vector Pic about the world spac joint axis axisi by some amount.  This rotated vector is

P'ic(Φ) = Raxisi(Φ)Pic

As Φ varies, P'ic(Φ) sweeps out a circle centered at ji. The point on this circle closest to the desired position Pd is the point at which the circle would intersect the line along Pid, so the best we can do by varying joint variable ji alone is to align the two vectors P'ic(Φ) and Pid. This implies that we seek a value for Φ which maximizes the expression

g1(Φ) = Pid·P'ic(Φ)　　(4.16)

Reasoning along similar lines, an orientation error is best corrected by making sure that Φ also maximizes the expression

g2(Φ) = ∑j=13 ujd·u'jc(Φ)　　(4.17)

Combining both (4.16) and (4.17) gives an aggregate objective function to be maximized for joint i

g(Φ) =wpg1(Φ) + wog2(Φ)　　(4.18)
Here wp and wo are arbitrary position and orientation weighting factors, respectively, and are introduced to play a role similar to that of the gain matrix K of the Jacobian transpose method. The following ad-hoc values for these factors are suggested [WC91]

wo = 1

wp = α(1+ρ)

Here  is a scaling factor inversely proportional to the overall world scale W

α = k / W

and is required to make the algorithm's behaviour scale-invariant. The factor is an arbitrary weight which depends on the configuration of the manipulator; Wang[WC91] suggests, without justication, that

ρ = min(||Pid||, ||Pic||) / max(||Pid||, ||Pic||)

which seems to be adequate in practice.

With some algebraic manipulation, the objective function (4.18) to be maximized at joint i can be reduced to

g(Φ) = k1(1-cosΦ) + k2cosΦ + k3sinΦ　　(4.19)

with the constant coefficients k1, k2, and k3 given by

k1 = wp(Pid·axisi)(Pic·axisi) + woj=13(ujd·axisi)(ujc·axisi)　　(4.20)

k2 = wp(Pid·Pic) woj=13(ujd·ujc)　　　　　　　　　　　　　　　　(4.21)

k3 = axisi·(wp(Pic x Pid) + woj=13(ujc x ujd))　　　　　　　　　　(4.22)

From elementary calculus, we know that the objective function (4.19) is maximized over the interval -π≤Φ≤-π, when its first derivative is zero and its second derivative is negative. The first condition

(k1 - k2)sinΦ + k3cosΦ = 0

implies that

Φ = tan-1(k3/(k2-k1))　　(4.23)

which determines a candidate value Φc in the range -π/2<Φc<-π/2. However, since tan is periodic there are potentially two other candidate values to consider: Φc+π and Φc-π. Of these candidate values, those which lie in the interval -π<x<-π and which pass the second derivative test are maximizing values for the objective function (4.19). If there is more than one of these, the objective function is evaluated with each to determine which yields the true maximum. Once Φ  has been uniquely determined in this way it is added to the current joint value qi .At this point we can introduce an arbitrary weighting factor wi, 0≤ w≤1, which controls the perceived "stiffness" of the joint, so that the update becomes

qi = qi + wiΦ

The end-effector frame is then rotated to reflect this change, and the iteration continues on to the
next joint i-1 using the updated end-effector.

λ = (Pid - Picaxisi　　　　(4.24)

If joint i is a translation joint, then it can only reduce the position error (4.14). It is not difficult to show [WC91] that the best that can be done to minimize the position error is to change the joint displacement by

λ = (Pid - Picaxisi　　　　(4.24)

This is weighted by wi, as before, and added to the current value of joint variable qi. The end-effector position is updated before continuing on to the next joint.

A single iteration of the CCD method for an n-jointed manipulator visits joints n through 1 in turn. At each joint, the original n-dimensional optimization problem is reduced to a one-dimensional problem involving just the joint variable qi, which admits to an analytic solution. An incremental change to qi is computed with either (4.23), if the joint rotates, or with (4.24) if the joint translates. The variable qi is then incremented and clamped to upper and lower bounds. The current end-effector frame(Pc and Oc) is updated to reflect the change before proceeding to the next joint.

The algorithm behaves well around singular configurations, and since the value of the objective function (4.13) is reduced with each step, the method is guaranteed to converge. But the heuristic nature of the method makes the rate of convergence somewhat difficult to quantify, since it is dependent on the structure of the manipulator itself. In practice, most problems can be solved with only a few iterations, although there are situations for which the method can converge very slowly. In terms of behaviour, the heuristic implies that distal links move more readily than links closer to the base; if the end-effector goal can be reached by moving only the final link of the chain, then only that link will move.

4.3 比较 Comparison

Each of the methods described above is suitable for interactive direct manipulation, with some caveats. The per-iteration cost for each is minimal, so that both can provide good feedback when dragging reasonably complex manipulators. Each can be made numerically stable near kinematic singularities, although the CCD method has an edge in this regard since it is completely immune to difficulties near singularities. Where neither method particularly excels is in the rate at which they converge toward a solution: both can exhibit poor convergence rates particularly if high accuracy is required.  Figures 4.4 and 4.5 compare the performance of each algorithm for solving a pair of inverse kinematic problems. The manipulator has 7 degrees of freedom, about the same complexity as a simple approximation to a limb, although for this example there are no limits on the range of movement for each joint. In each case a position goal is specified for the end-effector, and the inverse kinematic problem is solved to varying degrees of accuracy. Each figure shows the initial configuration, and the final solution obtained with each method. In addition, the time to achieve the solution is plotted with respect to the degree of accuracy requested. In the first case of Figure 4.4 the end-effector goal is well within reach, and both methods are able to solve the problem reasonably quickly. However, it is already apparant that the Jacobian transpose converges slowly when it is close to a solution; there is a marked decrease in performance for each additional digit of accuracy requested.

In the second case of Figure 4.5, the gal is close to the edge of the reach space of the limb, which must approach a singular configuration to achieve the goal. Although both methods are able to solve the goal, the CCD method clearly outperforms the other, particularly as the accuracy of the solution increases. As it approaches the goal, the Jacobian transpose method is hampered by a small applied force which is "pulling" in a direction which doesn't affect most of the joints, so the progress towards the goal is very slow. The heuristic approach of the CCD fares much better in this example.

The final configurations shown in the figures also illustrate the CCD method's preference for moving distal links, in contrast with the other method's tendency to distribute joint changes more equally along the chain. This difference in behaviour is quite noticeable during interactive dragging. Manipulating a chain with the Jacobian transpose method tends to feel like playing a flexible elastic rod, while the CCD method imparts a feel more akin to pulling on a chain of loosely connected links. While the final solutions for the CCD method might look inferior to those obtained with the Jacobian transpose, keep in mind that these solutions were obtained noninteractively - i.e. they were computed offline. When dragging interactively using the CCD method it is usually not difficult to gain control over the final position by moving the cursor appropriately. Also, both methods support a means of controlling joint responsiveness by specifying an appropriate weighting factor wi at each joint. In particular, this parameter can be useful to offset the default behaviour of the CCD method.

These examples illustrate the main advantages and disadvantages of each method. Both are quick and therefore worth considering if direct manipulation is required, even on machines with modest performance. The Jacobian method has the advantage of responding in an intuitive fashion to pushes and pulls on the end-effector; the CCD method is not as intuitive in this regard. The CCD method exhibits more stability around singular configurations, and although its rate of convergence slows, it is not nearly to the extent that the Jacobians does. Moreover, it can be argued that direct manipulation does not necessarily require a high degree of accuracy. Certainly while a user is sweeping a cursor across the screen it is not critical that the end-effector track it to six decimal places of precision; one or two decimal places of accuracy probably suffices. When accurate positioning is required, particularly near singularities, the CCD method would be the appropriate method to use. In general, the two methods complement each other nicely, providing alternate interaction models to offer the user.

posted on 2015-12-05 21:20 crazii 阅读(...) 评论(...) 编辑 收藏