Professional Documents
Culture Documents
Ohiou1174932976 PDF
Ohiou1174932976 PDF
Ohiou1174932976 PDF
A Thesis Presented to
The Faculty of the College of Engineering and Technology
Ohio University
-i
. A
:~>-
I-.
'1
.+b.
BY
-
Sandeep Anand/
Department of Mechanical Engineering
June 1993
Acknowledgements
Introduction ........................................... 7
1 . 1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Literature Review . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3 Motivation of the Present Study . . . . . . . . . . . . . . . . . . . . . . . 11
1.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Forward Kinematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2 Forward Kinematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3 Denavit- Hartenberg Representation ..................... 17
Inverse Kinematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2 Solvability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3 Pieper's Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Appendix A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
A-1 Link Transformations for PUMA 560 . . . . . . . . . . . . . . . . . . . . 68
Appendix B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
B-1 Z-Y-Z Euler Angles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
AppendixC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
C-1 Jacobians in the Force Domain . . . . . . . . . . . . . . . . . . . . . . . . 73
C-2 The J and J matrices for PUMA 560 . . . . . . . . . . . . . . . . . . . . 74
Appendix D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
D-1 Computer Program to Evaluate the Forward Kinematics ........ 79
D-2 Computer Program to Evaluate the Inverse Kinematics Solution . . . 81
D-3 Computer Program to Evaluate J and J matrices for PUMA 560 . . . 89
D-4 Computer Program to Verify the Equations of Motion and find the
computer processor time taken for the Real Model .......... 93
D-5 Computer Program to Verify the Equations of Motion and find the
computer processor time taken for the Approximate Model .... 108
D-6 Computer Program to get Joint Motor Torque@)for Controlling the
Robot based on the Real Model ..................... 122
D-7 Computer Program to get Joint Motor Torque@) for Controlling the
Robot based on the Approximate Model .. .. ... .... ....
D-8 Computer Program to get Forces(s) on the End Effector based on the
RealModel .................................
D-9 Computer Program to get Forces@)on the End Effector based on the
Approximate Model .................... ....... ,
AppendixE ..........................................
E-1 The Approximate Model . . . . . . . . . . . . . . . . . . . . . . . . . . .
I Chapter 1
Introduction
1.1 Background
The use of industrial robots became identifiable as unique devices in the 19609s,
along with computer aided design (CAD) systems, and computer aided manufacturing
(CAM) systems. Presently, the robots characterize the latest trends in automation of the
manufacturing process [60].
New disciplines of engineering, such as manufacturing engineering, applications
engineering, and knowledge engineering are beginning to deal with the complexity of the
field of robotics and the larger area of factory automation. Within a few years, it is
possible that robotics engineering will stand on its own as a distinct engineering
discipline.
A robot can be considered as a computer controlled industrial manipulator,
operating under some degree of autonomy. Such devices are extremely complex electro-
mechanical systems whose analytic description requires advanced methods which present
many challenging and interesting research problems. The official definition of such a
robot comes from the Robot Institute of America (RIA): A robot is a reprogrammable
multlfinctional manipulator designed to move material, parts, tools, or specialized
devices through variable programmed motions for the peformance of a variety of tasks.
The key element in this definition is the reprogrammability of robots. It is the computer
brain that gives the robot its utility and adaptability. The so-called robotics revolution
is, in fact, part of the larger computer revolution.
There are many other applications of robots in areas where the use of humans is
impractical or undesirable. Among these are undersea and planetary exploration, satellite
retrieval and repair, the defusing of explosive devices, and work in radioactive
environments. Finally, prostheses, such as artificial limbs, are themselves robotic
INTRODUCTION 8
WAIST 320'
SHOULDER 250
ELBOW 270'
FLANGE 532'
560 manipulator demonstrates generation of optimal time trajectory for two cooperating
robots [14]. A stochastic optimization problem has been formulated to obtain the optimal
production speed of robots based on measured geometric and non-geometric errors 1451.
Progress in extending "Soar" architecture to tasks that involve interaction with external
environments have been reported 1381. For space based robotic applications, a fast
computer architecture for the control of robots coupled with closed loop position control
and force/torque feedback has been developed [62]. Li and Sankar have presented a
scheme for fast inverse dynamic computation in real time robot control [40]. Boudor has
developed an exact kinematic model of PUMA 560 [9]. An energy based indirect
adaptive controller for robots has also been presented by Serafi and Khalil [24]. The
generation of joint space trajectories for robotic manipulators using different curve fitting
techniques have been discussed with results applied to PUMA manipulator following
circular paths in space [5]. A visual feedback control scheme called image based visual
servo has been proposed for manipulators with cameras on their hands (experiments have
been validated on PUMA 560) [30]. Dynamic modelling of geared and flexible jointed
manipulators (investigated using simulation on PUMA 560) has been presented [47]. The
feasibility of applying the principles of direct adaptive control to the industrial trajectory
tracking problem was rigorously investigated using PUMA 560 [39]. The trajectory
tracking performance of the non-linear feedback controller based on differential
geometric control theory was experimentally studied and tested on PUMA 560 arm [66].
A method allowing one to determine the feasibility of displacement trajectories
of a class of robot manipulators, namely with a wrist of intersecting axes (with PUMA
560 in particular) has been developed [71]. Singularity redundancy resolution with task
priority has been implemented (derivation based on PUMA geometry) using extended
Jacobian technique with weighted damped least squares [23]. The discrete time theory
that linearizes the nonlinear dynamics of the PUMA 560 robot arm has been
systematically developed [27]. A modular hierarchial model targeted for research and
development to control robots has also been studied [6]. Li introduced an approach for
fast mapping obstacles in the configuration space of the robot to plan collision free paths
for industrial robots (Calculation results were proved by graphical simulations of PUMA
INTRODUCTION 11
560 arm) [41]. The potential for using robotic techniques in the development of a
surgeon robot was investigated in a preliminary feasibility study using a six axis PUMA
robot [20]. A systematic procedure was presented to efficiently enumerate all possible
singular configurations for robotic manipulators [42]. An active end effector based force
control system for robotic deburring was successfully implemented using a PUMA 560
robot [lo].
programming, the notion of an OLP system extends to any programmable device on the
factory floor. A common argument raised in their favor is that an OLP system will not
tie up production equipment when it needs to be reprogrammed, and hence, automated
factories can stay in production mode a greater percentage of the time. They also serve
as a natural vehicle to tie computer aided design (CAD) data bases used in the design
phase of a product's development to the actual manufacturing of the product. In some
applications, this direct use of CAD design data can dramatically reduce the
programming time required for the manufacturing machinery.
Off-line programming of robots offers other potential benefits which are just
beginning to be appreciated by industrial robot users. Some of the problems associated
with robot programming are attributed to the fact that an external, physical workcell is
manipulated by the robot program. Programming of robots in simulation offers a way
of keeping the bulk of the programming work strictly internal to a computer - until the
application is nearly complete. Thus, many of the problems peculiar to robot
programming tend to diminish.
1.4 Summary
Chapter 2 describes the background on representation of coordinate systems and
transformation among various coordinate systems. It leads to the forward kinematics
problem, which is to determine the position and orientation of the end-effector or tool
given the joint variables. Chapter 3 discusses the problem of inverse kinematics, i.e.,
given the position and orientation of the end-effector, calculate the possible sets of joint
angles which attain this given position and orientation. In order to analyze manipulators
in motion, the concept of mapping velocities in joint space to velocities in Cartesian
space by the Jacobian matrix is presented in Chapter 4. This Chapter also deals with the
forces and moments required to cause motion to a manipulator. Here, we develop
techniques and algorithms based on Lagrangian dynamics for deriving the equations of
motion for PUMA 560. This aspect of developing equations of motion is used to control
the motion of the manipulator. To simulate how the manipulator would move under the
INTRODUCTION 13
application of a set of actuator torques, the dynamic equations are reformulated so that
the acceleration is computed as a function of actuator torques. Chapter 5 is concerned
with describing motion of the manipulator in terms of trajectories through space. The
conclusions and the scope of future work is presented in Chapter 6.
Chapter 2
Forward Kinematics
2.1 Introduction
Kinematics is the description of motion without regard to the forces that cause it.
It deals with the study of position, velocity, acceleration, and higher derivatives of the
position variables.
The Unimation PUMA 560 robot is an example of all rotary joint manipulator
with 6 dof (i.e., it is a 6R mechanism).
The homogenous matrix that transforms the coordinates of a point from frame i to frame
j is denoted by qJ(i > j).
Denoting the position and orientation of the end-effector with respect to the
inertial or the base frame by a three dimensional vector d,,(' and a 3x3 rotation matrix Rn0,
respectively, we define the homogenous matrix
Then the position and orientation of the end-effector in the inertial frame are
given by
Hence
FOR WARD KZNEMA TICS 17
The matrix R/ expresses the orientation of frame i relative to frame j (i > j) and
is given by the rotational parts of the TJ-matrices (i > j) as
where the notation Rot(x, a,,) stands for rotation about iiaxis by (2-1, Trans(x, a,-J is
translation along xi axis by a distance a,,, Rot(& BJ stands for r~tationabout iiaxis by
B,, and Trans(z, d,) is the translation along iiaxis by a distance di.
FORWARD KIMMA TICS
where the four quantities 4, ai, di, ai are the parameters of link i and joint i. Figure 2.2
illustrates the link frames attached so that frame (i) is attached rigidly to link i.
Axis i
L I
Figure 2.2 Coordinate Frames Satisfying D-H Assumptions (Adauted from 11811
The various parameters in Eq. (2.10) are given the following names:
In the usual case of a revolute joint, is called the joint variable, and the other
three quantities are the fixed link parameters. For the PUMA 560 robot, 18 numbers are
required to completely describe the fixed portion of its kinematics. These 18 numbers
are in the form of six sets of (a,, ai,di).
Table 2.1 shows the sets in the form of D-H table for PUMA 560:
Using the above values of the link parameters the individual link transformation matrices
c-'are computed. Then, the link transformations can be concatenated (multiplied
together) to find the single transformation that relates frame (6) to frame (0):
The transformation given by Eq. (2.11) is a function of all 6 joint variables. From the
robot's joint position sensors, the Cartesian position and orientation of the last link may
be computed using Eq. (2.11). Appendix A lists the individual link transformations T,?
and the final link transformation matrix T: as given by Equations (2.10) and (2.11).
FORWARD KINEMA TICS 20
These transformations were derived using the above D-H table for PUMA 560.
Appendix D shows the computer program to evaluate the forward kinematics i.e., T: of
the PUMA 560.
Chapter 3
Inverse Kinematics
3.1 Introduction
The Inverse Kinematics problem is contrasted with the forward (direct) kinematics
problem as follows: Given a desired position and orientation for the end-effector of the
robot, determine a set of joint variables that achieves the desired position and orientation.
The solution of the problem of finding the required joint angles is achieved by
decoupling the inverse kinematics problem into two simpler problems. First, the position
of the intersection of the wrist axes (W} is found, and then we find the orientation of the
wrist (See Figure 3.1 and Figure 3.2).
INVERSE KINEMA TICS 22
I 1
Figure 3.2 Examnle of the assignment of standard frames (Adanted from 1181).
3.2 Solvability
The equations for solving the inverse kinematics of a manipulator are nonlinear.
Given the numerical value of the transformation matrix, we find the values 8,, 8,, ..., 8,.
: given in Appendix A for the PUMA 560 manipulator,
Considering the equations for T
the statement of our problem is: Given the transformation matrix as ,T: solve for the six
joint angles 8, through 8,. For PUMA 560 with 6 dof, corresponding to equations in
Appendix A, we have twelve equations and six unknowns. However, among the nine
equations, arising from the rotation part of the transformation matrix T:, only three
equations are independent. These added with the three equations from the position part
of T
: gives six equations with six unknowns. These equations are nonlinear
transcendental equations.
A manipulator is considered solvable if all the sets of joint variables associated
with a given position and orientation can be determined [59].
We restrict our attention to closed form solution methods. In this context "closed
INVERSE KINEMA TICS 23
where
INVERSE KINEMA TICS 24
Using Eq. (2.10) for in Eq. (3.4) yields the following expressions forf; :
fi = a3c3+ d4sa3s3
+ a2
f2 = a3ca2s3- d4sa3ca2c3
- d4sa2ca3-d3sa2,
(3.5)
f3 = a3sag3-d4sa9a2c3+d,ca2ca3+d,ca2.
where
We now write an expression for the magnitude squared of OP,,, which is seen from Eq.
(3.6) to be
' = :
2 2
g +g2 +g3
r = f:+$+&+a:+&+2df,+2ul(cfl-s&). (3.9)
We now write this equation, along with the z component equation from Eq. (3.6), as a
system of two equations in the form
f = (k1c2+Q2)h1
+k3,
where
Eq. (3.10) is useful because dependence on 0, has been eliminated, and dependence on
8, takes a simple form.
For our case of PUMA 560, since we have chosen the D-H parameters in such
a way that a, is zero (see Table (2. I)), therefore after making the substitution
u = tan-
0
3
I
'
Having solved for 03, we may solve Eq. (3.10) for 8,, and Eq. (3.6) for 8,.
To complete our solution, we need to solve for 8,, 8,, and 8,. Since these axes
intersect, these joint angles affect the orientation of only the last link. We can compute
them based only upon the rotation portion of the specified goal, g. Having obtained 9,,
9,, and 9,, we can compute g,the orientation of link frame (3) relative to the base
frame. The desired orientation of (6) differs from this orientation by only the action of
the last three joints. Since the problem was specified given g,we can compute
For many manipulators, these last three angles can be solved by using the Z-Y-Z
Euler angle solution given in Appendix B applied to g. For any manipulator (with
intersecting axes 4, 5, and 6), the last three joint angles can be solved as a set of
appropriately defined Euler angles. Since there are always two solutions for these last
three joints, the total number of solutions for the manipulator will be twice the number
found for the first three joints. As shown in Table (3.1) below, corresponding to two
values for 8,, (obtained from quadratic equation (3.10) by using substitution of Eq.
(3.12)), we have two values of 8,, the equation for later being quadratic again. Using
this chain we have corresponding values for 8,, 8,, 8,, and 8,. Thus, we will have four
sets of joint solutions for 9,, O2..., 8,.
Using the Pieper's solution technique the expressions for respective joint angles for
PUMA 560 are as follows:
where X,,Y, and Z, are the end effector position coordinates corresponding to the 4th
column of the matrix Third, and "KC" is given by
6, = 0.0, and
86 = Atan2[r12, -rill
The computer program in Appendix D uses the Pieper's solution approach to
evaluate the above expressions for the inverse kinematics solution of PUMA 560. This
program is easily verified by checking the match of joint angles (O,, 8,, ..., 8,) input by
forward kinematics and the output obtained through inverse kinematics solution. Using
IN VERSE KINEMA TICS
the set of solutions obtained above a graphic simulation computer program is developed
to show the set of 4 possible configurations of the PUMA 560 (Appendix D). Figure 3.3
shows the 4 solutions i.e., arm up, arm down, elbow left, and elbow right configurations
of the PUMA 560 using the graphic simulation.
INVERSE KINEMATICS 29
-
4.1 Introduction
In this chapter we consider the equations of motion for the PUMA 560 i.e., the
way in which the manipulator moves due to torques applied by the actuators, or from
external forces applied to the manipulator.
We begin by deriving the so-called Euler-Lagrange equations. In order to
determine these equations in a specific situation, one has to form the Lagrangian of the
system. The Lagrangian dynamic formulation is an "energy based" approach to
dynamics, using the kinetic and potential energy of the system [65].
There are two problems related to the dynamics of the manipulator that we wish
to solve. The first problem requires to find the joint torques, T given a trajectory 8, 8
and 9. This formulation of dynamics is useful for controlling the manipulator [4]. The
second problem is to calculate how the mechanism will move under application of joint
torques. That is, given a torque vector, T, calculate the resulting motion of the
manipulator, 8, i and 9. This is useful for simulating the manipulator.
where the first term is the translational kinetic energy, and the second term is the
rotational kinetic energy. Vci is the linear velocity of the link's center of mass, hiis the
angular velocity of the link, and Ii is the inertia dyadic. The total kinetic energy of the
manipulator is the sum of kinetic energy of the individual links i.e.,
Since the VCi and 3,in Eq. (4.1) are the functions of 8 and 8, we see that the kinetic
energy of a manipulator can be described by a scalar formula as a function of joint
position and velocity, ~(8.8). In fact, the kinetic energy of a manipulator is given by
where M(8) is the nxn symmetric and positive definite manipulator mass matrix. An
expression of the form of Eq. (4.3) is known as a quadratic form, since when expanded
out, the resulting scalar equation is composed solely of terms whose dependence on the
8, is quadratic 1501. Eq. (4.3) can be seen to be analogous to the familiar expression for
the kinetic energy of a point mass,
where g is the 3x1 gravity vector, Pa is the vector locating the center of mass of the ith
link. The total potential energy stored in the manipulator is the sum of the potential
energy in the individual links i.e.,
Since, the Pa in (4.5) are functions of 8, we see that the potential energy of a
manipulator can be described by a scalar formula as a function of joint position, U(8).
The Lagrangian dynamic formulation provides a means for deriving the equations
EQUATIONS OF MOTION AND DYNAMICS 32
of motion from a scalar function called the Lagrangian, which is defined as the difference
between the kinetic and potential energy of a mechanical system. In our notation, the
Lagrangian of a manipulator is
and
EQUATIONS OF MOTION AND DYNAMICS
Also
- 1 aM,. .
ar, = -C-e.e-- au
as, 2, ae, ' j ae,
Thus the Euler-Lagrange equations can be written
In the above Eq. (4.13), there are three types of terms. The first involve the
second derivative of the generalized coordinates. The second are quadratic terms in the
first derivatives of 8, where the coefficients may depend on 8. These are further
classified into two types. Terms involving a product of the type I$are called centrifugal,
while those involving a product of the type eiej where i # j are called Coriolis terms.
The third type of terms are those involving only 8 but not its derivatives. Clearly the
latter arise from differentiating the potential energy. It is common to write Eq. (4.13)
in joint space as [57]
The fictitious forces acting on the end-effector, F, could in fact be applied by the
actuators at the joints using the relationship
where the Jacobian, J(8), is written in the same frame a F, usually the tool frame, {TI.
The Jacobian is a multidimensional form of the derivative. In the field of robotics
the Jacobians are time-varying linear transformations which relate joint velocities to
Cartesian velocities of the tip of the arm [18,64]. Mathematically, the forward kinematic
equations define a function between the space of Cartesian positions and orientations and
the space of joint positions. The velocity relationships are then determined by the
Jacobian of this function. The Jacobian is a matrix valued function and can be thought
EQUATIONS OF MOTION AND DYNAMICS 34
of as the vector version of the ordinary derivative of a scalar function. For example
where 19 is the vector of joint angles of the manipulator, and X is a vector of linear and
angular velocities of the end-effector. For any given configuration of the manipulator,
joint rates are related to velocity of the tip in a linear fashion. This is only an
instantaneous relationship.
For the PUMA 560, the Jacobian is 6x6, is 6x1, and X is 6x1. This 6x1
Cartesian velocity vector is the 3x1 linear velocity vector and the 3x1 rotational velocity
vector stacked together:
The dimension of the Jacobian is defined such that the number of rows equals the number
of degrees of freedom in the Cartesian space being considered. The number of columns
in a Jacobian is equal to the number of joints of the manipulator.
It may be desirable to express the dynamics of a manipulator with respect to
Cartesian variables [35]. This entails the formulation of the dynamic equations which
relate the acceleration of the end-effector expressed in Cartesian space to artesian forces
and moments acting at the end-effector. The general form of the Cartesian state space
equation is given as
We next develop a relationship between the joint space and Cartesian acceleration,
starting with the definition of the Jacobian,
from which we derive the expressions for the terms in the Cartesian dynamics as
M,(O) = J - T ( ~M(B)
) J -I(@,
~'(6,e) = - ~ ( e ) ~ - l ( e ) ~e),( e )
J-~(O)(V(~,~) (4.25)
G,(@ = J -T(e)~ ( 6 ) .
The Jacobian appearing in equations (4.25) is written in the same frame as F and
X in Eq. (4.18) (certain choices facilitate computation) though, the choice of this frame
EQUATIONS OF MOTION AND DYNAMICS 36
We may then apply any of the several known numerical integration techniques to
EQUATIONS OF MOTION AND DYNAMICS 38
we numerically integrate Eq. (4.26) forward in time steps of size At. For the purpose
of performing numerical integration, in our case the fourth order Runge-Kutta method
was used [56,12].
For the purpose of illustration, we introduce a simple integration scheme, called
Euler integration, which is accomplished as follows: Starting with t = 0, iteratively
compute
where for each iteration, Eq. (4.26) is computed to calculate 8. In this way, the position,
velocity, and acceleration of the manipulator caused by a certain input torque function
can be computed numerically. The time step At is selected such that it is sufficiently
small so that breaking continuous time into small increments is a reasonable
approximation. Also, At should be sufficiently large so that excessive computer time is
not required to compute a simulation.
4.6 Animation
A central element in OLP systems is the use of computer graphics to simulate the
robot [58]. This requires that the robot be modelled as a three-dimensional object.
Intergraph contains a facility to build 3-D CAD models. These models can be stored as
wireframe models or solid models. The 3-D solid model for PUMA 560 was created and
animated using Intergraph's Engineering Modeling System (EMS) [32,31]. Each
simulated entity such as the robot links are represented by an object. The object data
EQUATIONS OF MOTION AND DYNAMICS
structure contains the model of the entity, and several other attributes (from Kinematics
point of view). Each object can be referenced by a label because the object identification
numbers are stored as graphic variables.
The individual movement of the robot links is achieved using Intergraph's
Parametric Programming Language (PPL) feature [33]. PPL acts as the interface
between the results of dynamic simulation and its animation. The program (Appendix
D) reads the data file containing the time history of joint angles, 8,,8,,. ..8,, (obtained
from integration of Eq. (4.26)) and uses this as input to move the joint arms accordingly.
4.7 Verification
The computer programs based on the real and approximate model (Appendix D)
were tested. One of the criterion used to test the accuracy of the programs was to
assume that the PUMA 560 arm was in the "zero" configuration, as shown in Figure
(2.1). The arm is then released and falls freely under gravity without the application of
any external motor torques. At each successive time step, the value of kinetic energy,
potential energy, total energy and the variation in individual joint angles and joint
velocities were found. The analysis of output revealed the following results:
Starting from zero position the kinetic energy increased gradually and to
compensate for the increase in kinetic energy the potential energy decreased, in
accordance with the law of conservation of energy. Thus, the total energy of the system
remained constant (Figure 4.5). As expected, maximum variation of joint angle(s) was
seen in 8,, and minimum in 8, (Figure 4.1 to Figure 4.4).
4.8 Results
The objective of the set of computer programs mentioned above is to determine
how the mechanism will move under application of a set of joint torques. That is, given
a torque vector, 7, calculate the resulting motion of the manipulator, 8, 9 and 8. This
is useful for simulating the manipulator. The output of joint angles from both the models
was input to graphical simulation algorithm (Appendix D) and the behavior of the
EQUATIONS OF MOTION AND DYNAMICS 40
manipulator was analyzed. Figure 4.6 and Figure 4.7 show plots obtained for some
intermediate time steps for the real and approximate models respectively, when the
algorithms were tested using the "conservation of energy" approach.
The above computer programs are modified to find the required vector of joint
torques, r given a trajectory, 9 , 8 and 8. This formulation of dynamics is useful for the
problem of controlling the manipulator. Various joint space schemes are employed to
get the desired output. Chapter 5 gives the details on this aspect of trajectory generation.
EQUATIONS OF MOTION AND DYNAMICS 41
m
Real Model
m
-
m
FO
-- Approx. Model
e2 m
a
0
m
10
~ ~ 1 O L O I o * O T O . 0 . 7
Time in sec.
U
4 -
a -.
03 u Approx. Model
2
11
1
QI
0
1 - 1 I A 1 I
1 1 1 I Y - - Y I I I
. l J ! ! ! ! ! ! ! !
w a i ~ u a ~ o r ~ a ~
Time in sec.
EQUATIONS OF MOTION AND DYNAMICS 42
Real Model
-
--
Approx. Model
OD0.1 0 1 0 1 0 1 0 1 0 ) 0 . 7
Time in sec.
Real Model
-
--
Approx. Model
0 1 ) a 1 0 . 2 a a O A Q I O J a 7
Time in sec.
Q O D O D L . . . . . . . .
O D ~ 1 0 1 0 1 0 1 0 . 6 4 1 ~ 7
Time in sec.
Real Model
-
--
Approx. Model
M Q l M Q I O A P I M Q 7
Time in sec.
Real Model
-
--
Approx. Model
o J t / ! ! ! ! ! ! !
QO 0.q 01 aa OA M oa a7
Time in sec.
Real Model
-
--
Approx. Model
M ~ ~ Q I O S M M O J ~ ~
Time in sec.
I I
Figure 4.3 Variation of Joint velocities ( 8 ' , d e ' J w.r.1 Time
EQUATIONS OF MOTION AND DYNAMICS 44
Real Model
-
--
A p p r o ~Model
-
85'
OPll
OPll
OPY
-d 40#
W O . l o l ~ 0 l Q l W O 7
Time in sac.
-
0-
MDDrm
A
- M a f w m 0 4 Q l a a a 7
Time in sec.
Figure 4.5 Variation of Potential, Kinetic and Total Energies w.r.t Time
EQUATIONS OF MOTION AND DYNAMICS 46
I
I
Figure 4.6 Plot showing Intermediate steps when the PUMA 560 fails under gravity (Real Model).
EQUATIONS OF MOTION AND DYNAMICS 47
Chapter 5
Path Planning Schemes
5.1 Introduction
This chapter concerns with the methods of computing a trajectory in joint space
which causes a desired motion of a manipulator. Here, trajectory refers to a time history
of desired joint position, velocity, and acceleration for each degree of freedom.
This problem includes the human interface problem of how we wish to speczfi a
trajectory or path through space. In order to make the description of manipulator motion
easy for a user of a robot system, the user should not be required to write down
complicated functions of space and time to specify the task. Rather, the specification of
the trajectories must be done with simple descriptions of the desired motion. For
example, the user may just specify the desired goal position and orientation of the end-
effector, and let the system decide on the exact path, its duration, the velocity profile,
etc..
If desired velocities of the joints at the via points are known, then we can determine
cubic polynomials with the velocity constraints as:
PATH PLANNING SCHEMES
These four constraints can be satisfied by a polynomial of at least third degree. Since
a cubic polynomial has four coefficients, it can be made to satisfy the four constraints
given by Eq. (5.1) and Eq. (5.2). These constraints uniquely specify a particular cubic.
A cubic has the form
and so the joint velocity and acceleration along this path are clearly
Combining Eq. (5.3) and Eq. (5.4) with the four desired constraints yields four equations
in four unknowns:
Using Eq. (5.6) we can calculate the cubic polynomial that connects the initial and final
positions.
If we have the desired joint velocities at each via point, then we simply apply Eq.
(5.6) to each segment to find the required cubics. One of the ways in which desired
velocity at each of the via points might be specified is that the user inputs the desired
velocity in terms of a Cartesian linear and angular velocity of the tool frame at that
instant.
The Cartesian desired velocities at the via points are "mapped" to desired joint
rates using the inverse Jacobian of the manipulator evaluated at the via point.
5.4 Results
We developed algorithm@)corresponding to the real and approximate dynamic
models for generating cubic trajectories given arbitrary initial and final conditions
(Appendix D):
Given initial and final times, toand tf, respectively, with the set of four initial conditions,
(Eq. (5.1) and Eq. (5.2)) the required cubic polynomial 8(t) can be computed from Eq.
(5.3).
PATH PLANNING SCHEMES 52
A sequence of moves can be planned using equations (5.3) and (5.6) by using the
end conditions df, df of the i-th move as initial conditions for the i+ 1-th move. Thus the
input of Oft), e(t) and $(') (Eq.(5.3) and Eq. (5.4)) is applied to Eq. (4.14) to get the
vector of joint torques T [57]. With a similar analogy, Xft), ~ ( t ) and
, ~ ( t can
) be applied
to the Cartesian state space equation (Eq. (4.18)) to get the force-torque vector F acting
on the end-effector of the robot, and X, is an appropriate Cartesian vector representing
position and orientation of the end-effector [36].
As an example, Figure 5.1 shows the joint torques (real and approximate model,
respectively) for a specific instant at t=3 seconds, with:
do = 15'
8, = 75'
8, = 0.0 radlsec
and,
t, = 3 seconds.
Using the above analogy Figure 5.2 shows the forces for the real and approximate
model, respectively.
PATH PLANNING SCHEMES
Real Model
Aprx. Model
Real Model
I Aprx. Model
Force in N
Figure 5.2 An examvle lot showing the forces
I
Chapter 6
Conclusions and Future Work
'igure 6.1 A block Diagram of the PUMA 560 with New Controller and Sensors.
Appendix D shows a few routines available for running and controlling the PUMA 560
with the TRC004 interface board 1701.
References
[I] Ahmad, S., and Luo, S., "Coordinated Motion Control of Multiple Robotic
Devices for Welding and Redundancy Coordination through Constrained
Optimization in Cartesian Space", Proceedings of the IEEE Conference on
Robotics and Automation, Philadelphia, 1988.
[2] Akella, R., and Krogh, B., "Hierarchial Control Structures for Multicell Flexible
Assembly System Coordination", IEEE Conference on Robotics and Automation,
Raleigh, N.C., April 1987.
[3] Armstrong, B. and Khatib, 0. and Burdick, J., "The Explicit Dynamic Model and
Inertial Parameters of the PUMA 560 Arm", IEEE, pp. 510-518, 1986.
[4] Asada, H., and Slotine, J. J., Robot Analysis and Control, Wiley , 1986.
[6] Bar-On, D., Gutman, S., and, Israeli, A. "The TRACK - Technion Robot and
Controller Kit", Proceedings of the 1991 IEEE International Conference on
Robotics and Automation, Sacramento, CA, April 1991.
[q Barnett, S., Matrix Methods for Engineers and Scientists, McGraw-Hill Book
Company (UK) Limited, 1979.
[S] Bobrow, J., Dubowsky, S., and Gibson, J., "On the Optimal Control of Robotic
REFERENCES
Manipulators with Actuator Constraints", Proceedings of the American Control
Conference, June 1983.
[9] Bodur, I.N., "Improved Kinematic Model for Robots and Spatial Mechanisms.
Part 11. An Exact Kinematic Model of PUMA 560", 3rd ASME Conference on
Flexible Assembly Systems presented at the 1991 ASME Design Technical
Conferences, Miami, FL, September 1991.
[lo] Bone, G.M., Elbestawi, M.A., Lingarkar, R., and Liu, L. "Force Control for
Robotic Deburring " , Journal of Dynamic Systems, Measurement and Control,
Transactions of ASME, vol. 113, no. 3, pp. 395-400, September 1991.
[ll] Brooks, R., "Solving the Find-Path Problem by Good Representation of Free
Space", IEEE Transactions on Systems, Man, and Cybernetics, SMC-13, pp. 190-
197, 1983.
[12] Burden, R.L., and Faires, J.D., Numerical Analysis, PWS-KENT Publishing
Company, Boston, MA, 1989.
[14] Cho, H.C., Jeon, H.T., and, Lee, H.G., "Generation of Optimal Time Trajectory
for the Two Cooperating Robot Manipulators", IEEE Conference on systems, Man
and Cybernetics, Los Angeles, CA, November 1990.
[IS] Chuang, H., "Model Uncertainty and its Effects on Compliant Motion in Design
and Simulation of the PUMA robot arm", Proceedings of the SLAM Regional
REFERENCES 61
Conference on Geometric Aspects of Industrial Design, Wright-Patterson AFB,
OH, April 1990.
[la Conte, S., and DeBoor, C., Elementary Numerical Analysis: An Algorithmic
Approach, 2nd Edition, McGraw-Hill, 1972.
[17] Craig, J.J., "Coordinated Motion of Industrial Robots and 2-DOF Orienting
Tables", Proceedings of the 17th International Symposium on Industrial Robots,
Chicago, April 1987.
[IS] Craig, J. J., Introduction to Robotics, Mechanics and Control, Addison Wesley,
Reading, MA, 1989.
[20] Davies, B.L., Hibberd, R.D., Ng, W .S., Timoney, A. G., and, Wickham, J.E. A.,
"Development of a Surgeon Robot for Prostatectomies", Proceedings of the
Institution of Mechanical Engineers, Pan H: Journal of Engineering in Medicine,
vol. 205, no. 1, pp. 35-38, 1991.
[21] Denavit, J., and Hartenberg, R.S., "A Kinematic Notation for Lower-Pair
Mechanisms Based on Matrices", Journal of Applied Mechanics, pp. 215-221,
June 1955.
[23] Egeland, O., Sagli, J.R., Spangelo, I., and Chiaverini, S., "A Damped Least
Squares Solution to Redundancy Resolution", Proceedings of the 1991 IEEE
REFERENCES
[24] El, S.K., and, Khalil, W . , "Energy Based Indirect Adaptive Control of Robots",
Proceedings of the 1991 IEEE International Conference on Robotics and
Automation, Sacramento, CA, April 1991.
[26] Erlic, Mile, Jones, Kevin, Lu, W. -S ., "Hardware Interface Configuration for
Motion Control of the PUMA-560 and the Mitsubishi RM-501 Robots",
Proceedings of the 1991 IEEE Pacijic Rim Conference on Communications,
Computers and Signal Processing, Victoria, BC , May 1991.
[27l Ganguly, S., Tarn, T.J., and, Bejczy, A.K., "Control of Robots with Discrete
Non-Linear Model: Theory and Experimentation", Proceedings of the 1991IEEE
International Conference on Robotics and Automation, Sacramento, CA, April
1991.
[29] Gupta, K.K., and Guo, Z.P., "A Practical Motion Planner for PUMA 560",
Proceedings of the 1991 IEEE Pacijic Rim Conference on Communications,
Computers and Signal Processing, Victoria, BC, May 1991.
[30] Hashimoto, K., Kimoto, T., Ebine, T., and, Kimura, H., "Manipulator Control
with Image Based Visual Servo", Proceedings of the 1991 IEEE International
Conference on Robotics and Automation, Sacramento, CA, April 1991.
REFERENCES 63
IntergraphIEngineeringModeling System (IIEMS), Reference Manual, Huntsville,
Alabama, October 1990.
Johanni, R., and Pfeiffer, F., "A Concept for Manipulator Trajectory Planning",
Proceedings of the IEEE Conference on Robotics and Automation, San Francisco,
1986.
Laird, J.E., Yager, E.S., Hucka, M., and Tuck, C.M., "Robo-Soar. An
Integration of External Interaction, Planning and Learning Using Soar", Robotics
and Autonomous Systems, vol. 8, no. 1-2, pp. 113-129, 1991.
REFERENCES 64
[39] Leahy, M.B. Jr., Whalen, P.V., "Direct Adaptive Control for Industrial
Manipulators", Proceedings of the 1991 IEEE International Conference on
Robotics and Automation, Sacramento, CA, April 1991.
[40] Li, C.J., and, Sankar, T.S., "Fast Inverse Dynamics Computation in Real Time
Robot Control", 16th Annual Conference of IEEE Industrial Electronics Society,
Pacific Grove, CA, November 1990.
[41] Li, W., "Schnelle Abbildung Von Hindernissen in den Konfigurationsraum" ,(Fast
Mapping Obstacles in the Configuration Space), Univ des Saarlandes,
Saarbruecken, Germany, Robotersysteme vol. 7, no. 3, pp. 148-154, September
1991.
[42] Lipkin, H., and Pohl, E., "Enumeration of Singular Configurations for Robotic
Manipulators", Journal of Mechanisms, Transmissions, and Automation in Design,
vol. 113, no. 3 pp. 272-279, September 1991.
[43] Lozano-Perez, T., "A Simple Motion Planning Algorithm for General Robot
Manipulators", ZEEE Journal of Robotics and Automation, Vol. RA-3, No. 3,
June 1987.
[45] Moon, K.S., Azadivar, F., and Kim, K., "Stochastic Optimization of the
Production Speed of Robots Based on Measured Geometric and Non-Geometric
Errors", International Journal of Production Research, vol. 30, no. 1, pp. 49-62,
January 1992.
REFERENCES 65
[46] Mujtaba, S., and R. Goldman, "4User's Manual", 3rd Edition, Stanford
Department of Computer Science, Report No. STAN-CS-81-889, December 1981.
[47l Murphy, S.H., and, Wen, J.T., "Dynamic Modelling of Geared and Flexible
Jointed Manipulators", Proceedings of the 1991 IEEE International Conference
on Robotics and Automation, Sacramento, CA, April 1991.
[49] Nelson, B., Pedersen, K., and Donath M., "Locating Assembly Tasks in a
Manipulator's Workspace", IEEE Journal of Robotics and Automation, Raleigh,
N.C., April 1987.
[Sl] Oh, Se-Young., and Joe, Moon-Jeung., "Dynamic Control of a Six Degree of
Freedom Robot Manipulator Using Neural Networks", International Joint
Conference on Neural Networks, Seattle, WA, July 1991.
1521 Parkin, R.E., Applied Robotic Analysis, Prentice Hall, NJ, 1991.
[S3] Peshkin, M., and A. Sanderson, "Planning Robotic Manipulation Strategies for
Sliding Objects", IEEE Conference on Robotics and Automation, Raleigh, N.C.,
April 1987.
[S4] Pieper, D., and B. Roth, "The Kinematics of Manipulators Under Computer
Control", Proceedings of the Second International Congress on Theory of
Machines and Mechanisms, Vol. 2, pp. 159-169, Zakopane, Poland, 1969.
REFERENCES 66
[55] Pieper, D., " The Kinematics of Manipulators Under Computer Control",
Unpublished Ph.D. Thesis, Stanford University, 1968.
[56] Press, W.H., Flannery , B. P., Teukolsky, S.A., and Vetterling, W.T., Numerical
Recipes in C, The Art of ScientiJic Computing, Cambridge University Press, New
York, 1988.
[57] Raibert, M., "Mechanical Arm Control Using a State Space Memory", SME
paper MS77-750, 1977.
[58] Rogers, D. F., and J. A. Adams, Mathematical Elements for Computer Graphics,
published by McGraw-Hill, New York, 1990.
[61] Shin, K., and N. McKay, "Minimum-Time Control for Manipulators with
Geometric Path Constraints", IEEE Transactions on Automatic Control, June
1985.
[62] Smiarowski, A. Jr., and Anderson, J.N., "Fast Computer Architecture for the
Control of Robots", Computers and Electrical Engineering, vol. 17, no. 3, pp.
217-235, 1991.
REFERENCES 67
[64] Spong, M. W., and M. Vidyasagar, Robot Dynamics and Control, John Wiley &
Sons, NY, 1989.
[65] Symon, K.R., Mechanics, 3rd Edition, Addison-Wesley, Reading, MA, 1971.
[66] Tarn, T.J., Ganguly, S., Ramadorai, A.K., Marth, G.T., and Bejczy, A.K.,
"Experimental Evaluation of the Non-Linear Feedback Robot Controller",
Proceedings of the 1991 IEEE International Conference on Robotics and
Automation, Sacramento, CA, April 1991.
[671 Trident Robotics and Research, Inc., TRCW User's Manual, Wexford,
Pennsylvania, September 1991.
where
APPENDIX A
Appendix B
The solution for extracting Z-Y-Z Euler angles from a rotation matrix is stated below:
Given
If sin0 # 0, then
APPENDIX B
If 0 = 0.0, then a solution may be calculated as
6X = J 6 0 ,
F ~ =J rT.
APPENDIX C
z = J T F.
Thus, the Jacobian transpose maps Cartesian forces acting at the hand into equivalent
joint torques. Eq. (C-6) is very interesting relationship in that it allows us to convert a
Cartesian quantity into a joint space quantity without calculating any inverse kinematic
functions. This is made use of in considering control problems.
where
where
D-1 Computer Program to Evaluate the Forward Kinematics, i.e., of the PUMA 560
#include < stdio.h >
#include < math.h >
#include < stdlib. h >
#include < time.h >
I* Defining factorizations for trignometric terms that are functions of joint angles *I
ldefine pi (3.1415927)
main()
{
void frwd-matrix(); I* Returns,,T *I
APPENDIX D
printf("xe ye ze %f %f %fin",xe,ye,ze);
return;
1
void fwd-matrix(Tdesired)
float Tdesired[S][S];
{
return;
1
APPENDIX D
D-2 Computer Program to Evaluate the Inverse Kinematics Solution of PUMA 560
#include < stdio. h >
#include < math.h >
#include < std1ib.h >
I* Defining factorizations for trignometric terms that are functions of joint angles *I
float kll,k21,k31;
float k12,k22,k32;
float kc,kcl;
float r;
float g l 1,g2;
float g12;
float g13;
float g14;
main()
I**** CAN USE THIS CHECK TO FIND SUITABLE thetar31 AND PROCEED TO FIND theta(21
value@)******/
+
k32=a3*a3 +d4*d4 +d3*d3 +a2*a2 2.0*a2*a3*cos(angles[3][1]) +
2.0*a2*d4*sin(angles[3][1]) + d2*d2 +
2.0*d2*d3;
printf("k12,k22,k32 < <check k32 is same as r > > %f %f %f \nU,k12,k22,k32);
I**** CAN USE THIS CHECK TO FIND SUITABLE theta[3] AND PROCEED TO FIND theta[2]
value(s)******/
+
angles[2][3]= atan2(-k12,k22) atan2( sqrt(k22*k22 + k12*k12 -ze*ze),ze );
+
angles[2][4]= atan2(-k12,k22) - atan2( sqrt(k22*k22 k12*k12 -ze*ze),ze );
printf("2 values of theta[2] in deg (from angles[3][1]):-> angles[2][3] angles[2][4] %f
%~n",angles[2][3]*180.0/pi,angles[2][4]*180.0/pi);
angles[l][3]=atan2(g13*yeg?*xe,g13*xe+g2*ye);
printf("angles[4][1],angles[5][1],angles[6][1] in DEG %f %f
%fin",angles[4][1]*180.0/pi,angles[51[1]*180.0/pi,angles[6][1]*180.0/pi);
printf("angles[4][2],angles[5][2],angles[6][2] in D E G %f %f
%f\n",angles[4][2]*180.0/pi,angles[5][2]*180.0/pi,angIes[6][2)*180.01pi);
printf("angles[4][3],angles[5][3],angles[6][3] in D E G %f % f
%fin",angles[4][3]*180.0/pi,angles[5][3]*180.0/pi,angles[6][3]*18O.O/pi);
APPENDIX D
return;
1
void zR3Trans(lhstrans)
float lhstrans[4][4] ;
{
lhstrans[l][l] =cl*c23;
lhstrans[l][2] =sl*c23;
lhstrans[1][3] =-s23;
return;
1
APPENDIX D
/* Defining factorizations for trignometric terms that are functions of joint angles */
int i;
main()
{
void jacobiano; I* Returns the (6x6) Jacobian Matrix *I
void jacobdoto; I* Returns the (6x6) j Matrix *I
jacobian(jac);
for(i=l;i< =6;i+ +)
printf("jac main %f %f %f %f %f %fint'jac[i][l] jac[i][2] jac[i][3] jac[i][4] jac[i][5]jac[i][6]);
APPENDIX D 90
jacobdot(jacd0t);
for(i=l;i< =6;i+ +)
printf("jacdot main %f %f % f % f % f %finwjacdot[i][l] jacdot[i][2] jacdot[i][3]jacdot[i][4] jacdot[i][5]jacdot[i][q);
return;
1
void jacobiadjac)
float jac[7[7];
{
jac[l][l] = -sl*(c23*a3 + s23*d4 + c2*a2) cl*(d2 +d3);
jac[l][2]= cl*(-s23*a3 + c23*d4 - s2*a2);
jac[l][3]= cl*(-s23*a3 + c23*d4);
jac[l][4] = 0.0;
jac[1][5J = 0.0;
jac[1][6]= 0.0;
jac[S][l]= 0.0;
jac[5][2] = cl ;
jac[5][3]= cl;
jac[5][4]= sl*s23;
jac[5][5] = -sl*c23*s4 +cl *c4;
jac[5][6] = (sl*c23*c4 +cl*s4)*s5 +sl*s23*c5;
APPENDIX D
for(i=l;i< =6;i++)
p ~ t f ( " j a csubr %f %f %f %f %f %fin"jac[i][l] jac[i][2] jac[i][3] jac[i][4] jac[i][5] ~ac[i][6]);
return;
1
void jacobdot(jacdot)
float jacdot[q[q;
{
jacdot[l][l]= -cl*c23*a3*thdot[l] +
sl*s23*a3*(thdot[2]+thdot[3]) -cl*s23*d4*thdot[l]
-sl *c23*d4*(thdot[2] +thdot[3]) +s2*a2*thdot[2] +sl*(d2+d3)*thdot[l];
jacdot[l][2]= sl*s23*a3*thdot[l] -cl*c23*a3*(thdot[2]+thdot[3]) -sl*c23*d4*thdot[l] -cl*s23*d4*thdot[l]
+sl*s2*a2*thdot[l] -cl*c2*a2*thdot[2];
jacdot[l][3] = s l *s23*a3*thdot[l] - c l * c 2 3 * a 3 * ( t h d o t [ 2 ] + t h d o t [ 3 ] ) - s l * c 2 3 * d 4 * t h d o t [ l ]
-cl *s23*d4*(thdot[2]+thdot[3]);
jacdot[l][4] = 0.0;
jacdot[l][5] = 0.0;
jacdot[l][6] = 0.0;
APPENDIX D 92
for(i=l;i< =6;i++)
printf("jacdot subr %f %f %f %f %f %!In" jacdot[i][l] jacdot[i][2],
jacdot[i][3] jacdot[i][4] jacdot[i][5] jacdot[i][6]);
return;
1
APPENDIX D 93
D-4 Computer Program to Verify the Equations of Motion (Using "Conservationof Energy
Approach") and find the computer processor time taken for the Real Model
I* Defining factorizations for trignometric terms that are functions of joint angles *I
/* Defining Expressions for the Inertial Constants Appearing in the Equations of Forces of Motion *I
#define i l l (-0.0142)
#define i12 (-0.0110)
#define i13 (-3.79e-03)
APPENDIX D
I* Defining Expressions for the Gravitational Constants Appearing in the Equations of Forces of Motion *I
float **a,**yy,d,*col;
int i ,j,*indx;
float ar[q[q,br[7][16],CR[q[q,gr[q;
I* A(6x6), B(6x15), and C(6x6) matrices and the g(6x1) vector *I
float **y,*xx=O;
float kecons,pecons,totenrgy; I* The Scalars Kinetic Energy, Potential Energy and the Total Energy *I
APPENDIX D
main()
{
void armat(); I* Returns the expressions giving the elements of the Kinetic Energy matrix *I
void brmat(); I* Returns the expressions giving the elements of the Coriolis matrix *I
void CRrnat(); I* Returns the expressions giving the elements of the Centrifugal matrix *I
void grmato; I* Returns the Gravity terms *I
int k;
float iden[q[q;
start = clock(); I* get the no. of system clock ticks per second *I
fmt=time(NULL); I* get the system time *I
x1=0.0; I* Range *I
x2=1.0;
nvar= 12; I* Number of variables */
nstep=lO; I* Number of steps *I
kecons =0.0;
pecons=O.O;
totenrgy =0.0;
APPENDIX D
end = clock(); I* again get the system clock time after the running of processor *I
second=time(NULL); I* again get the system time after the running of processor */
void armat(ar)
float ar[q[q;
{
int i j ;
APPENDIX D
return;
1
void brmat(br)
float br[7l[16];
{
int i j;
APPENDIX D
APPENDIX D
APPENDIX D
for (i=l;i<=6;i++)
{p~tf("br %f %f %f %f %f %f %f %f\n",br[i][l],br[i][2],br[i][3],br[i][4],br[i][5],br[i][6],br[i][q,br[i][8]);
printf(" %f%f %f%f %f %f %~n",br[i][9],br[i][lO],br[i][ll],br[i][l2],br[i][l3],br[i][l4],br[i][l5]);}
//pMtf("frombr brll= %f\n",br[l][l]);
return;
1
void CRmat(CR)
float CR[?[q;
{
int i J;
extern float br[7][16];
for(i=l;i<7;i++)
printf("CR %f %f %f %f %f %f\nw,CR[i][l],CR[i][2],CR[i][3],CR[i][4],CR[i][5],CR[i][6]);
for ( i = l ; i < =6;i++)
return;
1
void grmat(gr)
float gr[7];
{
int i;
gr[l]= (0.0);
+ +
gr[2]= (ggl*c2 gg2*s23 + gg3*s2 + gg4*c?3 ggS*(s23*c5 + c23*c4*s5) );
+ +
gr[3]= (gg2*s23 gg4*c23 + ggS*(s23*c5 c23*c4*s5) );
gr[4] = (-ggS*s23*s4*s5 );
+
gr[5] = (ggS*(c23*sS s23*c4*c5) );
gr[6] = (0.0);
return;
1
void rk4(y,dydx,n,x,h,yout,derivs)
float yn,dydxfl,x,h,youtu;
void (*derivs)();
int n;
{
int i;
float xh,hh,h6,*dyrn,*dyt,*yt,*vector();
void free-vector();
APPENDIX D
xh=x+hh;
for ( i = l ; i < =n;i+ +) yt[i]=y[i]+hh*dydx[i];
(*derivs)(xh,yt,dyt);
for ( i = l ; i < =n;i+ +) yt[i]=y[i]+hh*dyt[i];
(*derivs)(xh, yt ,dym);
for ( i = l ; i < =n;i++) {
yt[i]=y[i]+h*dym[i];
+
dym[i] = dyt[i];
1
(*derivs)(x+ h,yt,dyt);
for ( i = l ; i < =n;i++)
yout[i] =y[i] +h6*(dydx[i] +dyt[i] +2.0*dym[i]);
free-vector(yt, 1 ,n);
free-vector(dyt,l ,n);
free_vector(dym, 1 ,n);
1
float *vector(nl,nh)
int nl,nh;
{
void nremr();
float *v;
v=(float *)malloc((unsigned) (nh-nl+ l)*sizeof(float));
if (!v) nrerror ("allocation failure in vector()");
return v-nl;
1
void free_vector(v,nl,nh)
float *v;
int n1,nh;
{
+
frce((char*) (v nl));
}
void nrerror(error-text)
char error-textu;
{
void exit();
fp~tf(stderr,"NumericalRecipies run-time error ...\nu);
f p ~ t f ( s t d e r r , %s\n"
" ,error-text);
f p ~ t f ( s t d e r r , "..now
. exiting to system. ..\nW);
exit(1);
1
v =vector(l ,nvar);
vout =vector(l ,nvar);
dv =vector(l ,nvar);
xx=vector(l ,nvar);
y =matrix(l ,nvar, 1,nvar);
float **matrix(nrl,nrh,ncl,nch)
int nrl,nrh,ncl,nch;
{
int i;
float **m;
I* This evaluates e = A-l(7 - ~ @ ) @ 9-) C@)(02) - g(e)), which is integrated by RK-4 method to yield j o i n t
velocities i.e., 9 and joint positions i s . , 9 *I
int i j ;
+
for(i=l j = 2 ; i < =2*N-1 j < =2*N;i+ j = j + 2 )
dydx[j]=-(br[i][l]*y[2]*y[4] + br[i][2]*y[2]*y[6] + br[i][3]*y[2]*y[8]+ br[i][4]*y[2]*y[10] + br[i][S]*y[2]*y[12]
+ + + +
+ br[i][6]*y[4]*y[6] br[i][7]*y[4]*y[8] br[i][8]*y[4]*y[lO] br[i][9]*y[4]*y[12] br[i][lO]*y[6]*y[S] +
br[i][ll]*y[6]*y[lO] + br[i][12]*y[6]*y[12]+ br[i][13]*y[8]*y[10] + br[i][14]*y[8]*y[12]+ br[i][l5]*y[lO]*y[12]
+ +
+ CR[i][l]*y[2]*y[2] + CR[i][2]*y[4]*y[4] + CR[i][3]*y[6]*y[6] CR[i][4]*y[8]*y[S] CR[i][5]*y[lO]*y[lO] +
CR[il[61*~[l21*y[l21 + gr[il 1;
//confusion also wrong m2 ylsq. y2sq. for CR dydx[j]=-(br[i][l]*y[l]*y[3! + br[i][2]*y[l]*y[5] +
br[il[3I*y[ll*y[T + br[il[4I*y[ll*y[91 + br[il[5l*y[lI*y[lll + br[i1[61*~[31*y[51 + br[i1[7l*y[3l*y[T +
br[il[8l*y[3l*y[9] + br[i][9]*y[3]*y[ll] + br[i][lO]*y[S]*y[7] + br[i][ll]*y[S]*y[9] + br[i][l2]*y[5]*y[ll]+
br[i][l3]*y[7J*y[9] + br[i][14]*y[7]*y[ll] + br[i][lS]*y[9]*y[ll] + CR[i][l]*y[l]*y[l] + CR[i][2]*y[2]*y[2] +
CR[il[31*~[31*~[31+ CR[i1[41*~[41*~[41+ CR[i1[~1*y[~I*y[51+ CR[i1[6l*y[61*y[61 + gr[il 1;
11 printf("dydx-first %f %f %f %f %f %f\n",dydx[2],dydx[4],dydx[6],dydx[8],dydx[l0],dydx[l2]);
APPENDIX D
I* for(i= 1;i < =6;i+ +)
printf("dydx matrix yy %f %f %f %f %f %nn",yy[i][l],yy[i][2],yy[i][3],yy[i][4],yy[i][S],yy[i][6]); *I
void ludcmp(a,n,indx,d)
int n,*indx;
float **a,*d;
{
int i,imax j,k;
float big,dum,sum,temp;
float *w,*vector();
void nrerror(),free_vector();
w =vector(l ,n);
*d = 1.O;
for(i=l;i< =n;i++){
big=0.0;
for(i=lG< = n $ + + )
if ((temp = fabs(a[i][i])) > big) big =temp;
if (big = = 0.0) nrerror("Singu1ar matrix in routine LUDCMP");
w[i] = 1 .Olbig;
1
forc=l;i<=n;j++) {
for(i=l;i<j;i++) {
sum=a[i][i];
for ( k = l ; k < i ; k + +) sum -= a[i]F]*aF]lj];
a[i][i] =sum;
1
big=0.0;
for(i=j;i< =n;i+ +){
sum=a[i][i];
for ( k = l ; k < j ; k + + )
sum -= a[i]F]*aF][i];
a[i][i] =sum;
if ( (dum=w[i]*fabs(sum)) > = big) {
big=dum;
imax =i;
1
1
if (i ! = imax) {
for(k=l;k< =n;k++) {
dum =a[imax]F];
a[imaxlRl =a[ilFI;
a[i]F] =durn;
1
*d = -(*d);
w[iax]=w[i];
1
indx[i] =imax;
if (a[i][i] = = 0.0) a[i][i]=TINY;
if(i ! = n) {
durn= l.O/(a[i][i]);
APPENDIX D
void lubksb(a,n,indx,b)
float **a,bO;
int n,*indx;
{
int i,ii=O,ip J;
float sum;
for(i=l;i< = n ; i + + ) {
ip=indx[i];
sum =b[ip];
b[ip] =b[i];
if (ii)
for(i=ii;i < =i-l;i+ +) sum -= a[i]fi]*bfi];
else if (sum) ii=i;
b[i] =sum;
1
for(i=n;i > =I$-){
sum=b[i];
for(j=i+l;i< =n;i+ +) sum-= a[i]fi]*bfi];
b[i] =sumla[i][i];
APPENDIX D
D-5 Computer Program to Verify the Equations of Motion (Using "Conservationof Energy
Approach") and find the computer processor time taken for the Approximate Model
#include < stdi0.h >
#include < math. h >
#include <stdlib.h >
#include <time.h >
I* Defining factorizations for trignometric terms that are functions of joint angles *I
float **a,**yy,d,*col;
int i j,*indx;
float ap[7l[7l,bp[7l[16],CP[7l[l,gp[7]; I* A(6x6), B(6x15), and C(6x6) matrices and the g vector *I
float **y,*xx=O;
main()
{
void apmat(); I* Returns the expressions giving the elements of the Kinetic Energy matrix *I
void bpmat(); I* Returns the expressions giving the elements of the Coriolis matrix *I
void CPmat(); I* Returns the expressions giving the elements of the Centrifugal matrix *I
void gpmato; I* Returns the Gravity vector *I
void ludcmp(),lubksb();
float **matrix();
float *vector();
int k;
float i d e n [ l [ l ;
start = clock(); I* get the no. of system clock ticks per second *I
first=time(NULL); I* get the system time *I
x1=0.0; I* Range *I
x2=1.0;
nvar=12; I* Number of Variables *I
nstep= 10; I* Number of Steps *I
for(i=l;i< =6;i+ +)
for(j=l;i<=6;i++)
kecons = kecons + O.S*(veI[i]*ap[i]fi]*vel~]);
end = clock(); I* again get the system clock time after the running of processor *I
second=time(NULL); /* again get the system time after the running of processor */
return;
1
void apmat(ap)
float apt7)[7);
{
int i j ;
APPENDIX D
return;
1
void bprnatpp)
float bp[7[16];
{
int i j ;
APPENDIX D
APPENDIX D
return;
1
void CPrnat(CP)
float CP['TJ[T;
{
APPENDIX D
extern float bp[7][16];
for(i=l;i<7;i++)
p ~ t f ( " C R%f %f %f %f %f %fin",CP[i][l],CP[i][2],CP[i][3],CP[i][4],CP[i][S],CP[i][6]);
return;
APPENDIX D
void gpmat(gp)
float
{
int i;
gp[lI= (0.0);
gp[2]= (-37.2*c2 - 8.4*s23 +
1.02*s2 );
gp[3] = (-8.4*s23 +
0.25*c23 );
gp[4]= ( 2.8e-O2*~23*s4*sS );
gp[5] = ( -2.8e-02*(~23*~5+ s23*c4*c5) );
gp[61= (0.0);
return;
1
void rk4(y,dydx,n,x,h,yout,derivs)
float yD,dydxu,x,h,yout[l;
void (*derivs)();
int n;
{
int i;
float xh,hh,h6,*dym,*dyt,*yt,*vector();
void freevector();
dym=vector(l,n);
dyt=vector(l ,n);
yt=vector(l ,n);
hh=h*O.S;
h6=h16.0;
xh=x+hh;
for (i= l ; i < =n;i+ +) yt[i]=y[i]+hh*dydx[i];
(*derivs)(xh,yt,dyt);
for ( i = l ; i < =n;i+ +) yt[i]=y[i]+hh*dyt[i];
(*derivs)(xh,yt,dym);
for ( i = l ; i < =n;i++):{
yt[i] =y[i] + h*dym[i];
dym[i] + = dyt[i];
1
+
(*derivs)(x h,yt,dyt);
for ( i = l ; i < =n;i++)
yout[i] =y[i] +h6*(dydx[i] +dyt[i] +2.0*dym[i]);
free-vector(yt, 1 ,n);
free-vector(dyt,l ,n);
free_vector(dym,l ,n);
1
float *vector(nl,nh)
int n1,nh;
APPENDIX D
{
void nrerror();
float *v;
v =(float *)malloc((unsigned) (nh-nl+ l)*sizw f(float));
if (!v) nrerror ("allocation failure in vector()");
return v-nl;
1
void free-vector(v,nl,nh)
float *v;
int nl,nh;
{
+
free((char*) (v nl));
1
void nrerror(error-text)
char error-textn;
{
void exit();
fp~tf(stderr,"NumericalRecipies run-time error ...\nW);
f p ~ t f ( s t d e r r ,%s\nW
" ,error-text);
f p ~ t f ( s t d e r r ,...
" now exiting to system.. .\nV);
exit(1);
1
float **matrix(nrl,nrh,ncl,nch)
int nrl,nrh,ncl,nch;
{
int i;
float **m;
+
m =(float **) malloc((unsigned) (nrh-nrl l)*sizeof(float*));
if (!m) nrerror("al1ocation failure 1 in matrix()");
m -=nrl;
void derivative(x,y,dydx)
float x,yfl,dydx[;
{
void apmat();
void bpmat();
void CPmat();
void gpmat();
int i j ;
APPENDIX D
void ludcmp(a,n,indx,d)
int n,*indx;
float **a,*d;
{
int i,irnax j,k;
float big,dum,sum,temp;
float *w,*vector();
void nrerror() ,free-vector();
w=vector(l ,n);
*d=1.0;
for(i=l;i< =n;i++){
big=0.0;
for(i=l;j<=n;i++)
if ((temp = fabs(a[i]G])) > big) big= temp;
if (big = = 0.0) nrerror("Singu1ar matrix in routine LUDCMP");
w[i] = 1 .O/big;
1
for(j=l;j<=nj++) {
for(i=l;i <j;i+ +) {
sum =a[i][i];
for (k= 1;k <i;k+ +) sum -= a[i]F]*a[k][i];
a[i]G] =sum;
1
big=0.0;
for(i=j;i< =n;i+ +){
sum=a[i][i];
for ( k = l ; k < j ; k + + )
sum -= a[i]F]*aF][i];
a[i][i] =sum;
if ( (dum=vv[i]*fabs(sum)) > = big) {
big=dum;
imax =i;
1
1
if (i != imax) {
for(k=l;k< =n;k+ +) {
durn =a[imax][k];
a[imax]F] =ab][k];
APPENDIX D
a[i][k] =durn;
1
* d = - (* dl;
w[imax] =w[i];
1
indx[i] =imax;
if (a[i][i] = = 0.0) a[i][i] =TINY;
if6 != n) {
dum= 1.O/(a[i][i]);
for(i=j+l;i < =n;i+ +) a[i][i] *= durn;
}
1
void lubksb(a,n,indx,b)
float **a,bD;
int n,*indx;
int i,ii=O,ip J;
float sum;
I* Defining factorizations for trignometric terms that are functions of joint angles *I
I* Defining Expressions for the Inertial Constants Appearing in the Equations of Forces of Motion *I
#define i l l (-0.0142)
#define i12 (-0.0110)
#define i13 (-3.79e-03)
#define i14 ( 1.64e-03)
#define il5 (1.25e-03)
APPENDIX D
I* Defining Expressions for the Gravitational Constants Appearing in the Equations of Forces of Motion *I
int i j;
float ar[q[q,br[q[l6],CR[7][7],gr[q;
I* A(6x6), B(6x15), and C(6x6) matrices and the g vector *I
main0
{
void armat(); I* Returns the expressions giving the elements of the Kinetic Energy matrix *I
APPENDIX D
void brmat(); I* Returns the expressions giving the elements of the Coriolis matrix *I
void CRmat(); I* Returns the expressions giving the elements of the Centrifugal matrix *I
void armat(); I* Returns the Gravity vector *I
float **matrix();
float *vector();
I* Evaluating individual terms o f the state space equation i.e., A@)&) + B@)(B~)+ c(B)@) + g@)) = 7 *I
return;
1
void armat(ar)
APPENDIX D
float ar[q[q;
{
int i j;
return;
1
void brmat(br)
APPENDIX D
float br[i'l[16];
{
int i j ;
APPENDIX D 128
APPENDIX D
for (i=l;i<=6;i++)
{printf("br%f %f %f %f %f %f %f %fin",br[i][l],br[i][2],br[iJ[3],br[i][4],br[i][5],br[i][6],br[i][7,br[i][S]);
printf(" %f %f %f %f %f %f %fin",br[i][9],br[i][l0],br[i][ll],br[i][l2],br[i][l3],br[i][l4],br[i][l5]);}
Ilprintf("from br brll = %finM ,br[l][l]);
return;
1
void CRmat(CR)
float CR[A[T;
I
int i J;
extern float br[71[16];
for(i=l;i<7;i+ +)
printf("CR %f %f %f %f %f %flnw,CR[i][l],CR[i][2],CR[i][3],CR[i][4],CR[i][5],CR[i][6]);
for ( i = l ; i < = 6 ; i + + )
return;
1
void grmat(gr)
float g r [ l ;
{
int i;
gr[l] = (0.0);
+ + +
gr[2]= (ggl*c2 gg2*s23 gg3*s2 gg4*c23 gg5*(s23*c5 + + c23*c4*s5) );
+ + +
gr[3]= (gg2*s23 gg4*c23 gg5*(s23*c5 c23*c4*s5) );
gr[4] = (-gg5*s23*s4*s5 );
+
gr[5] = (gg5*(c23*s5 s23*c4*c5) );
gr[6] = (0.0);
return;
1
void cubic-coeff(coeff)
float coeffl41;
{
int i:
coefflo] =tho;
coeffll] =thdO;
coeffl'] =3.0/(tPctf)*(thf-tho)-2.0ltprthdO-1 .O/tf*thdf;
coeff(3]=-2.O/(tf*tf*tf)*(thf-tho)+ 1.O/(tPctf)*(thdf+thdO);
APPENDIX D
return;
}
float *vector(nl,nh)
int nl,nh;
I
void nrerror();
float *v;
+
v = (float *)malloc((unsigned) (nh-nl l)*sizeof(flaat));
if (!v) nrerror ("allocation failure in vector()");
return v-nl;
1
void free_vector(v,nl,nh)
float *v;
int n1,nh;
{
free((char*) (v +nl));
1
void nrerror(error-text)
char error-textu;
{
void exit();
fprintf(stderr,"Numerical Recipies run-time error ...\n");
fprintf(stderr," %s\nW ,error-text);
fprintf(stderr," ...now exiting to system ...\nW);
exit(1);
1
float **matrix(nrl,nrh,ncl,nch)
int nrl,nrh,ncl,nch;
{
int i;
float **m;
for(i=nrl;i< =nrh;i+ +) {
+
m[i] =(float *) malloc((unsigned) (nch-ncl I)*sizeo f(float));
if (!m[i]) nrerror("a1location failure 2 in matrix()");
m[i] - =nci;
1
return m;
1
APPENDIX D 132
D-7 Computer Program to get Joint Motor Torque(s) for Controlling the Robot based on
the Approximate Model
/* Defining factorizations for trignometric terms that are functions of joint angles */
int i j ;
float ap[7[l,bp[l[l61,CP[71[7],gp[7;I* A(6x6), B(6x15), and C(6x6) matrices and the g vector */
float **matrix();
float *vector();
I* Evaluating individual terms of the state space equation i.e., A(B)(~) + B(B)(B~)+ c@@) + go)) = 7 *I
return;
}
void apmat(ap)
float ap[T[71;
{
int i j ;
APPENDIX D
return;
1
void bpmat@p)
float bp[T[16];
{
int i j ;
APPENDIX D
APPENDIX D
for ( i = l ; i < = 6 ; i + + )
r %f %f %f %f %f % f %nn",bp[i][l],bp[i][2],bp[i][3],bp[i][4],bp[i][5],bp[i][6],bp[i][~,bp[i][8]);
{ p ~ t f ( " b %f
printf(" %f %f %f %f % f % f %fin",bp[i][9],bp[i][lO] ,bp[il(l 1] ,bp[i][l2],bp[i][l3] ,bp[i][l4],bp[i][l5]);}
//printf("from br b r l l = %fln",bp[l][I]);
return;
1
void CPmat(CP)
float CP[7][71;
{
int i j ;
APPENDIX D
extem float bp[7j[16];
for(i=l;i<7;i+ +)
printf("CR %f %f %f %f %f %An",CP[i][l],CP[i][2],CP[i][3IICP[i][4],CP[i][5],CP[i][6]);
return;
APPENDIX D
void gpmat(gp)
float gp[7);
{
int i;
@[I]= (0.0);
+
gp[2]= (-37.2*c2 - 8.4*~23 1.02*s2 );
gp[3]= (-8.4*s23 +
0.25*c23 );
gp[4]= ( 2.8e-02*~23*~4*~5 );
gp[5] = ( -2.8e-O2*(c23*sS +
s23*c4*c5) );
a [ 6 1 = (0.0);
return;
1
void cubic-coeff(coeff)
float coeffl4J;
{
int i:
coefflo] =tho;
coeffll] =thd0;
coeffl21 =3.0/(tPtt)*(thf-th0)-2.0ItrthdO-1
.O/tPLthdf;
+
coeffl3]=-2.0/(tPtPtf)*(thf-thO) 1.O/(tPtf)*(thdf+ thd0);
return;
1
float *vector(nl,nh)
int n1,nh;
{
void nrerroro;
float *v;
v = (float *)malloc((unsigned) (nh-nl+ l)*sizeof(float));
if (!v) nrerror ("allocation failure in vector()");
return v-nl;
1
void free_vector(v,nl,nh)
float *v;
int n1,nh;
APPENDIX D
void nrerror(error-text)
char error-textn;
{
void exit();
fprintf(stderr,"NumericalRecipies run-time error ...\nu);
fprintf(stderr," %s\nW ,error-text);
fprintf(stderr," ...now exiting to system ...\nW);
exit(1);
}
float **matrix(nrl,nrh,ncl,nch)
int nrl,nrh,ncl,nch;
int i;
float **m;
D-8 Computer Program to get Forces(s) on the End Effector based on the Real Model
I* Defining factorizations for trignometric terms that are functions of joint angles *I
/* Defining Expressions for the Inertial Constants Appearing in the Equations of Forces o f Motion */
#define i l l (-0.0142)
APPENDIX D
I* Defining Expressions for the Gravitational Constants Appearing in the Equations of Forces of Motion *I
int i j ;
float ar[T[q,br[T[16I9CR[T[T,gr[71;
I* A(6x6), B(6x15), and C(6x6) matrices and the g vector *I
FILE *fpwrite.;
int count;
main()
{
void amat(); I* Returns the expressions giving the elements of the Kinetic Energy matrix *I
void brmat(); I* Returns the expressions giving the elements of the Coriolis matrix *I
void C h a t ( ) ; I* Returns the expressions giving the elements of the Centrifugal matrix *I
void grmat(); I* Returns the Gravity Vector */
float **matrix();
float *vector();
I* Evaluating individual terms of the state space equation i.e., A@)&) + B(B)(B~)+ c@)@) + g(B)) = 7 *I
APPENDIX D
APPENDIX D
return;
}
void armat(ar)
float ar[7][7];
{
int i j;
a r [ l ] [ S ] = (irnl + i l + i 3 * c c 2 + i 7 * s s 2 3 + i l O * s c 2 3 + i 1 1 * s c 2
+
+i2O*(ss5*(ss23*(1 +cc4)-1)-2.O*sc23*c4*sc5) i21*ss23*~~4+2.O*(i5*~2*~23 +i12*c2*c23 +i15*(ss23*c5 +sc23*c4*s5)+i
16*c2*(s23*c5 +c23*c4*s5) +il8*s4*s5 +i22*(sc23*c5 +cc23*c4*s5)) );
ar[1][2]= ( i4*s2 + i8*c23 + i9*c2 +i13*sc23 -i15*c23*s4*s5 + +
i16*s2*s4*s5 +
i18*(~23*~4*~5-~23*~5)
+
i19*s23*sc4 + i2O*s4*(s23*c4*cc5+c23*sc5) i22*s23*s4*s5 );
ar[1][3] = (i8*c23 + i13*s23 - i15*c23*s4*s5 + i19*s23*sc4 + i18*(s23*~4*s5-~23*~5) + i22*s23*s4*s5 +
i20*s4*(s23*c4*cc5 +c23*sc5) );
ar[1][4]= (i14*c23 + il5*s23*c4*sS + i16*c2*c4*s5 + +
ilS*c23*s4*s5 - i20*(s23*c4*sc5 +
c23*ss5)
i22*c23*c4*s5 );
+
ar[1][5] = (iSS*s23*~4*cS+ i16*c2*s4*cS + i 17*s23*s4 i18*(~23*s5-~23*~4*~5)+ i22*c23*s4*c5 );
ar[S][6] = (i23*(~23*~5-~23*~4*~5));
APPENDIX D
return;
1
void brmat(br)
float br[7][16];
{
int i j ;
APPENDIX D
APPENDIX D
for (i=l;i<=6;i++)
{p~tf("br %f %f %f %f %f %f %f %fin",br[i][l],br[i][2],br[i][3],br[i][4],br[i][5],br[i][6],br[i][~,br[i][8]);
printf(" %f %f %f %f %f %f %8onn",br[i][9],br[i][lO~,br[i][ll],br[i][l2],br[i][l3],br[i][l4],br[i][l5]);}
//p~tf("from br brl 1 = %80nnn,br[l][l]);
return;
1
void CRrnat(CR)
float CR[7[7];
{
int ij;
extern float br[7[16];
APPENDIX D
//printf("frorn inside CR brll = %fin",br[l][l]);
for(i=l;i<7;i+ +)
printf("CR %f %f %f %f %f %f\n",CR[i][l],CR[i][2],CR[i][3],CR[i][4],CR[i][S],CR[i][6]);
for ( i = l ; i < =6;i+ +)
return;
1
void gnnat(gr)
APPENDIX D
float gr[7];
{
int i;
grill= (0.0);
gr[2]= (ggl*c2 + gg2*s23 gg3*s2+ +
gg4*c23 + ggS*(s23*cS + c23*c4*s5) );
gr[3]= (gg2*s23 +
gg4*c23 + +
ggS*(s23*c5 c23*c4*sS) );
gr[4] = (-ggS*s23*s4*sS );
gr[S] = (ggS*(c23*s5 + s23*c4*cS) );
gr[6] = (0.0);
return;
1
void cubic-coeff(coeff)
float coeffl41;
{
int i;
coefflo] =tho;
coeffll] =thdO;
coeffl2]=3.01(tf*tt)*(thf-th0)-2.0ltPthdO-1.O/tf*thdf;
+
coeffl3]=-2.0l(tf*tf*tf)*(thf-tho) 1.Ol(tf*tf)*(thdf+thdO);
return;
1
float *vector(nl,nh)
int n1,nh;
{
void nrerroro;
float *v;
v =(float *)malloc((unsigned) (nh-nl+ l)*sizeof(float));
if (!v) nrerror ("allocation failure in vector()");
return v-nl;
1
void free_vector(v,nl,nh)
float *v;
int nl,nh;
I
free((char*) (v +nl));
void nrerror(error-text)
char error-textu;
APPENDIX D
I
void exit();
fp~tf(stderr,"NumericalRecipies run-time error ...\nW);
f p ~ t f ( s t d e r r ,%An"
" ,error-text);
fprintf(stderr," ...now exiting to system.. .\nV);
exit(1);
1
float **matrix(nrl,nrh,ncl,nch)
int nrl,nrh,ncl,nch;
{
int i;
float **m;
I* Defining factorizations for trignometric terms that are functions of joint angles *I
FILE *fpread;
float **a,**jactrinv,d,*coI;
int *indx;
float **jcinvrse;
int count:
void ludcrnp(),lubksb();
float **matrix();
float *vector();
w h i l e ( f s c a n f ( f p r e a d , " % f % f % f % f % f
%t\n",~r[count][l],&r[count][2],&ar[count][3],&ar[count][4],&ar[count][5],&ar[count][6]) !=EOF)
{printf("outputZ % f %f % f % f %f %finv,ar[count][l] ,ar[count][3-],ar[count][3] ,ar[count][4] ,ar[count][5] ,ar[count][6]);
count ++ ; }******I
APPENDIX D 154
I* Evaluating the individual terms for the Cartesian state space equation i.e.,
- +
F = J-' A@) J" x J-' A@)J-' J 0 J-' B(6,e) + J-' GO) *I
jacobian(jac);
for(i=l;i< =6;i+ +)
pMtf("jac main %f %f %f %f %f %An"jac[i][l],jac[i][2] jac[i][3] jac[i][4] jac[i][5] jac[i][6]);
jacobdot(jacd0t);
for(i=l;i< =6;i+ +)
printf("jacdot main %f %f %f %f %f %fin"jacdot[i][l] jacdot[i][2]jacdot[i][3] jacdot[i][4]jacdot[i][5] ~acdot[i][6]);
I**** ALITER CAN FIND jactrinv by finding jcinvrse and then taking its transpose ******I
col=vector(l ,N);
a=matrix(l,N,l ,N);
j a c t ~ v = m a t r i x ( l , N , l,N);
APPENDIX D
ludcmp(a,N ,indx,&d);
for(i=l;i<=N$++){
for(i=l;i< =N;i+ +)col[i]=O.O;
collj] = 1.o;
lubksb(a,N,indx,col);
for(i= 1;i < =N;i+ +)jcinvrse[i]lj] =col[i];
1
for(i=l;i< =6;i+ +)
p r i n t f ( " m a t r i x j c i n v r s e % f % f % f % f % f
%f\nvjcinvrse[i][l] jcinvrse[i][2] jcinvrse[i][] jcinvrse[i][4] jcinvrse[i][S] jcinvrse[i][6]);
APPENDIX D
return;
1
void jacobian(jac)
float jac[q[q;
I
jac[ll[l] = -sl *(c23*a3 + s23*d4 + c2*a2) -cl *(d2 fd3);
jac[ll[2] = cl*(-s23*a3 + c23*d4 - s2*a2);
jac[ll[3] = cl*(-s23*a3 + c23*d4);
jac[1][4] = 0.0;
jac[l J[5] = 0.0;
jac[1][6]= 0.0;
jac[4][1]= 0.0;
jac[4][2] = -s 1;
jac[4][3] = -s 1;
jac[4][4]= cl*s23;
jac[4][5] = -cl*c23*s4 -sl *c4;
jac[4][6] = (cl *c23*c4 -sl *s4)*s5 +cl *s23*c5;
APPENDIX D
for(i=l;i< =6;i++)
printf("jac subr %f %f %f %f % f %f\n",jac[i][l] ,jac[i][2]jac[i][3]jac[i][4],jac[i][S],jac[i][6]);
return;
1
void jacobdot(jacdot)
float jacdot[q[q;
{
j a c d o t [ l ] [ l ] = - c l *c23*a3*thdot[l] +
+ s l *s23*a3*(thdot[2] thdot[3]) - c l *s23*d4*thdot[l]
+
-sl *c23*d4*(thdot[2] thdot[3]) +s2*a2*thdot[2] +s 1*(d2 +d3)*thdot[l];
jacdot[l][2]= sl*s23*a3*thdot[l] -cl*c23*a3*(thdot[2]+thdot[3]) -sl*c23*d4*thdot[l] -cl*s23*d4*thdot[l]
+sl*s2*a2*thdot[l] -cl *c2*a2*thdot[2];
jacdot[l][3] = s l * s 2 3 * a 3 * t h d o t [ l ] - c l *c23*a3*(thdot[2] + t h d o t [ 3 ] ) - s l * c 2 3 * d 4 * t h d o t [ l ]
-cl*s23*d4*(thdot[2] +thdot[3]);
jacdot[l][4] = 0.0;
jacdot[l][S]= 0.0;
jacdot[l][6] = 0.0;
APPENDIX D 160
for(i=l;i< =6;i+ +)
printf("jacdot subr %f %f %f %f %f %f\nVjacdot[i][l] ,jacdot[i][2],jacdot[i][3],jacdot[i][4]jacdot[i][5] jacdot[i][6]);
return;
1
void ludcmp(a,n,indx,d)
int n,*indx;
float **a,*d;
{
int i,imax j,k;
float big,dum,sum,temp;
float *vv,*vector();
void nrerror() ,free-vector();
w =vector(l ,n);
*d=1.0;
for(i=l;i< =n;i+ +){
big=0.0;
for(j=li< = n j + + )
if ((temp= fabs(a[i][i])) > big) big= temp;
if (big = = 0.0) nrerror("Singu1ar matrix in routine LUDCMP");
w[i] = 1 .O/big;
}
for(i=l;i<=n;i++) {
for(i=l;i<j;i++) {
sum=a[i][i];
for (k= l ; k < i;k+ +) sum - = a[i]F]*aF]fi];
a[i][i] =sum;
1
big=0.0;
for(i=j;i< =n;i+ +){
sum=a[i]G];
for ( k = l ; k < j ; k + + )
sum -= a[i]F]*aF][i];
a[i][i] =sum;
if ( (dum=vv[i]*fabs(sum)) > = big) {
APPENDIX D
big=dum;
imax = i;
1
1
if f j ! = imax) {
for(k=l;k< =n;k+ +) {
dum =a[imax][k];
a[imax][k] =aGl[k];
a f i l k ] =durn;
}
*d = -(*d);
w [imax] =w fi];
1
indxu] =imax;
if (afilfi] = = 0.0) afi]u] =TINY;
iffj != n) {
dum= 1.Ol(ac]Gl);
for(i=j+ l;i < =n;i+ +) a[i]b] *= durn;
1
1
void lubksb(a,n,indx,b)
float **a,bn;
int n,*indx;
{
int i,ii=O,ip j;
float sum;
for(i=l;i< = n ; i + + ) {
ip=indx[i];
sum=b[ip];
b[ip] =b[i];
if (ii)
forfj=ii;i < =i-l;i+ +) sum -= a[i]fi]*bQ];
else if (sum) ii=i;
b[i]=sum;
1
for(i=n;i> =l;i-){
sum=b[i];
for(j=i+ l;i < =n;i+ +) sum-= a[i]fi]*bu];
b[i] =sumla[i][i];
1
1
float *vector(nl,nh)
int n1,nh;
{
void nrerror();
APPENDIX D
float *v;
v=(float *)malloc((unsigned) (nh-nl+ l)*sizeof(float));
if (!v) nrerror ("allocation failure in vector()");
return v-nl;
1
void free-vector(v,nl,nh)
float *v;
int n1,nh;
{
+
free((char*) (v nl));
1
void nrerror(error-text)
char error-textn;
void exit();
f p ~ t f ( s t d e r r"Numerical
, Recipies run-time error ...\nu);
f p ~ t f ( s t d e r r ,%s\nM
" ,error-text);
f p ~ t f ( s t d e r r ,...
" now exiting to system ...\nV);
exit(1);
1
float **rnatrix(nrl,nrh,ncl,nch)
int nrl,nrh,ncl,nch;
{
int i;
float **mi
D-9 Computer Program to get Forces(s) on the End Effector based on the Approximate
Model
I* Defining factorizations for trignometric terms that are functions of joint angles */
float ap[T[7],bp[71[16l,CP[71[T,gp[7];I* A(6x6), B(6x15), and C(6x6) matrices and the g vector *I
main()
{
void apmat(); I* Returns the expressions giving the elements of the Kinetic Energy matrix *I
void bpmato; I* Returns the expressions giving the elements of the Corioiis matrix */
void CPmat(); I* Returns the expressions giving the elements of the Centrifugal matrix */
void gpmat(); I* Returns the Gravity vector */
void ludcmp(),lubksb();
float **matrix();
float *vector();
I* Evaluating individual terms of the state space equation i.e., A@)($) + ~ @ ) @ 9 )+ c@)@)+ gp)) = 7 */
APPENDIX D
for(i=l;i< =6;i++)
for(j=l$< = 6 ; j + + )
term1 [i] =term1 [i] + ap[i]G]*thdbldt[i];
I* Evaluating the individual terms for the Cartesian state space equation i.e.,
F = J.'A(B) J" x - J-' A(B)J-' J 6' + J-' B(B,O) + J-' G@) *I
jacobian(jac);
for(i=l;i< =6;i++)
printf("jac main %f %f %f %f %f %fin"jac[i][l] jac[i][2] jac[i][3] jac[i][4],jac[i][S],jac[i][6]);
APPENDIX D 167
for(i=l;i< =6;i+ +)
printf("jacdot main %f %f %f % f %f %fin"jacdot[i][l]jacdot[i][2] jacdot[i][3] jacdot[i][4] jacdot[i][5] jacdot[i][6]);
I**** ALITER CAN FIND jactrinv by finding jcinvrse and then taking its transpose ******/
col=vector(l ,N);
a=matrix(l ,N ,1 ,N);
jactrinv =matrix(l ,N, 1,N);
for(i=l;i< =6;i+ +)
p r i n t f ( " m a t r i x j a c t r i n v % f % f % f % f % f
%finnjactnnv[i][l] ~actrinv[i][2],jactnnv[i][3] ~actrinv[i][4]jactrinv[i][s] jactrinv[i][6]);
for(i=l;i< = 6 ; i + + )
p r i n t f ( " m a t r i x j c i n v r s e % f % f % f % f % f
%fin"jcinvrse[i][l] jchvrse[i][2] jcinvrse[i][] jcinvrse[i][4]jcinvrse[i][5] ~cinvrse[i][6]);
for(i=l;i< =6;i++)
for(i=l;i< =6;i++)
frcterml [i] = frcterml [i] + frctemp2[i]b]*frctempl b];
APPENDIX D
APPENDIX D
return;
1
void apmat(ap)
float ap[cTI[A;
I
int ij;
APPENDIX D
return;
1
void bpmat@p)
float bp[7[16];
{
int i j ;
APPENDIX D
APPENDIX D
return;
1
void CPmat(CP)
float CP[q[q;
{
int i j ;
extern float bp[q[16];
void gpmat(gp)
float gp[7;
{
int i;
(0.0);
gp[2]= (-37.2*~2- 8.4*~23+ 1.02*s2);
+
gp[3]= (-8.4*~23 0.25*c23);
gp[4]= ( 2.8e-02*~23*~4*~5);
+ s23*c4*c5));
gp[5]= ( -2.8e-02*(~23*~5
APPENDIX D
return;
1
void cubic-coeff(coeff)
float coeffl41;
{
int i;
coefflo] =tho;
coeffll] =thd0;
coeffl2]=3.0l(tf*tf)*(thf-th0)-2.01tPthdO-1.O/tf*thdf;
1 .O/(tf*tf)*(thdf+thd0);
coeffl3]=-2.0l(tf*tf*tf)*(thf-~hO)+
return;
1
void jacobian(jac)
float jac[7J[7J;
{
jac[l][l] = -sl*(c23*a3 + s23*d4 + c2*a2) -cl*(d2+d3);
jac[l][2] = c l *(-s23*a3 + c23*d4 - s2*a2);
jac[l][3] = c l *(-s23*a3 + c23*d4);
jac[l][4]= 0.0;
jac[l][S]= 0.0;
jac[1][6]= 0.0;
APPENDIX D
jac[S][l] = 0.0;
jac[5][2] = cl;
jac[5][3]= cl;
jac[5][4] = sl*s23;
jac[5][5] = -sl*c23*s4 +cl*c4;
jac[5][6] = (sl *c23*c4 +cl*s4)*s5 +sl*s23*c5;
for(i=l;i< =6;i+ +)
p ~ t f ( " j a csubr %f %f %f %f %f %finujac[i][l],jac[i][2] jac[i][3] jac[i][4],jac[i][5]jac[i][6]);
return;
1
void jacobdot(jacdot)
float jacdot[7[7];
{
jacdot[l][l] = - c l *c23*a3*thdot[l] +
sl*s23*a3*(thdot[2] +thdot[3]) -cl*s23*d4*thdot[l]
-sl*c23*d4*(thdot[2]+thdot[3]) +s2*a2*thdot[2] +sl*(d2+d3)*thdot[l];
jacdot[l][2]= sl*s23*a3*thdot[l] -cl*c23*a3*(thdot[2]+thdot[3]) -sl*c23*d4*thdot[l] -cl*s23*d4*thdot[l]
+ s l *s2*a2*thdot[l] tl*c2*a2*thdot[2];
printf("BETWEEN % f % f %f %f %f % f\nU,sl*s23*a3*thdot[l], -cl*c23*a3*(thdot[2],thdot[3]), -sl*c23*d4*thdot[l]
,-cl*s23*d4*thdot[l] ,sl*s2*a2*thdot[l], -cl*c2*a2*thdot[2]);
printf("BET@ %f %f %f %f %f %f %f %f %fin",a2,a3,d2,d3,d4,cl,sl,c23,s23);
jacdot[l][3]= sl*s23*a3*thdot[l] -cl*c23*a3*(thdot[7,]+thdot[3]) -sl*c23*d4*thdot[l]
-cl *s23*d4*(thdot[2]+thdot[3]);
jacdot[l][4] = 0.0;
jacdot[l][5] = 0.0;
jacdot[l][6] = 0.0;
APPENDIX D
for(i=l;i< =6;i+ +)
p ~ t f ( " j a c d o tsubr %f %f %f %f %f %f\nWjacdot[i][l] jacdot[i][2ljacdot[i][3],jacdot[i][4],jacdot[i][S] jacdot[i][6]);
return;
1
void ludcmp(a,n,indx,d)
int n,*indx;
float **a,*d;
I
int i,imax j,k;
float big ,dum,sum,temp;
float *w,*vector();
void nrerror(),free-vector();
w =vector(l ,n);
*d=1.0;
for(i=l;i< =n;i+ +)I
big=0.0;
for(j=lG< = n i + + )
if ((temp= fabs(a[i]b])) > big) big=temp;
if (big = = 0.0) nrerror("Singular matrix in routine LUDCMP");
vv[i] = 1 .O/big;
APPENDIX D
1
for(j=l;j< = n $ + + ) {
for(i=l;i<j;i++) {
sum =a[i][i];
for (k=l;k <i;k+ +) sum -= a[i]F]*aF]fi];
a[i][i] =sum;
1
big=0.0;
for(i=j;i < =n;i+ + ) {
sum=a[ilul;
for ( k = I ; k < j ; k + +)
sum -= a[i]F]*a[k][i];
a[ilfil= sum;
if ( (dum =vv[i]*fabs(sum)) > = big) {
big=dum;
imax =i;
1
1
if (j != imax) {
for(k=l;k< =n;k+ +) {
dum=a[imax]@c];
a[imax]F] =a[i]F];
a[i]@] =durn;
1
indx[i] =imax;
if (a[i][i] = = 0.0) a[i][i]=TINY;
if(i ! = n) {
dum=l.O/(a~][i]);
for(i=j+ 1;i < =n;i+ +) a[i][i] *= dum;
1
1
void lubksb(a,n,indx,b)
float **a,bn;
int n,*indx;
{
int i,ii=O,ip j;
float sum;
for(i=l;i< =n;i+ +) {
ip =indx[i];
sum= b[ip];
b[ip] =b[i];
if (ii)
for(j=ii;i < =i-l;j+ +) sum - = a[i]c]*b[i];
else if (sum) ii=i;
b[i] =sum;
APPENDIX D
float *vector(nl,nh)
int n1,nh;
{
void nrerror();
float *v;
v=(float *)malloc((unsigned) (nh-nl+ l)*sizeof(flont));
if (!v) nrerror ("allocation failure in vector()");
return v-nl;
1
void free_vector(v,nl,nh)
float *v;
int n1,nh;
{
free((char*) (v + nl));
1
void nrerror(error-text)
char error-textu;
{
void exit();
fp~tf(stderr,"NumericalRecipies run-time error ...\nW);
fprintf(stderr," %s\n",error-text);
" now exiting to system ...\nn);
f p ~ t f ( s t d e r r , ...
exit(1);
1
float **matrix(nrl,nrh,ncl,nch)
int nrl,nrh,ncl,nch;
{
int i;
float **m;
/!-Name :
11-Originator: sandeep
11-Originated: (RAP) Thu Sep 24 09:29: 17 1992
11- Product : IJEMS 02.00.01.11 27-Apr-92
I/- Nodename : bear
I/- Command :
11- Comments : Source code in Parametric Programming Language @pl)
#include "ciminimum.h"
#include "cimacros .h"
#include "fi.hn
#include "grlastele.h"
#include "stdio.h"
FILE *fptr;
I* Defining axis of rotation for each link *I
double Inkl-in[3],lnkl-out[3];
double lnk2-in[3],lnk2-out[3];
double Ink3-in[3],lnk3-out[3];
double lnk4_in[3],lnk4_out[3];
double InW-in[3],lnW-out[3];
double lnk6-in[3],lnk6-out[3];
struct Fl-data-st formData;
int i;
double ~x,py,pz,qx,qy,qz,cx,cy,cz,d;
double temp-in[3],temp-out[3];
double theta-initial[q;
void zerogosition()
{
APPENDIX D
11"EMPCyAxR" "Place cylinder by axis and radius"
begincmd-key ("EMPCyAxR");
1I"EMPCyAxR" "Place cylinder by axis and radius"
ci$put( crnd = "xy =O,-1.25,O.front");
ci$put( crnd = "xy =0.0,2.00,0.00,front");
ci$put(string = " 1.5");
ci$put( response = TERMINATE );
endcmdo;
if( number-found = = 0 )
write( "link-1 not found.\nH);
else
write( "link-1 no. found = ",number-found," I D = ", link-1, "\nu);
begincmd-key ("GRPLSgW );
ci$put( crnd = "xy = -1.25,2.00,-1 .OO,front");
ci$put( cmd = "xy = 0.00,2.00,-1 .OO,front");
ci$put( cmd = "xy = 3.50,2.00,-0.75,frontn);
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRPArR2Pnt');
/I"GRPArR2PnU "Place Arc by Radius and 2 Points"
ci$put(string = " 1.00OW);
ci$put( cmd = "xy =3.5,2.00,-0.75,front");
ci$put( crnd = "xy=3.5,2.00,0.00,front");
ci$put( cmd = "xy =3.5,2.00,0.75,front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRPLSgW);
cisput( cmd = "xy = 3.50,2.00,0.75,front");
APPENDIX D
IInGRPArR2Pn" "Place Arc by Radius and 2 Points"
ci$put(string = "0.75000");
ci$put( cmd = "xy =2.35,2.00,0.00,front");
ci$put( cmd = "xy=3.00,2.00,0.00,front");
ci$put( cmd = "xy=3.75,2.00,0.00,front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key("EMPCmCrAtW);
1l"EMPCmCrAt" "auto link curves"
c i $ p u t ( s t ~ g= "y");
ci$put( cmd = "xy =3.00,2.00,5.00,front");
ci$put( cmd = "xy =3.00,2.00,5.00,front");
ci$put( response = RESET );
ci$put( response = TERMINATE );
endcmd(),
if( number-found = = 0 )
write( "link-3 not found.\nW);
else
write( " l i n k no. found = ",number-found," ID= ", link-3, "\nW);
begincmd-key("EMPSlBx2Pn");
ci$put( cmd = "xy=2.5,2.0,5.00,front");
ci$put( cmd = "xy=3.5,1.0,5.50,frontU);
ci$put( response = TERMINATE );
endcmd();
if( number-found = = 0 )
write( "linkpa not found.\nM);
else
APPENDIX D
write( "link-4a no. found = ",number-found," ID= ", link-4a, "\nW);
begincmdkey ("EMPCyAxRW);
1I"EMPCyAxR" "Place cylinder by axis and radius"
ci$put( crnd = "xy =3.00,1 .00,5.75,frontW);
ci$put( crnd = "xy=3.00,1.33,5.75,front");
ci$put(string = "1.Ow);
ci$put( response = TERMINATE );
endcmd();
if( number-found = = 0 )
write( "link-4b not found.\nW);
else
write( " l i n k b no. found = ",number-found," ID= ", IinkPb, "\nW);
begincmd-key("EMPCyAxR");
ci$put( crnd = "xy =3.00,1 .33,5.75,frontV);
ci$put( crnd = "xy =3.00,1 .66,5.75,frontM);
ci$put(string = " 1.OOn);
ci$put( response = TERMINATE );
endcmd();
if( number-found = = 0 )
write( " l i n k not found.\nU);
else
write( "link-5 no. found = ",number-found," ID= ", link-5,"\nU);
begincmd-key("EMPCykuR");
cisput( crnd = "xy =3.00,1 .66,5.75,frontN);
cisput( crnd = "xy=3.00,2.00,5.75,front");
ci$put(string = "1.00");
ci$put( response = TERMINATE );
endcmd();
if( number-found = =: 0 )
write( "link-4c not found.\nM);
else
write( "link-4c no. found = ",number-found," ID= ", IinkPc, "\nu);
begincmd-key("EMPCyAxR);
ci$put( cmd = "xy =3.00,1.50,6.25,front");
ci$put( cmd = "xy =3.00,1 .50,6.50,frontV);
ci$put(string = "0.25");
ci$put( response = TERMINATE );
endcmd();
if( number-found = = 0 )
write( "link-6a not found.\nW);
else
write( "link-6a no. found = ",number-found," ID= ", link_6a, "\nu);
if( number-found = = 0 )
write( "link-6b not found.\nW);
else
write( "link-6b no. found = ",number-found," ID= ", link_6b, "\nu);
return;
1
/* Reading the data file containing the set of joint angles i.e., 81, 82, ..., 86 for each time step */
if( (fptr=fopen( "aprx.dat","rU))= = NULL )
{write("error opening file aprx.dat \no);
exit;)
I
begincmd-key (" GRSAn");
ci$put( value = theta[l] );
endcmdo;
begincmd-key("GRRtEAbAx");
cisput( obj = link-1 );
ci$put( point = Inkl-in, window-name = "front");
cisput( point = lnkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxU);
ci$put( obj = link-3 );
ci$put( point = Inkl-in, window-name = "front");
ci$put( point = Inkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key ("GRRtEAbAx");
ci$put( obj = link-4a );
ci$put( point = lnkl-in, window-name = "front");
ci$put( point = lnkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAx");
ci$put( obj = link-4b );
ci$put( point = Inkl-in, window-name = "front");
ci$put( point = lnkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcrnd();
endcmd();
begincmd-key("GRRtEAbAxW);
ci$put( obj = link-5 );
ci$put( point = lnkl-in, window-name = "front");
ci$put( point = lnkl-out, window-name = "front");
cisput( response = TERMINATE );
endcmd();
begincmdkey("GRRtEAbAx");
ci$put( obj = link-6a );
cisput( point = lnkl-in, window-name = "front");
ci$put( point = lnkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key("GRRtEAbAx");
ci$put( obj = S i b );
ci$put( point = Inkl-in, window-name = "front");
ci$put( point = lnkl-out, window-name = "front");
cisput( response = TERMINATE );
endcmd();
I
begincmd-key("GRSAnn);
ci$put( value = theta[2] );
endcmd();
begincmd-key("GRRtEAbAxW);
ci$put( obj = link-2 );
ci$put( point = Ink2-in, window-name = "front");
ci$put( point = lnk2-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxm);
cisput( obj = l i n k );
ci$put( point = lnk2-in, window-name = "front");
cisput( point = lnk2-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAx");
ci$put( obj = link-4a );
ci$put( point = Ink2_in, window-name = "front");
ci$put( point = lnk2_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmdkey("GRRtEAbAx");
ci$put( obj = l i i c );
ci$put( point = lnk2-in, window-name = "front");
ci$put( point = lnk2_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxn);
ci$put( obj = link-5 );
ci$put( point = lnk2-in, window-name = "front");
ci$put( point = lnk2_out, window-name = "front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key("GRRtEAbAxU);
ci$put( obj = l i n k a );
ci$put( point = lnk2-in, window-name = "front");
ci$put( point = lnk2_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRSAnW);
ci$put( value = theta[3] );
endcmd();
begincmd-key("GRRtEAbAxV);
cisput( obj = link-4a );
ci$put( point = lnk3-in, window-name = "front");
cisput( point = lnk3_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxM);
ci$put( obj = link-4b );
cisput( point = lnk3_in, window-name = "front");
ci$put( point = lnk3_out, window-name = "front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key("GRRtEAbAx");
ci$put( obj = link-4c );
ci$put( point = lnk3_in, window-name = "front");
ci$put( point = Ink3-out, window-name = "front");
cisput( response = TERMINATE );
endcmdo;
begincrnd-key("GRRtEAbAx");
ci$put( obj = link-5 );
ci$put( point = lnk3_in, window-name = "front");
ci$put( point = lnk3_out, window-name = "front");
cisput( response = TERMINATE );
endcmdo;
APPENDIX D
gr$last-elements( pobj = &link-5,
parents = 1,
nb-wanted = 1,
nb-read = &number-found );
begincmd-key("GRRtEAbAxV);
ci$put( obj = link-6a );
cisput( point = lnk3_in, window-name = "front");
ci$put( point = lnk3_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmdkey("GRRtEAbAxV);
ci$put( obj = link-6b );
cisput( point = Ink3-in, window-name = "front");
ci$put( point = lnk3_out, window-name = "front");
cisput( response = TERMINATE );
endcmd();
begincmd-key ("GRSAn");
ci$put( value = theta[4] );
endcmd();
begincmd-key("GRRtEAbAxn);
ci$put( obj = link-4a );
ci$put( point = lnk4_in, window-name = "front");
ci$put( point = Ink4-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxW);
ci$put( obj = link-4b );
ci$put( point = lnk4_in, window-name = "front");
cisput( point = lnk4_out, window-name = "front");
&$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxM);
cisput( obj = link-4c );
cisput( point = lnk4_in, window-name = "front");
cisput( point = Ink4_out, window-name = "front");
ci$put( response = TERMINATE );
begincmd-key("GRRtEAbAxU);
ci$put( obj = link-6b );
ci$put( point = Ink4_in, window-name = "front");
ci$put( point = lnk4_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
write("xoU,temp-in[O], "\nW);
write(" yo" ,temp-in[l],"\n");
write("zo" ,temp_in[2], "\nW);
begincmdkey ("GRSAn");
ci$put( value = theta[S] );
endcmd();
begincmd-key("GRRtEAbAx");
ci$put( obj = link-5 );
ci$put( point = InW-in, window-name = "front");
ci$put( point = InW-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxn);
ci$put( obj = link-6a );
ci$put( point = 1nW-in, window-name = "front");
ci$put( point = Inks-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxW);
ci$put( obj = l i i k b );
APPENDIX D
cisput( point = InW-in, window-name = "front");
cisput( point = InW-out, window-name = "front");
cisput( response = TERMINATE );
endcmd();
begincmd-key("GRSAn");
ci$put( value = theta[6] );
endcmdo;
begincmd-key("GRRtEAbAxW);
cisput( obj = link-6a );
ci$put( point = Inkbin, window-name = "front");
ci$put( point = lnk6_out, window-name = "front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key("GRRtEAbAxW);
ci$put( obj = link-6a );
APPENDIX D
ci$put( point = lnk6_in, window-name = "front");
ci$put( point = Inkbout, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
i = i + 1;)llEND WHILE
APPENDIX D
//-Name :
-
/I Originator: sandeep
//-Originated: (RAP) Thu Sep 24 09:29:17 1992
11-Product : IlEMS 02.00.01.1 1 27-Apr-92
I / -Nodename : bear
//-Command :
-
I/ Comments : Source code in Parametric Programming Language @pl)
#include "ciminimum.h"
#include "cimacros.hm
#include " fi.h"
#include "grlaste1e.h"
#include "stdi0.h"
FILE *fptr;
double Inkl-in[3],lnkl_out[3];
double lnk2-in[3],lnk2-out[3];
double Ink3_in[3] ,lnk3_out[3];
double Ink4_in[3],lnk4_0ut[3];
double lnW-in[3],LnW-out[3];
double Ink6_in[3],lnk6_0ut[3];
struct FI-data-st formData;
GRobj link-l,link-2.link-3,link-4a,link-4b,link-4c,link-5;
GRobj link-6a,link-6b;
int number-found;
double theta[7'J;
int i;
double px,py ,pz,qx,qy,qz,cx,cy ,cz,d;
double temp-in[3],temp_out[3];
double theta_initial[7];
void zerogosition()
{
APPENDIX D
1I"EMPCyAxR" "Place cylinder by axis and radius"
if( number-found = = 0 )
write( "link-1 not found.\nW);
else
write( "link-1 no. found = ",number-found," ID= ", link-1, "\nW);
begincmdkey("GRPLSg ");
ci$put( crnd = "xy= -1.25,1.25,-1.00,front");
ci$put( crnd = "xy = 0.00,1.25,-1.OO,frontM);
ci$put( crnd = "xy= 3.50,1.25,-0.75,frontM);
ci$put( response = TERMINATE );
endcmd();
begincmd-key(" GRPArR2PnU);
/IwGRPArR2Pn" "Place Arc by Radius and 2 Points"
ci$put(stMg = " 1.00OW);
ci$put( crnd = "xy=3.5,1.25,-0.75,frontn);
ci$put( crnd = "xy=3.5,1.25,0.00,front");
ci$put( crnd = "xy=3.5,1.25,0.75,front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key(" GRPLSg");
ci$put( crnd = "xy= 3.50,1.25,0.75,frontW);
APPENDIX D
ci$put( crnd = "xy = 0.00,1.25,1 .OO,frontn);
cisput( crnd = "xy= -1.25,1.25,1.OO,front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRPArR2Pn ");
ll"GRPArR2Pn" "Place Arc by Radius and 2 Points"
ci$put(string = " 1.Won);
cisput( crnd = "xy =-1.25,1.25,1 .OO,front");
cisput( crnd = "xy =-1.25,1.25,0.00,front");
cisput( crnd = "xy=-1.25,1.25,-1.00,front");
cisput( response = TERMINATE );
endcmd();
begincmd-key("EMPCmCrAt");
lI"EMPCmCrAtn "auto link curves"
ci$put(string = "y ");
ci$put( crnd = "xy=-1.00,1.25,-1.OO,frontW);
ci$put( crnd = "xy=-1.00,1.25,-1.OO,frontW);
ci$put( response = RESET );
ci$put( response = TERMINATE );
endcmd();
if( number-found = = 0 )
write( "link-2 not found.\nU);
else
write( "link-2 no. found = ",number-found," ID= ", link-2, "\nu);
begincmd-key("GRPLSg");
ci$put( cmd = "xy = 3.75,1.25,0.00,front");
ci$put( crnd = "xy = 3.50,l .25,2.25,frontW);
ci$put( crnd = "xy = 2.50,1 .25,2.25,frontW);
ci$put( crnd = "xy= 2.25,1.25,0.00,front");
ci$put( response = TERMINATE );
endcmd();
APPENDIX D
ll"GRPArR2Pn" "Place Arc by Radius and 2 Points"
ci$put(string = "0.75000");
cisput( cmd = "xy =2.25,1.25,0.00,fro11:");
ci$put( cmd = "xy =3.00,1.25,0.00,front");
ci$put( cmd = "xy=3.75,1.25,0.00,front");
ci$put( response = TERMINATE );
endcmd();
begincmdkey("EMPCmCrAtn);
/lUEMPCmCrAt""auto link curves"
c i $ p ~ t ( s t ~=g "y");
cisput( cmd = "xy=3.00,1.25,2.25,front");
cisput( cmd = "xy =3.00,1 .25,2.25,frontU);
ci$put( response = RESET );
ci$put( response = TERMINATE );
endcmd();
if( number-found = = 0 )
write( "link-3 not found.\nW);
else
write( "link-3 no. found = ",number-found," ID= ", link-3, "\nH);
begincmd-key("EMPS1Bx2PnM);
ci$put( cmd = "xy=2.5,1.25,2.25,front");
ci$put( cmd = "xy =3.5,0.25,2.75,front");
ci$put( response = TERMINATE );
endcmd();
if( number-found = = 0 )
write( "link-4a not found.\nW);
else
APPENDIX D
write( "link-4a no. found = ",number-found," ID= ", link-4a, "\nn);
begincmd-key("EMPCyAxRH);
II"EMPCyAxRM"Place cylinder by axis and radius"
ci$put( cmd = "xy =3.00,0.25,3.00,front");
cisput( cmd = "xy =3.00,0.58,3.00,front");
ci$put(stMg = " 1.Ow);
cisput( response = TERMINATE );
endcmdo;
if( number-found = = 0 )
write( "link-4b not found.\nU);
else
write( "link-4b no. found = ",number-found," ID= ", IinkPb, "\nn);
begincmd-key ("EMPCyAxR");
ci$put( cmd = "xy=3.00,0.58,3.00,front");
cisput( cmd = "xy=3.00,0.91,3.00,front");
ci$put(string = " 1.00");
ci$put( response = TERMINATE );
endcmdo;
if( number-found = = 0 )
write( "link-5 not found.\nW);
else
write( "link-5 no. found = ",number-found," ID = ", link-5,"\nn);
begincmd-key("EMPCyAxR");
cisput( cmd = "xy =3.00,0.91,3.00,front");
ci$put( cmd = "xy=3.00,1.25,3.00,front");
ci$plIt(st~g= " 1.00");
ci$put( response = TERMINATE );
endcmd();
if( number-found = = 0 )
write( "link-4c not found.\nW);
else
write( "link-4c no. found = ",number-found," ID = ", link_4c, "\nu);
begincmd-key("EMPCyAxR");
cisput( cmd = "xy =3.00,0.75,3.50,frontW);
ci$put( cmd = "xy =3.00,0.75,3.75,frontW);
ci$put(stMg = "0.25");
ci$put( response = TERMINATE );
endcmd();
if( number-found = = 0 )
write( "linL6a not found.\nn);
else
write( " l i i 6 a no. found = ",number-found," ID = ", lik-6a, "\nW);
begincmd-key("EMPCyAxR");
&$put( cmd = "xy =3.00,0.75,3.50,front");
ci$put( cmd = "xy=3.00,0.75,4.00,front");
ci$put(stMg = "0.50");
ci$put( response = TERMINATE );
endcmd() ;
if( number-found = = 0 )
write( "link-6b not found.\nn);
else
write( "link-6b no. found = ",number-found," ID= ", link_6b, "\nu);
return;
1
main0
{
zeroqosition0; /* Drawing the zero position configuration *I
APPENDIX D
I* Reading the data file containing a set of 4 set of joint angles i.e., 01, 02, ..., 06 from Pieper's Solution *I
= = NULL )
if( (fptr= fopen( "pieper.dat","rW))
{write("erroropening file pieper.dat \n");
exit;}
{
begincmdkey("GRSAnM);
ci$put( value = theta[l] );
endcmd();
begincmd-key("GRRtEAbAx");
ci$put( obj = link-1 );
ci$put( point = Inkl-in, window-name = "front");
ci$put( point = Inkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxV);
ci$put( obj = link-3 );
ci$put( point = Inkl-in, window-name = "front");
ci$put( point = Inkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key(" GRRtEAbAx");
cisput( obj = link-4b );
ci$put( point = lnkl-in, window-name = "front");
ci$put( point = lnkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
endcmd();
begincmd-key("GRRtEAbAxN);
ci$put( obj = link-5 );
ci$put( point = lnkl-in, window-name = "front");
ci$put( point = lnkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxW);
cisput( obj = link-6a );
ci$put( point = lnkl-in, window-name = "front");
ci$put( point = lnkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmdkey("GRRtEAbAx");
ci$put( obj = rink-6b );
ci$put( point = lnkl-in, window-name = "front");
ci$put( point = lnkl-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
{
begincmd-key("GRSAn");
ci$put( value = theta121 );
endcmd();
begincmd-key("GRRtEAbAx");
ci$put( obj = link-2 );
ci$put( point = lnk2_in, window-name = "front");
ci$put( point = lnk2_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key ("GRRtEAbAx");
ci$put( obj = link-3 );
ci$put( point = lnk2_in, window-name = "front");
ci$put( point = lnk2-out, window-name = "front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key("GRRtEAbAxW);
ci$put( obj = link-4a );
ci$put( point = Ink2-in, window-name = "front");
ci$put( point = Ink2-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxV);
ci$put( obj = link-4c );
ci$put( point = Ink2_in, window-name = "front");
ci$put( point = Ink2-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxW);
ci$put( obj = link-5 );
ci$put( point = lnlc2-in, window-name = "front");
&$put( point = Ink2_out, window-name = "front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key("GRRtEAbAxU);
ci$put( obj = link-6a );
ci$put( point = lnk2_in, window-name = "front");
ci$put( point = Ink2_0ut, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRSAn");
ci$put( value = theta[3] );
endcmd();
begincmd-key("GRRtEAbAxW);
cisput( obj = link-3 );
cisput( point = lnk3_in, window-name = "front");
cisput( point = lnk3_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
APPENDIX D
begincmdkey("GRRtEAbAx");
ci$put( obj = link-4a );
ci$put( point = lnk3_in, window-name = "front");
ci$put( point = lnk3-out, window-name = "front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key("GRRtEAbAxU);
ci$put( obj = link-4b );
ci$put( point = lnk3_in, window-name = "front");
ci$put( point = Ink3_out, window-name = "front");
ci$put( response = TERMINATE);
endcmd();
begincmd-key("GRRtEAbAx");
ci$put( obj = link-4c );
ci$put( point = lnlc3-in, window-name = "front");
ci$put( point = lnk3_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxW);
ci$put( obj = link-5 );
cisput( point = lnk3-in, window-name = "front");
ci$put( point = lnH-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
APPENDIX D
gr$last-elements( pobj = &link-5,
parents = 1,
nb-wanted = 1,
nb-read = &number-found );
begincmdkey("GRRtEAbAx");
ci$put( obj = link-6b );
ci$put( point = Ink3-in, window-name = "front");
ci$put( point = lnk3_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRSAnH);
ci$put( value = theta[4] );
endcmd();
begincmd-key("GRRtEAbAxM);
ci$put( obj = link-4a );
ci$put( point = lnk4-in, window-name = "front");
ci$put( point = Ink4_out, window-name = "front");
ci$put( response = TERMINATE );
endcrndo;
begincmd-key("GRRtEAbAxW);
ci$put( obj = link-4b );
ci$put( point = lnkqin, window-name = "front");
ci$put( point = lnkqout, window-name = "front");
ci$put( response = TERMINATE );
endcrnd();
begincmd-key("GRRtEAbAx");
cisput( obj = link-4c );
ci$put( point = lnk4-in, window-name = "front");
ci$put( point = lnk4_out, window-name = "front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key("CRRtEAbAx");
ci$put( obj = link-6a );
ci$put( point = Ink4_in, window-name = "front");
ci$put( point = lnk4_out, window-name = "front");
cisput( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxV);
ci$put( obj = link-6b );
ci$put( point = Ink4_in, window-name = "front");
ci$put( point = lnk4_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
temp-outlo] =cos(theta[4]*pil180.0)*lnk5~out[O]
-sin(theta[4]*pi/180,0)*Ink550ut[l];
temp-out[l] =sin(theta[4]*pi/l80.0)*lnW-out[O]
+cos(theta[4]*pi/l80.0)*lnk5~out[l];
temp_out[2]=lnW-out[2]*l .O;
APPENDIX D
begincmd-key("GRSAnN);
ci$put( value = t.heta[S] );
endcmd();
begincmd-key("GRRtEAbAxW);
ci$put( obj = link-5 );
cisput( point = M - i n , window-name = "front");
ci$put( point = lnk5-out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAxW);
ci$put( obj = link-6a );
ci$put( point = Inks-in, window-name = "front");
ci$put( point = 1nW-out, window-name = "front");
ci$put( response = TERMINATE );
endcmdo;
begincmd-key("GRRtEAbAx");
ci$put( obj = link-6b );
APPENDIX D
ci$put( point = 1nW-in, window-name = "front");
ci$put( point = 1nM-out, window-name = "front");
cisput( response = TERMINATE );
endcmd();
begincmdkey("GRSAn");
ci$put( value = theta[6] );
endcmdo;
begincmd-key("GRRtEAbAxfl);
ci$put( obj = link-6a );
cisput( point = Ink6_in, window-name = "front");
ci$put( point = lnk6_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmdkey("GRRtEAbAx");
cisput( obj = link-6a );
APPENDIX D
ci$put( point = lnk6_in, window-name = "front");
ci$put( point = lnk6_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
begincmd-key("GRRtEAbAx");
ci$put( obj = link-6b );
ci$put( point = Ink6_in, window-name = "front");
ci$put( point = lnk6_out, window-name = "front");
ci$put( response = TERMINATE );
endcmd();
i=i+l;}//END WHILE
APPENDIX D 228
D-12 This file contains the main routines for running the PUMA robot with the Trident
Robotics and Research, Inc. interface boards.
I* - ROB0T.C
- Initial coding by Richard Voyles, Vigilant Technologies. *I
switch (option) {
case TORQUE6: I* Output to all DACs -- val is in N-m *I
for (i=O; i < 6 ; i++){
intVal = (int)(val[i] * motorScaleG[i]) + 0x0800;
outport(TRC-BASE + DAC-BASE + 2*i, intVal);
} I* endfor *I
return OK;
case TORQUE: I* Output to single DAC -- val is in N-rn *I
intVal = (int)(*val * motorScaleG[chan]) + 0x0800;
outport(TRC-BASE + DAC-BASE + 2*chan, intVal);
return OK;
case VOLTAGE: I* Output to single DAC -- val is in volts *I
if (*val > = 10.0){
intVal = 0;
) else if (*val < = -9.995){
intVal = OxOFFF;
} else {
intVal = (int)(*val * DAC-BITS-PER-VOLT) + 0x0800;
) I* endif *I
APPENDIX D
outport(TRC-BASE + DAC-BASE + 2*chan, inlVal);
return OK;
case POSITION6: I* Preset all encoders -- val is in radians *I
for (i=O; i <6; i+ +){
intval = (int)(val[i] I encoderScaleG[iJ);
outport(TRC-BASE + ENC-LOAD-BASE + 2*i, intVal);
} I* endfor *I
return OK;
case POSITION: I* Preset a single encoder - val is in radians *I
intVal = (int)(*val 1 encoderScaleG[chan]);
outport(TRC-BASE + ENC-LOAD-BASE + 2*chan, intval);
return OK;
default:
return BAD-OPTION;
) I* endswitch *I
1
I* - This function writes 1 or 6 integer values to the robot. The particular
- value is chosen with the OPTION parameter, which is one out of a
- list of enumerated ioOptionsT. CHAN ranges from 0 to 5 (corresponding
- to PUMA joints 1 - 6). It returns one of the enumerated ioErrorsT. *I
short robot-intwr(short option, short chan, short *val)
{
short i;
switch (option) {
case TORQUE6: I* Output to all DACs *I
for (i=O; i < 6 ; i++){
outport(TRC-BASE + DAC-BASE + 2*i, val[i]);
} I* endfor *I
return OK;
case TORQUE: I* Output to single DAC *I
outport(TRC-BASE + DAC-BASE + 2*chan, *val);
return OK;
case POSITION6: I* Preset all encoders *I
for (i=O; i < 6 ; i++){
outport(TRC-BASE + ENC-LOAD-BASE + 2*i, val[iJ);
} I* endfor *I
return OK;
case POSITION: I* Preset a single encoder *I
outport(TRC-BASE + ENC-LOAD-BASE + 2*chan, *val);
return OK;
case STATUS: I* Write the entire status word *I
outport(TRC-BASE + DISCRETE-REG, *val);
return OK;
default:
return BAD-OPTION;
) I* endswitch *I
1
I* - This function reads 1 o r 6 float values from the robot. The particular
- value is chosen with the OPTION parameter, which is one out of a
- list of enumerated ioOptionsT. CHAN ranges from 0 to 5 (corresponding
APPENDIX D
- to PUMA joints 1 - 6). It returns one of the enumerated ioErrorsT. */
short robot-fltrd(short option, short chan, float *val)
{
short tempPos ,
i;
switch (option) {
case POSlTION6: /* Read all encoders -- val is in radians */
for (i=O; i < 5 ; i + +){
val[i] = encoderScaleG[i] * inport(TRC-BASE + ENC-COUNT-BASE + 2*i);
) /* endfor */
I* Joint 6 must be treated differently because it needs 17 bits. *I
tempPos = inport(TRC-BASE + ENC-COUNT-BASE + 10);
pumaVarsG.pos[5] + = (long)(tempPos - pumaVarsG.oldPos5);
va1[5] = encoderScaleG[5] * pumaVarsG.pos[S];
pumaVarsG.oldPos5 = tempPos;
I* - Set the $6 overflow bit appropriately. */
if @umaVarsG.pos[S] < 0){
purnaVarsG.discrete = pumaVarsG.discrete I JT6-OVRFLO-BIT;
) else {
pumaVarsG.discrete = pumaVarsG.discrete & ( - JT6-OVRFLO-BIT);
) /* endif */
outport(TRC-BASE + DISCRETE-REG, pumaVarsG.discrete);
return OK;
case POSITION: /* Read a single encoder *I
if (chan ! = 5){
*val = encoderScaleG[chan]*inport(TRC-BASE + ENC-COUNT-BASE + 2*chan);
} else {
I* Joint 6 must be treated differently because it needs 17 bits. */
tempPos = inport(TRC-BASE + ENC-COUNT-BASE + 10);
+
purnaVarsG.pos[S] = (long)(tempPos - pumaVarsG.oldPos5);
*val = encoderScaleG[S] * pumaVarsG.pos[S];
pumaVarsG.oldPos5 = tempPos;
/* - Set the $6 overflow bit appropriately. */
if @umaVarsG.pos[S] < 0) {
pumaVarsG.discrete = pumaVarsG.discrete f JT6-OVRFLO-BIT;
} else {
purnaVarsG.discrete = pumaVarsG.discrete & (-JT6-OVRFLO-BIT);
} I* endif *I
outport(TRC-BASE + DISCRETE-REG, pumaVarsG.discrete);
} /* endif */
return OK;
case POT: I* Read a single ADC - val is in volts *I
outport(TRC-BASE + ADC-MUX-SELECT, chan); /* select the MUX channel */
inport(TRC-BASE + ADC-START); I* trigger the conversion */
I* - Enable the ADC conversion complete bit. */
purnaVarsG.discrete = purnaVarsG.discrete I ADC-MASK-BIT;
outport(TRC-BASE + DISCRETE-REG, pumaVarsG.discrete);
I* - Wait for the conversion complete flag. */
while ((inport(TRC-BASE + STATUS-REG) & ADC-STAT-MASK) ! = 0);
*val = 0.0196 * (inport(TRC-BASE + ADC-VALUE) & OxOOFF);
I* - Disable and clear the ADC conversion complete bit. */
pumaVarsG.discrete = pumaVarsG.discrete & ( - ADC-MASK-BIT);
APPENDIX D
outport(TRC-BASE +
DISCRETE-REG, pu~naVarsG.discrete);
return OK;
default:
return BAD-OPTION;
) I* endswitch */
1
I* - This function writes 1 or 6 LONG values to the robot. The particular
- value is chosen with the OPTION parameter, which is one out of a
- list of enumerated ioOptionsT. CHAN ranges from 0 to 5 (corresponding
- to PUMA joints 1 - 6). It returns one of the enumerated ioErrorsT. *I
short robot-longrd(short option, short chan, long *val)
short i,
tempPos;
switch (option) {
case POSITION6: I* Read all encoders */
for (i=O; i < 5 ; i++){
val[i] = (long)inport(TRC-BASE + ENC-COUNT-BASE + 2*i);
} I* endfor */
I* Joint 6 must be treated differently because it needs 17 bits. */
tempPos = inport(TRC-BASE + ENC-COUNT-BASE + 10);
va1[5] + = (long)(tempPos - pumaVarsG.oldPos5);
pumaVarsG.oldPos5 = tempPos;
I* - Set the jt6 overflow bit appropriately. */
if (va1[5] < 0){
pumaVarsG.discrete = pumaVarsG.discrete I JT6-OVRFLO-BIT;
} else {
pumaVarsG.discrete = pumaVarsG.discrete & (-JT6-OVRFLO-BIT);
} I* endif *I
outport(TRC-BASE + DISCRETE-REG, pumaVarsG.discrete);
return OK;
case POSITION: I* Read a single encoder */
if (chan ! = 5){
*val = (long)inport(TRC-BASE + ENC-COUNT-BASE + 2*chan);
) else {
I* Joint 6 must be treated differently because it needs 17 bits. */
tempPos = inport(TRC-BASE + ENC-COUNT-BASE + 10);
+
*val = (long)(tempPos - pumaVarsG.oldPos5);
pumaVarsG.oldPos5 = tempPos;
I* - Set the jt6 overflow bit appropriately. *I
if (*val < 0) {
pumaVarsG.discrete = pumaVarsG.discrete I JT6-OVRFLO-BIT;
} else {
pumaVarsG.discrete = pumaVarsG.discrete & (- JT6-OVRFLO-BIT);
} I* endif */
outport(TRC-BASE + DISCRETE-REG, pumaVarsG.discrete);
} I* endif */
return OK;
case STATUS: I* Read the entire status word into long int */
*val = (long)((unsigned short)inport(TRC-BASE + STATUS-REG));
return OK;
APPENDIX D
case POT: I* Read a single ADC *I
outport(TRC-BASE + ADC-MUX-SELECT, chan); I* select the MUX channel *I
inport(TRC-BASE + ADC-START); I* trigger the conversion *I
I* - Enable the ADC conversion complete bit. *I
pumaVarsG.discrete = pumaVarsG.discrete I ADC-M ASK-BIT;
outport(TRC-BASE + DISCRETE-REG, pumaVarsG.discrete);
I* - Wait for the conversion complete flag. *I
while ((inport(TRC-BASE+ STATUS-REG) & ADC-STAT-MASK) ! = 0);
*val = (long)(iport(TRC-BASE + ADC-VALUE) & OxOOFF);
I* - Disable and clear the ADC conversion complete bit. *I
-
pumaVarsG.discrete = pumaVarsG.discrete & ( ADC-MASK-BIT);
outport(TRC-BASE + DISCRETE-REG, pumaVarsG.discrete);
return OK;
default:
return BAD-OPTION;
} I* endswitch *I
1
APPENDIX D
D-13 This header file contains defined constants for use in both ROB0T.C and
ROB0TUSR.C when using the interface boards from Trident Robotics and Research, Inc.
I* - ROB0T.H
- Initial coding by Richard Voyles, Vigilant Technologies *I
I* - Enumerated types defining return codes for the I10 routines and
- options for the I10 routines.
- All typedefs end in "T". *I
typedef enum { OK,
BAD-OPTION
) ioErrorsT;
D-14 This is an example user-code file for controlling the PUMA robot with the Trident
Robotics and Research, Inc. interface boards.
I* - ROB0TUSR.C
- Initial coding by Richard Voyles, Vigilant Technologies *I
I* - Global variables *I
float KPosG[6], I* position error gain for PD cntrlr *I
KVelG[6]; I* velocity error gain for PD cntrlr *I
float posRefG[6], I* joint reference positions *I
velRefG[6]; I* joint reference velocity *I
int cntrlFlagG; I* control startlstop flag *I
float posNew[6],
*ternphr,
velTemp[6],
outTorq[6],
factor;
static float posOId[2][6];
APPENDIX D
I* - WARNING!!! The numeric coprocessor state is NOT saved. If this
- interrupt can clobber a floating point calculation, you must
-- save state and restore upon exit. */
factor = 2.0 * clockFreqG;
if (cntrlFlagG){
robot-fltrd(POSITION6, 0 , posNew); /* get current robot pos */
I* calculate velocities *I
velTemp[O] = (posNew[O] - posOld[l][O]) * factor;
veiTemp[l] = @osNew[l] - posOld[l][l]) * factor;
velTemp[2] = @osNew[2] - posOld[l][2]) * factor;
velTemp[3] = @osNew[3] - posOld[l][3]) * factor;
velTemp[4] = @osNew[4] - posOld[l][4]) * factor;
velTemp[5] = @osNew[S] - posOld[l][S]) * factor;
pdgControl(posNew, velTemp, outTorq); /* calculate control law *I
robot-fltwr(T0RQU E6, 0, outTorq) ; I* write torque values *I
} I* endif */
D-15 This is the main header file for utilizing functions provided for accessing the PUMA
robot using the interface boards from Trident Robotics and Research, Inc.
I* - ROB0TUSR.H
- Initial coding by Richard Voyles, Vigilant Technologies *I
D-16 File for calibration of the robot using the Trident Robotics cards.
/* - CAL1B.C
- Initial coding by Richard Voyles, Vigilant Technology *I
~ h symbols
c [qqj and lq2] are notation for the n(-l)/2-vector of Creating It through I,, which are constants of the mccha-
,.,.Iorlty products and the n-vector of squarcd velocities. [qq] and nism, l e d to a reduction from 35 to 3 multiplications and fmm
j$j arc givrn by: 18 to 3 additions. Computing the ronstant II involves 18 calcu-
lations. Since the simple parameten required for the calculatiou
of I 1 arc the input to the RNE, the RNE will effcctivrly carry o11t
the calcr~lationof I t on every pms, producing considrral)le un-
neressary romprltation. Thirty four lumped constants arc needed
The prorctlure used to derive the dynamic niodel entails four by the frtll PUMA model, 8 fewer than the count of 42 simple pa-
steps: ramctcn rcqt~irrdto dcscribe the arm.
1. Symbolic Cencration of the kinetic energy matrix and In the third stcp the elements of the Coriolis matrix. b,,,
gravity vcctor clrr~ientsby performing the summations of and of the ceutrifugd matrix, cij, are written in terms of the
either Lagrange's or thc Gibbs-Alembert formulation. Christoffcl symhols of the fint kind [Corbcn and Stchle 1350;
2. Simplifiration of the kinetic encrgy matrix elements by Libgeois et d . 197G]' giving:
coml~iningincrtia constants that multiply common
variable cxprrrsioua.
3. Exprcssiou of the Coriolis and centrifugd matrix elcnreuts
in trrms of partial derivatives of kinetic energy matrix
elemcuts; and rcduction of these expressiom with four where (Qi * 4 ) is the velocity product in the jqq] vector, and
relations that hold on thcse partial derivativd. where
I a*.
4. Formation of the needed partial derivatives, expansion of p'.jk = -(L
2 apt
+
aq,
-- -1aajt
aqi
the Coriolis and centrifugal matrix elements in terms
of the derivatives, and simplification by combining il thc ChristoKcl symbol.
incrtia constants ;u in 2. The nuntber of unique non-zero ChristoKel symbols rrqrtired
The fint step w m carried out with a LISP program, n k e d by the PUMA model can be rcduccd from 12G to 33 with four
EMDEG,whirh symbolically generates the dynamic model of an equations that hold ou the derivatives of the kinctic c n c r g matrix
articulated mechanism. EMDEG employs Kane's dynamic for- elc~nents. The first two rqr~ationsarc gcueral, the last two are
specific to the PUMA SGO. The equations are:
mulation [Kane 19681, and produced a m u l t comparable in form
and size to that of A R M [Muny and Neuman 19841. T h m sim-
plifying assumptions were made for this analysis: the rigid body
assumption; link G h a been assumed to be symmetric, that is
I,, = I,,; and only the masa moments of inertia arc considered.
that is I,., I,, and I.. . The original output of EMDEG, includ-
ing Coriolis and centrifugd terms, required 15,000 multiplications
and 3,500 additions. This stcp might also have been performed
with the niomcntum theorem method used in [Izaguim and Paul
19851.
The rcduction of Equation (7) arises from the symmetry of
Ln the sccond stcp of this procedure, the kinetic energy ma- the kinetic energy matrix. Equation (8) obtaiu~because the ki-
trix elements are simplified by combining inertia constants that
netic eurrgy inipartcd by the velocity of a joint is iudcpendcnt of
multiply common variable expressions. This is the greatest source
the configuration of the prior joints. Equation (3) resrtlts from
of computational efficiency. Looking to the dynamic model of a 3
dof lnanipulator presented in [MuT and Neuman 19841, we see the symmetry of the sixth and terminal link of the PUMA arm.
that the kinctic encrgy matrix element a l l is given by: And equation (10) h o l d because the second and third axes of
the PUMA arm are parallel. Of the reduction from 126 to 33
unique Christoffcl symbols, GI elit~linatioruare obtained with the
general equstiom, 14 more with (3) and a further 12 with (10).
Step four requires differentiating the mass matrix elements
with respect t o the configuration variables. The means to carry
out differentiation auto.natirally have been available for some
Calculations required: 37 multiplications, 18 additions. The French authon seem t o aasume the use of Cristoffel
symbols, while the American authon seem unaware of
By com1)iuing inrrtial constants with common variable terms and them. Corben and Stehle, in the 1950 edition of their
expandiug ain2(g2) into ( 1 - ~ o r ~ ( 8,~equation
)) (2) can be re- text, derive the results required here; but the derivation
duced to: is largely omitted from their l9CO edition.
APPENDIX E
titllc (LiCgcois et al. 1976; MIT Mathlab Group 19831. Only the calrulatiou of forward dynamics for simulation, where tesselation
drrivativcs required after the rirnplification of step 3 need to be is the step size rathcr than servo interval and the cost is run time
foreled. Of the 126 derivatives possible when n=6, 46 are required rathcr than boundcd computing power.
by the modcl of the PUMA arm. After the nccdrd derivatives T a b l e 2. PUMA 5GO Dynamic Model Evaluation Rate
arc for~nrcland expanded into the ChristotTcl symbols, inertial Attainable with l00k FLOPS.
ronstrurts that mllltiply common variable cxprcssious are agnin
ronil~iucd.
Merkd Rw of E d d r Rate of
-
Our mcthod of modcl derivation is able to sinlplify to man- of C.mCsmntiom Comp.uriom
Ikpemdenc Te- of T o r p r
asable for111the con~plexsunl-of-product expressions that arc pro-
duccd by synlbolically carrying out the summatiow of Lagrange's Edmatiom ef the Fdl
hlod.1 E d Iteratiom 78 h 71 hs
cql~atiow. Simplificatiou i s in general a non-detcrn~iuistictask
that Rrows very rapidly with the number of terms in an cqua- Eduatiom of rhr C.=hrmnlim
D+p*nd.ml T e r m om* d v L r ever).
tion; but the procedure prcscnted is deterministic, with a cost low E d u a t i o u of tbt Vrlmly 60 Lm aoOh
that grows most rapidly as p2, where p is the number of sum-of- .nd Arrelrratiom Ikprmdrmt T e r n
product expressions iu the largest individual kinetic energy ma-
trix elemcnt. Our prorcdl~rehm the virtue of producing explicit A final decomposition t o be considercd is that for multipro-
exprcsaion* for each romponellt of thc dynamic modcl: a rcault cessing, an issue likely to become more important. The recur-
that is very uscful for design aualysis and that allows straight sive formulations are well suited to pipeline computation, but
forward simplification by application of a scmitivity criterion. poorly suited to multi]~roccsaor computation. For the recursive
Stcps 2 through 4 of the above procedure were carried out algorithms. the number of calculations that ran be performed
by hand, requiring five wccks of rather tedious labor. To discover cooperating processon is small in rclation to the volume of com-
errors, the explicit solution was numerically checked against the munication that is required. Using an explicit model the blocks
RNE algori!hm, extcndcd to givc D a d C matrix elements in- of parallel computation can be made much larger, and the ratio
dividually in a manner similar to that of Walker and Orin. Over of computation to communication comspondingly higher. The
a range of configurations, the cxplicit solution of the PUMA dy- decomposition into configuration dependent and velocity or ac-
nan~icsagrees exactly with the RNE calculation. It is instructive celeration dependent components is particularly suitable for mul-
to observe that the RNE algorithm was coded in 5 hours. 2% of tiprocessing and has b u n implemented at the Stanford Artificid
the time requircd to dcvclop the full cxplicit modcl.
' Intclligcnce Laboratory [Khatib 19851.
S. Several Advantages O b t a i n e d f r o m Decomposition of
4. T h e Utility of a n Explicit M o d e l for D y n a m i c
t h e Explicit M o d e l
Simulation
The explicit solutiou of PUMA dynamics shows two stmc-
t u r d properties that can be used to advantage: a tremendous Walker and Orin have demonstrated the use of the RNE . I;
gorithm in the calculation of forward dynamics for sirnulatic+
range between the largest and the smallest contributing terms
By tnkiig advantage of the symmetry of the kinetic energy m-
within most equations, and the depend solely upou configurntion
trix they have reduced the model order that must b e considered
of the A, D and C matrix elements. Using the measured PUMA
in successive applications of the RNE [Walker and Orin 19821..
parameters an abbreviated dynamic model has been formed. This
The RNE algorithm has also been used to compute dynamia
modcl is derived from the full P U h U model by eliminating all
for simulation in fields outside of robotics (Benati et al. 1989.
terms that are less than 1% as great as the greatest term within
Koozekanani et al. 19831. Prcamtcd in table 3 arc the n u m b a .
the same equation, or less than 0.1% as great as the largest con-
of calculations q u i d to compute the elements of the kineti<
stant term applicable to the same joint. All of the elements of the
energy matrix using Waker and Orin's method, wing the f d
A, B and C matrices are retained: the significance test is applied
PUMA model, using the simplified model reported in [ha&
on an equation hy equation basis. The reduction in rcqtlired cal-
and Paul 19851, and using the abbreviated (1% significance crit+'
culatiow achieved via the significance test is roughly a factor of
rion) model. The analytic models all show a tremendous advan:,
four, as shown in Table 1 above.
tage over the RNE algorithm.
Observing that the A, B and C matrix elements depend only
T a b l e S. Calculations .It uircd to determine the Kinetic
on configuration, it is possible to decompose the calculation into Energy ~ a t n x % e m e n t s for a P U h U 560 Arm.
configuration depcndcnt and velocity or acceleration dependent
components. Because configuration changes more slowly than Method Calculations
velocity or acccleration, the configuration dependent components
may be computed at a slower rate [Khatib 1985; lzaguim and Walker and Orin 2737
Paul 19851. Shown in Table 2 is the evaluation rate of the PUMA
N I Explicit Model 278
560 dynamics that can be achieved with 100,000 floating point
operations per second, the approximate speed of a PDP-11. in izaguirre and Paul
the first case the entire model is recomputed in each p-; in the Simplified Model 58
second case the A. B and C matrix elements are computed only
once for every four iterations of the multiplication by velocitp and Abbreviated Explicit Model 25
acceleration vectors. This partitioning of the dynamic calculation
reduces the pace of computing the ronfiguration dependent 5. M e a s u r e m e n t o f t h e P U M A 680 D y n a m i c Paramet-
by one third; but increases the pace of computing the velocity and
acceleration dependent terms by a factor of two and one half. The link parameten required t o calculate the elcmen+i of
The advantage of this decomposition applies equally well t o the A. B. C and g in equation (1) are mass, location of the
APPENDIX E
gavity and the terms of the incrtia dyadic. The wrist, link
three and link two of a P U M A 5CO arm were detached in order
to mcasure thcse parameters. The mius of each component waa
dctcrlnincd with a beam balance; the center of gravity was located where I is the inertia about the axis of rotation;
by balancing each link on a knife edge, once orthogonal to each Mg is the weight of the link;
axis; and the diagonal terms of the inertia dyadic wrre measured r is the distance from each suspension
with a two wire susy~cnsion. wire to the axis of rotation;
w is the oscillation frequency in
The motor and drive mechanism at each joint contributes to radians per second;
th,. iucrtia alorlt that joint an arnollnt eqrral to the inertia of the I is the length of the supporting wires.
rotating picccs magnified by the gcar ratio squared. The drives
m d retluction g e m were not removed from the links, so the total
M e a s u r e m e n t of t h e M o t o r a n d D r i v e I n e r t i a
nlotor and drive contribution at each joint was determined by an
idrutificatiou method. This contribution is considered separately A parameter identification method was used to learn the
frorn the I.. term of the link itself because the motor and drive total rotational inertia at each joint. This inertia includes the
iuertia secn through the reduction gear does not contribute to the eliective motor and drive incrtia and the contribution due to the
inertial forces at the other joints in the arm. The moton were mass of the arm. To make this measurcnlcnt our control sys-
[eft installed in links two and three when the inertia of these links tem was configured to command a motor torque proportional to
werc mcasurcd, so the cffcct of their mass as the supporting links displacement, effecting a torsional spring. Lly mcruuring the pe-
move is correctly considered. The gyroscopic forces imparted by riod of oscillation of the resultant mass-sprinr: system, the total
the rotating motor rrrmaturw is neglected in the model, but the rotational inertia about each joint was dctermincd. By subtract-
data prescnted below include armature inertia and gear ratios, so ing the arm contributions, determined from direct mciuurcments,
thrsr forccs can he determined. from the measured total inertia, the motor and drive inertial con-
The parameten of the wrist l i d s were not directly measured. tributions were found.
The wrist itself ww not disassembled. But the needed parameters M e a s u r e m e n t Tolerance
were estimated using mewurements of the wrist m w and the
external dimensions of the individual l i s . To obtain the inertial A tolerance for each direct measurement was established as
terms, the wrist links were modeled as thin shells. the memurement was taken. The tolerance values are derived
I from the precision or smallest vaduation of the measuring in-
M e a s u r e m e n t of R o t a t i o n a l I n e r t i a
strument used, or from the repeatability of the measurement it-
The two wire suspension shown in Figure 1 war used to mea- self. The tolerances are reported where the data are presented.
sure the I.., I,, and I.. parameters of I i i two and t h m *. The tolerance values assigned to calculated parameten were de-
With this arrangement a rotational pendulum is created about termined by RMS combination of the tolerance sssigned to each
an axis parallel to and halfway between the suspension wires. direct measurement contributing to the calculation. The inertia
Tbc link's center of graviq must lie on this &. The two wire dyadic and center of gravity parameten of link 3 were measured
suspension method of memuring the rotational inertia requires with the wrist attached; the d u e s reported for link 3 alone have
knowledge of parameters that arc easily meanucd: the mars been obtained by subtracting the contribution of the wrist from
the total of link 3 plus wrist. Tolerance values are reported with
the values for link 3 pllu wrist, as these are the original measure-
ments.
6. T h e M e a s u r e d P U M A 560 P a r a m e t e r s
of the center of gravity in the coordinate frame attached to the 'fable 6. Centers of Grarity. (meten f0.003)
link. The coordinate frames used am assigned by a modified
Denavit-Hartmbrrg method [Craig 851. In this variant of the
Druavit-Hartcnbrrg method. frame i is attached to link i,and
axis Zilies aioug the axis of rotation of joint i. The coordinate
fra~neattachments are shown in Figure 2; they arc located sr
follows:
Link 1: Z axis along the axis of rotation, +Z up; +Y1 11
+22.
L i d 2: Z axis along the axis of rotation , +Z away from
the Ime; X-Y plane in the center of the link. with
+X toward link 3.
Link 3: 23 11 22;X-Y plane is in the center of l i d 3; + Y is
away fro111 the wrist.
Link 4: The origin is at the intrnection of the axes of joints
4 5 and 6; +Z4 is along the axis of rotation and ' Values derived from external dimensions; f25%.
dirrctcd away from link 2; +Y4 11 +Z3 when joint
4 is in the zcro position. The effective torsional spring method of incrtia meiuurcment
wa. applird at each joint. The motor and drive inertia, I,.,,,
L i d 5: The orihn coiucides with that of frame 4;+ZS is di- were h i n d by subtracting the inertial contribution due to the
rcctccl away from the II~SC; +Y5 is directed toward arm dynamics, known from direct measurements, from the total
l i d 2 when joint 5 is in the zero position. incrtia measured. The uncertainty in the total inertia measure-
Liuk G: The origin coincides with that of frame 4; when ment is somewhat higher at joint one b e c a m of the larger friction
joints 5 and G are in the zcro position frame G is at that joint. It was necessary t o add positive velocity feedback
aligned with frame 4. (damping factor -0.1)to cause joint one t o oscillate for several
cycles.
Wrist: The dimensions are reported in frame 4. '
T a b l e 6. Diagonal Terms of the Inertis Dydics and
Effrrtivr Motor Inertia.
RNE algorithm. With the application of a stringent significance ence, San Framisco, June 22 - 24, 1983, pp 491 - 496.
criterion, the computational cost of the explicit model is rcduced
to one fifth that of the m u m i v e alternative. The availability of M.J. Aldon and A. Licgrois, 'Computational mpects in robot
m e ~ u r e ddynamic parameten provides improved accuracy in the dynamirs motlclling." Advanccd Software in Roboticr ed. A.
calculated fox- of motion and simplifies model generation by al- Dmtkine and M. G(.radi&, Elsrvirr Science Publishers, North-
lowing one to omit zero d u e parameters. Ib automatic model Holland. 1984. pp. 3 - 14.
generation becomts available and manufactwm become aware of G. Ccsarco. F. Nicolb hnd S. Nicosia. 'Dymir: A code for gen-
the need lor dynamic parameten, we expect to see increuing use erating dynamic model of robots," Proc. 1981 International
of explicit models and measured parameten, in the calculation of Conference on Roboticr. Atlauta, Georgia, March 13-15, 1984,
dynamics for control. pp. 115 - 120.
J.J. Murray and C.P. Nrulnan, 'ARM: au algebraic robot dy-
H.C. Corben and P. Stehle, Clarrical Mechanicr; New York: Wi- namic modrling program," Proc. 1981 International Confer-
ley, 1950. ence on Rohoticr. Atlanta. Grorgia, March 13.15, 1984. pp.
103 - 114.
T.R. Kane, 'Dynamicr;" New York: Holt, Rinehart and Win-
ston, Inc., 1W8. M. Renaud, 'An cffirient iterative analytic procedum for obtain-
ing a robot mauipulator dynamic model." Roboticr Research.
A. LiCgois. W. Khalil. J.M. Dumas, and M. Renaud, 'Math- rd. M. Drady aud R. Paul, MIT Press, Cambridgc, 1984, pp.
cmatical and computer models of interconnected mechanical 749 - 764.
systcms,"(Scpt.. 1976, Wanaw) Theory and Practice of Robo*
and Manipulatorr; New York: Elscvier Scientific PublisLing M. Vukobratcrvit and M Kirtanski. 'A dynamic approach to nom-
-
Co., 1977, pp. 5 17. inal trajectory synthesis for redundant manipulaton,' IEEE
Traru. on Syrtemr, Man, and Cyberneticr, vol. SMC-14, no 4 ,
M. Drnati, S. Gaglio, P. Mormso, V. Tagliaaeo and R. Zaccaria, pp. 580 - 586. July/Augut 1984.
'Anthropomorphic Robots,' Diologacal Cykrncticr, vol. 38,
M.J. Aldon. A. Li&geois, B. Tondu and P. Touron. 'MIRE. A
pp. I25 - 140, March 1980.
software for computrr-aided design of industrial robots." Proc.
J.M. Hollerbach, 'A rccunivc lagrangian formulation of manip CAD, CAM, Roboticr and Automation Con/erence Tucsan,
ulator dynamics and a comparative study of dynamics formu- Arirona, February 1985, pp. 1 6. -
lation complrxity,' I E E E Tram. on Syrtemr, Atan a n t Cyber-
-
neticr, vol. SMC-10, no. 11, pp. 730 736, November 1980.
J. Durdick, Private Communication.
J.J. Craig, "Introduction to Roloticr: Mechanicr and Control,"
J.Y.S. Luh, M.W. Walker and R.P.C. Paul, 'On-line coqputa-
Reading, M=sachusctts: Addison - Wesley, 1985.
tlonal scheme for mechanical manipulaton,' ASME J. oJDy.
namic Sydtemr, Mearurcment, and Control, vol. 102, pp. 69 - A. Izaguirre and R.P. Paul, 'Computation of the inertial and
76, June, 1980. gravitational coefficients of the dynamics equatiom for a robot
manipulator with a load.' Pmc. 1985 International Confirencc
J .Y.S. Luh, M. W. Walker and R.P.C. Paul, 'Resolved-accelera- on Roboticr and Automation, St. Louis, March 25-28, 1985, pp.
tion control of mechanical manipulators,' I E E E Tram. on Au.
1024 - 1032.
-
tomatic Control, vol. AC-25,no. 3, pp 468 474, June 1980.
J. Hollerbach, 'Dynamics,* Robot Afotion ed. M. Drady. 0.Khatib, 'Real-tin~e obstacle avoidance for manipulaton and
J . Hollerbach, T. Johnson, T. Lozano-PCm and M. T. Ma- mobile robots, Proc. 1985 International Conference on Roboticr
son, MIT Press, Cambridge, 1982, pp. 51 53. - and Automation, St. Louis, hiarch 25-28, 1985, pp. 500 - 505.
S. Megahed and M. Renaud, 'Minimization of the computation B.K. Kim and K.G. Shin, 'Suboptimal control of industrial ma-
time necessary for the dynamic control of robot manipula- nipulators with a weighted minimux time-fuel criterion.' I E E E
ton." Proc. of the 12th International Symporium on Indurtrial Tramactiow on Automatic Control, vol. AC-30, No I., pp. 1
Robotr / 6th Con/erence on IndurtrialRobot Technology, Park, - 10, January 1985.
June 9 - 11, 1982,pp4G9-478. 1C.P. Valavanis, M.B. Leahy and G.N. Sardis, 'Real-time evalua-
tion of robotic control methods Proc. 1985 International Con-
M.W. Walker and D.E. Orin, 'Efficient dynamic computer simu-
ference on Roboticr and Automation, St. Louis, March 25-28.
lation of robotic mechanisms,' ASME J. of D p a m i c Syrtemr:
Meaaurcment, and Control, vol. 104, pp. 205. 211, September,
-
1985, pp. 644 649.
1982.
0.Khstib, 'Dynamic control of manipulaton in operation$ APPENDIX
space,' P a . Sirth IFToMM Congrerr on Theory of Machiner T h e f i l l Expressions for t h e Force. of M o t i o n of
and Mechanismr, New Delhi, December 15-20, 1983. a Puma 660 Arm
S. H. Koozekanani, K. Barin, R.B. McGhee, and H.T. Chang, *A
recursi~efree-body approach to computer simulation of human In the following tables the exprtssiom lor the elements of
postural dynamics," I E E E Tram. o n Biomedical Engineering, the A,B and C matrices and the g rector are These
-
vol. BME30, no. 12, pp. 787 792, December 1983. cxprcasioru are made in terms of constants which have units of
"MACSYMA Reference Manual," MIT, inertia or torque, and trigonometric t e r n that are functions of
MIT Mathlab Group,
Cambridge, 1983. the joint angles. We have abbreviated the trigonometric func-
tions by writing S 2 to mean sin(qa) and C 5 t o mean cos(q5).
R. P. Paul, M. Rong and Hong Zhang, 'The dynamics of the W h ~ na trigonometric operation is applied t o the sum of several
PUMA manipulator," Proc. 1983 American Control Confcr- annles we write C23 to mean cos(qt + q3) and S223 to mean
APPENDIX E
nll = Im~+I~+Is*CC2+h*SS23+Ilo*SC23+III~SC2
- -
+Ilo ( S S 5 l ( S S 2 3 ( I + C C 4 ) 1) 2 r.SC23 r C4 S C 5 )
+Iyl *SS23*CC4+2*(I~*C2*S23+I~~*c2*C23
+ I l $ ( S S 2 3 CS + SC23 C4 S S )
+ I l 6 C2 (S23 CS + C23 C4 S 5 )
+Ins S4 S!, + IYY ( S C 2 3 CS + CC23 C4 S S ) ) ;
zz 22.7 + 1.38 * CC2 +0.30. SS23 + 7 . 4 4 ~ 1 0 - ~C 2 523 .
.-
cz l . ~ l x l O - ' r S23 2.50~10-' C23 C4 S 5+
-
2.48~10-' S2 C 4 . SS + 0.30~10-' S23 ( 1 ( 2 S S 4 ) ) .
Table AS. The expressions giving the elcments of the Corioh matrix
(The Abbreviated Expressions have units of kg-my.)
APPENDIX E
.
= 2*(-116.C3*S4*S5+Ilo*SC4*SS5
-
b.34 =4x4 beas = be,, - bas4 = 0 .
=
+Ill SC4 I y y S4 SS) ;
-2.48~10-a C3 S4 8 SS . be45 = b,ar . b4.= 0. bra=O-
bys =2.{-I#~.SS+II.*(C3*C4.C5-S3*SS)
Table A6. The expressions for tbr terms of the centrifugd matrix.
+bo SS4 SC5 + Irr C4 C5) ;
z -2.50x10-' SS 2.48x10-'+(C3 C4 CS - S3. S5) . (Tbc Abbrrviatcd Exprruions have units of kt-ma.)