# Dealing with fixed transformations while solving inverse kinematics

I am trying to solve inverse kinematics (using the Jacobian pseudoinverse method) for a 7 DoF arm, but because of the way the robot is mounted, the base frame does not coincide with the frame of the first joint, so there is a transformation between base and frame 0. As the Jacobian expresses the joint-end effector velocity relationship w.r.t. the base frame, and also because my target poses etc. are expressed w.r.t the base frame, I encoded the transformation as an extra row in my DH parameters, but these angles are always fixed. Hence, I ended up with 8 rows in my DH although I have only 7 joints.

Because of this, my inverse kinematics algorithm, when trying to minimize the end effector pose error, continuously attempts to change the angle of the "first" joint which really isn't a joint at all. Hence, although the algorithm thinks the end effector has reached the target position, in real world it would not, because that base-robot transformation would be invalid for my setup. If I force this angle to be constant after every update of the iteration, the algorithm fails to converge and gets stuck at some pose. So I am guessing my approach for encoding the fixed base-first joint transformation is wrong? How are these transformations usually dealt with?

Hopefully you still have only 4 rows in your DH matrix, not 8 as you said. I think you mean that your Jacobian matrix has 8 $\require{enclose} \enclose{horizontalstrike}{\text{rows}}$ columns.

Your approach is close to correct, but it has one flaw. The flaw is when you make the transformation that you are calling the "first joint." Instead of letting the rotation between that coordinate system and the next be a variable, say, $q_1$, just plug in the value of that angle (for example, $\pi \over 2$).

If you do this, then you'll see that your Jacobian has only 7 $\enclose{horizontalstrike}{\text{rows}}$ columns, as it should. The iterative pseudoinverse process will have a higher likelihood of converging to a proper solution since it will not be trying to move a nonexistant degree of freedom. And you won't need to reset that angle after each iteration, because it is constant.

• If the Jacobian has only 7 rows, then are you suggesting to just remove the base-robot transformation from my robot description (DH etc.) and just use it separately for my convenience? Because I am guessing the algorithm would fail if the Jacobian was in one reference frame but my end effector pose, error etc. are computed in a different reference. (PS: I'm used to writing DH as 4 columns and $n$ rows, and Jacobian as a $6Xn$ matrix) Nov 18, 2016 at 4:17
• The first transformation should still be included in your forward kinematics. However, it will not lead to an independent column for your Jacobian because of the fact that the terms of that transformation are constants. You would only get another column if the partial derivative of any term of your kinematics, with respect to that angle, is nonzero. Nov 18, 2016 at 9:43

Having 8 rows in the DH parameters table is completely ok. However, this does not lead to 8 rows in your jacobi matrix. The size of the jacobi matrix is always given by number of degrees of freedom in Cartesian space and number of degrees of freedom in joint space. In your case 6 and 7, as I understand.

Elements in the Jacobi matrix express to what extent does a small change in a joint variable cause a change in the cartesian variables. Based on this, it should be clear that your fixed transformation from base to joint 1 cannot have any changes in it therefore cannot have its own variable and row in the jacobian matrix.

This situation is very common. It is essentially the same as having a last transformation from the flange coordinate system to the tool coordinate system.

So, to build up the jacobian, I always do it as follows:

1. Write the DH parameter table

2. Multiply all matrices together (all 8 in your case)

3. Write the equation

$A_{lhs} = A_{rhs}$

where $A_{lhs}$ is the transformation matrix from the joint space side (DH transformations multiplied together) and $A_{rhs}$ is the Cartesian transformation matrix multiplied togehter ($T_x(x) * T_y(y)*...$).

1. From this matrix equation express the equations:

$x = f_x(q_1, q_2, q_3, q_4, q_5, q_6, q_7)$

$y = f_y(q_1, q_2, q_3, q_4, q_5, q_6, q_7)$

$z = f_z(q_1, q_2, q_3, q_4, q_5, q_6, q_7)$

$a = f_a(q_1, q_2, q_3, q_4, q_5, q_6, q_7)$

$b = f_b(q_1, q_2, q_3, q_4, q_5, q_6, q_7)$

$c = f_c(q_1, q_2, q_3, q_4, q_5, q_6, q_7)$

This is the direct kinematics problem in explicit from.

1. Derive all elements of the Jacobi Matrix (with a computer algebraic system, e.g. Maple, Matlab Symbolics toolbox, Math.net, symPy, etc.)

$\frac{\delta x}{\delta q_1}$ = $\frac{\delta f_x}{\delta q_1}$

1. Build up all 6x7 elements of the jacobi matrix this way