3
-18 Robotics and Automation Handbook
let
θ
1
− θ
0
≤b
and let
n
k=1
∂
2
f
i
(θ)
∂θ
j
∂θ
k
≤
c
n
for all θ ∈θ − θ≤2b, where i, j ∈{1, ... , n}.If
abc ≤
1
2
then
1. θ
i
defined by Equation (3.22) are uniquely defined as
θ
n
− θ
0
≤2b
and
2. the iterates converge to some vector, α for which g(α) = 0 and
θ
n
− θ
0
≤
2b
2
n
Appendix B: Implementation of Newton’s Method
This appendix presents C code that implements Newton’s method for a six degree of freedom manipulator.
It assumes that all the joints are revolute, i.e., the joint angles, θ
i
, are the variables to be determined. It has
been written not with the goal of complete robustness or efficiency, but rather for a (hopefully) optimal
combination of readability, robustness, and efficiency, with emphasis on readability. Most of the variables
that one may need to tweak are contained in the header file.
The main file is “inversekinematics.c” which utilizes Newton’s method to numerically find a solution to
the inverse kinematics problem. This file reads the Denavit-Hartenberg parameters for the manipulator
from the file “dh.dat,” reads the desired configuration for the sixth frame from the file “Tdes.dat,” reads
the initial values from the file “theta.dat.” The other files are:
r
“computejacobian.c” which numerically approximates the Jacobian by individually varying the
joint angles and computing a finite approximation of each partial derivative;
r
“forwardkinematics.c” which computes the forward homogeneous transformation matrix using
the Denavit-Hartenberg parameters (including the joint angles, θ
i
);
r
“homogeneoustransformation.c” which multiplies the six forward transformation matrices to de-
termine the overall homogeneous transformation;
r
“matrixinverse.c” which inverts a matrix;
r
“matrixproduct.c” which multiplies two matrices;
r
“dh.dat” which contains the Denavit-Hartenberg parameters α
i−1
, a
i−1
, and d
i
;
r
“theta.dat” which contains the initial values for the last Denavit-Hartenberg parameter, θ
i
; and,
r
“inversekinematics.h” which is a header file for the various C files.
On a Unix machine, move all the files to the same directory and compile the program, by typing
> gcc *.c -lm
at a command prompt. To execute the program type