You are on page 1of 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/232649211

A MATLAB toolbox for robotic manipulators

Article · September 2005


DOI: 10.1109/ENC.2005.5 · Source: IEEE Xplore

CITATIONS READS
10 221

2 authors:

Dan-El Neil Vila Rosado Jorge Domínguez-López


Freie Universität Berlin Conteck
23 PUBLICATIONS   35 CITATIONS    19 PUBLICATIONS   76 CITATIONS   

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

PowerChalk View project

Intelligent Neurofuzzy Control of a Robot Manipiulators View project

All content following this page was uploaded by Dan-El Neil Vila Rosado on 22 July 2018.

The user has requested enhancement of the downloaded file.


A MATLAB Toolbox for Robotic Manipulators

D. N. Vila-Rosado and J. A. Domı́nguez-López


Centro de Investigación en Matemáticas (CIMAT),
Guanajuato CP36240, MEXICO
{dnvr30, axel}@cimat.mx

Abstract Of the two main solution strategies for inverse kinemat-


ics, numerical methods are commonly discarded because of
MATLAB toolboxes have been very useful to teach and their computational complexity. In addition, the numerical
train without the needing of the physical system. Espe- method used in the current MATLAB toolbox frequently
cially in the robotics field, using simulations avoids the misses to find a solution, despite that the inverse kine-
considerable cost of building a full robot manipulator. For matic is solvable for the given positions and orientations.
robotics, there was only one MATLAB toolbox, which has Accordingly, the toolbox described in this paper utilizes
several limitations. These limitations have been cured in the a closed form solution (i.e., algebraic solution). Thus,
toolbox reported in this paper. Also, there have been some the displacement of the joints can be found faster and for
additions to make the toolbox robust and more complete. all position and orientation in which the inverse kinematic
Some of this improvements are using a closed-form solution problem is solvable. Moreover, for the multiple solutions
for the inverse kinematics, a tough path and trajectory case, the user can specify the criteria to choose a solution.
generation. In addition, a end effector (i.e., a two-fingered For the path and trajectory generation is desirable to be
gripper) has been added, hence the user can simulate a able to specify trajectories with simple descriptions of the
robot which manipulates objects. The full toolbox and its desired motions, and let the generation algorithm to solve
documentation can be freely downloaded from internet. the details. Besides the goal position and orientation of
the end effector, and the via points, the user can specify
Keywords: Robotics, Matlab Toolbox, Closed Form Solu- both spatial and temporal information (e.g., velocities,
tion, Trajectory Design. accelerations, etc.) Also, the system should be able to
decide the velocity and acceleration profile. When the
1 Introduction end effector is a gripper, the control of the acceleration is
vital to avoid slippage of the grasped object. Accordingly,
the model of a two-fingered gripper is included to allow
Since the first master-slave anthropomorphic manipula-
the user to test path and trajectory generation in a pick-
tor was developed in 1947, a considerable number of robotic
up and place application. In addition, a grasping control
systems have been developed by industry and academic
is incorporated to our toolbox. Thus, the user can create a
organizations. The applications for manipulators have been
robot manipulator capable of manipulating objects.
growing because of the increased ability of robots to interact
dynamically with their environment in a precise manner. In
the same way, the interest in robotic manipulators have been 2 Description and transformations of co-
raising. MATLAB [1] toolboxes have been very useful to ordinate systems
teach and train without the needing of the physical system,
as they are sometimes very expensive and easily broken. Different co-ordinate systems are used to describe the lo-
Also, the MATLAB toolboxes are very useful to test designs cations,orientations and movements of the different manip-
before proceeding to build them. Therefore, the MATLAB ulator components. There are two conventions to number
toolboxes allow the users to rapidly create and test their the links, one proposed by [3] and other proposed by [4].
system. Currently, there is only one MATLAB toolbox for The former numbers the first moving link as link 0, and so
robotics [2], which has three main limitations: the toolbox on. While the latter numbers the immobile base of the arm
uses a numerical method to solve the inverse kinematics, the as link 0, the first moving body is link 1, and so on. When
toolbox does not have a good path and trajectory generation, Craig’s convention is used, it is opportune, for simplicity,
and the toolbox includes no end effectors. that the reference system origin (S0 ) coincides with S1
because this will lead to a0 = 0, α0 = 0 and d1 = 0 rpy2hom roll/pitch/yaw angles to homogeneous matrix
if joint 1 is revolute or θ1 = 0 if the joint is prismatic.
The toolbox has full support for both conventions. Now, the Reference [5] introduced a systematic method to de-
convention used to number the joints is as follows: joint i is scribe the kinematic relationships in a manipulator to fa-
the geometric point where links i − 1 and i are connected. cilitate the modelling. This notation is based on the fact
In addition, co-ordinate systems are assigned to each link. that any robot link can be described kinematically by four
A reference co-ordinate system is needed. For convenience, quantities: Two quantities describe the link itself while the
it is usually fixed to the manipulator base. The positions of other two describe the link’s connection to an adjacent link.
all other systems are described in terms of this frame. A These values are ai , αi , θi and di . Three of them are
co-ordinate system is assigned to each link. The link co- constant, the variable is θi if the joint is revolute or di if the
ordinate systems are enumerated as the link number. At the joint is prismatic. The convention for using these quantities
end of the last link, an extra system is fixed which coincides is named Denavit-Hartenberg (DH) notation. Observe,
with the location and orientation of the end effector. that there are two different forms of DH representation:
The rotation matrix, Q, is used to the new co-ordinate Classical form (based in the original work of [5]) and a
frame when the system rotates around any axis. When the modified form (introduced by [4]). The toolbox has full
system translates without any rotation, Q is equal to the support for both conventions. For the modified convention,
identity matrix, I, so to get the new co-ordinate frame is the general homogeneous matrix, Bi , which has 4 DH-
obtained by Equation 2. In order to facilitate the writing transformation, is given by:
of compact equations, the rotations and translations are
combined into a single matrix named the homogeneous Bm
i = Bz (θi ) Bz (di ) Bx (ai ) Bx (αi )
matrix, Bi , which transforms the co-ordinates of Si to Si−1 :
  = Bz (di ) Bz (θi ) Bx (αi ) Bx (ai )
i
Qi (qi ) R̄i−1
Bi (qi ) = (1)  
0̄ 1 Cθi −Sθi Cαi Sθi Sαi ai Cθi
 Sθi −Cθi Sαi ai Sθi 
= 
where qi is the ith variable and is equal to θi if the joint is Cθi Cαi
revolute or di if the joint is prismatic. Note that there is only  0 Sαi Cαi di 
one variable. If we wish to do a rotation and a translation, 0 0 0 1
we will then have two B matrices, one for each movement.
where C and S stands for cos and sin, respectively.
i For the classical convention, the homogeneous matrix is
P0 = P1 + Ri−1 (2)
given by:
Another useful matrix is the homogenous transformation
matrix Tji , which transforms the co-ordinates of a system Bci = Bx (ai ) Bx (αi ) Bz (θi ) Bz (di )
Sj to a system Si . It is given by:
= Bx (αi ) Bx (ai ) Bz (di ) Bz (θi )

 Bi+1 Bi+2 ... Bj−1 Bj if i < j
Notice that the both homogeneous matrices are not equal
Tji = I if i = j (3)
 (i.e., Bci = Bm i ). Thus, at the moment of constructing
(Tji )−1 if i > j every robot link, it is important to bear in mind and to state
Now, the commands used for the transformations are which convention is being used. The eslabon command
listed next: constructs each robot link given the Denavit-Hartenberg
parameters. The JointType parameter determines if the
trasl2hom translation to homogeneous matrix joint is either revolute or prismatic.

rotx2hom rotation about x-axis to homogeneous matrix eslabon([alpha, a, theta, d], JointType)

roty2hom rotation about y-axis to homogeneous matrix >>L{1}=eslabon([pi/2 0.3 0 0],’R’);


>>L{2}=eslabon([0 0.1 0 0],’P’);
rotz2hom rotation about z-axis to homogeneous matrix

hom2eul homogeneous matrix to Euler angles


Once, all the links have been constructed, the robot is
eul2hom Euler angles to homogeneous matrix created using the robot command using all the links:

hom2rpy homogeneous matrix to roll/pitch/yaw angles robot(Links, ’Name’)

2
>>MyRobot=robot(L,’My First Robot’) >>kinema_direc(MyRobot, [0 0 pi/2])
x=30 y=45 z=0

The calculation of the inverse kinematics can be specifying


3 Forward and inverse kinematics either only the positions or both position and orientation.
The inverse kinematics command for a given position:
Forward kinematics allow us to determine the position
kinema_inv(Robot, [Position])
and orientation of the end effector. Now, if we desire to put
the end effector in a specific position and orientation, we >>kinema_inv(MyRobot, [0 30 45])
need to know the displacement of the joints. This problem (T=Theta) T1=0 T2=0 T3=1.5707
is named inverse kinematics and its solution is called the
arm solution. The inverse kinematics problem is said to and the inverse kinematics command for a given position
be solvable if all sets of joints values for a given position and orientation:
and orientation can be determined using an algorithm. So,
if there were multiple solutions, the algorithm should be kinema_inv(Robot, [Position],
able to solve all of them. There are two main solution [Orientation])
strategies: closed form and numerical. The latter is much
slower than the former. Consequently, numerical methods >>kinema_inv(MyRobot,[0 30 45],
are commonly discarded because of their computational [0 0 pi/2])
complexity. (T=Theta) T1=0 T2=0 T3=1.5707
The closed form methods are divided into two: algebraic
and geometric. Both are very similar and the only difference
is in their approach. The algebraic method uses the forward 4 Path and trajectory generation
kinematic equations as a system of non-linear equations
regardless of the robot geometric structure. With the Trajectory generation describes a time history of posi-
geometric method, the robot geometric structure is used tion, velocity and acceleration for each link of the robot
to guide the approach to solve the non-linear equations. which moves from a start position and orientation to a
Closed form techniques are only useful to solve manipu- end position (goal position) with a specific orientation.
lators with a simple mechanical structure and with less than Trajectory generation can be a complex problem depending
6 DOF [4]. Although, if a 6 DOF manipulator has three on the constraints and desired accuracy of the system. For
consecutive revolute joints with their joint axes intersecting instance, in addition to the start and goal points, we might
at a single point, the manipulator is solvable [6]. To simplify want the system to pass through intermediate points (via
the inverse kinematics algebraic solution, the problem is points) and with a specific elapsed time between these via
divided in two parts: to find the the wrist co-ordinate system points. Moreover, we might want to specify the velocity
and to solve the joint angles. The following Equations and acceleration with which the end effector should move.
represent the two subproblems, respectively. Other common requirement is smooth motions, as uneven
3
movements increase mechanism wear and cause vibra-
T40 = Bi tions [4]. Some of these considerations can be considered
i=1 automatically by the trajectory generation algorithm. Thus,
the user has to provided simple descriptions of the desired
n motion.

Tn+1
4 = Bi Our toolbox considers several kinds of trajectory gener-
i=4 ation which can be combined. They are:

where n is the number of robot joints. • Asynchrony Point-To-Point


To commands kinema_direc and kinema_inv
• Synchrony Point-To-Point
compute the forward and inverse kinematics, respectively.
To compute the forward kinematics, it is necessary to • Straight line
specify a the joint angles or the joint offsets:
• With constant end effector orientation
kinema_direc(Robot, [joint angles]) • With intermediate orientation
kinema_direc(Robot, [joint offsets])
• With intermediate point

3
The traj command is used to specify a trajectory joints.
generation in joint space (Point-To-Point motions). We From a robot with n degrees of freedom, there are two
can specify only the StartPoint and GoalPoint. In addition main Jacobian to consider: in the base and the end effector
to these specifications, the user can indicate any of co-ordinates. Their commands are, respectively:
the following requirements: the elapse time (t), final
orientation (FinalOrientation), constant orientation JBase(MyRobot,[Velocities-Joint Space]);
(ConstantOrientation), intermediate orientations
(ViaOrientation) and points (ViaPoints). The JEnd(MyRobot,[Velocities-JointSpace]);
intermediate orientation and points are matrixes of those
via orientations and points while the elapse time, final and When we wish to move the end effector at a desired
constant orientations are vectors. velocity, we need to find the corresponding individual joint
velocities. To get that transformation, the inverse Jacobian,
>>traj([StartPoint], [GoalPoint]) J−1 , is used:

>>traj([StartPoint], [GoalPoint], θ̄˙ = J−1 v̄ (4)


’Synchrony’)
For the inverse Jacobian to exist, it should be non-
>>traj([StartPoint], [GoalPoint], singular at the current arm configuration. The Jacobian is
’Line’) singular when its determinant is zero. When that happens,
Equation 4 is unsolvable for these values of θ̄, which are
>>traj([StartPoint], [GoalPoint], t)
named singularities. In a singularity, the end effector
>>traj([StartPoint], [GoalPoint], cannot be moved in at least one direction. All manipulators
FinalOrientation) have singularities at their workspace boundary or when
>>traj([StartPoint], [GoalPoint], some joint axes are lining up. Again, we have two main
ConstantOrientation, ’Constant’) Jacobian. The former command is for the base co-ordinates
while the latter is for the end effector co-ordinates:
>>traj([StartPoint], [GoalPoint],
ViaOrientation, ’Orientations’) inv(JBase(MyRobot))*
>>traj([StartPoint], [GoalPoint], [Velocities-Cartesian]
ViaPoints, ’Points’) inv(JEnd(MyRobot))*
>>traj([StartPoint], [GoalPoint], [Velocities-Cartesian]
t, FinalOrientation, ’Line’)

5 Grasping
The moveto command is similar to the traj, but
the StartPoint for move is the current position. Thus, no The normal industrial grippers used for material han-
StartPoint has to be declared: dling are two-fingered grippers with the two fingers working
on opposition [7, 8]. Thus, a two-fingered gripper is
>>moveto([GoalPoint]); included to the toolbox to allow the robot to manipulate
objects (e.g., pick-and-place action). Now, to achieve satis-
other parameters, like t and FinalOrientation can be factory grasp, optimal force control is required to ensure the
used with this command too. integrity of the grasped object. The gravity, the end effector
To move the end effector to a goal point with a specific acceleration and external disturbances would try to make
speed, it is necessary to calculate the corresponding motion the load slip. Hence, the gripper has to compensate such
of each joint. The motion of the end effector is defined perturbations. The minimum force that the gripper must
in Cartesian space. So a way is needed to translate from apply to the load in order to avoid slippage is given by FT .
Cartesian space to joint space and vice versa. The Jacobian However, it is recommended to apply a little more force to
matrix, J, is a quantity matrix that maps velocities in joint be absolutely sure that there will be no slip [7]. The required
space to velocities in Cartesian space: force when the object is gripped vertically, v FT , is given by:
2m(g + a)Lg sin θg 2m(g + a) sin θg
v̄ = J θ̄˙ v FT = +
µd µ
where v̄ = [ẋ ẏ ż]T is the end effector velocity vector and where θg is the angle between the gripping surface and the
θ̄˙ = [θ˙1 ... θ˙n ]T is the joint velocities of a manipulator of n horizon, m is the load mass, g is the acceleration due to

4
30
gravity, a is the vertical acceleration of the end effector, d
is the width of the pressure pad and Lg is the distance from

End Effector Vertical Acceleration (m/s2)


20
the center of gravity to the torque axis. When the object is
gripped horizontally, the required force, h FT , is given by: 10

mRω 2 0

h FT =
µ −10

where R is the arm length and ω is the angular velocity of −20

the end effector.


−30
However, if the applied force and the applied actuator 0 1 2 3 4 5 6 7 8 9 10

Time (s)
energy (e.g., applied motor voltage) are high, it means that
it is not possible to grip tightly without risk of crushing the
object or slippage. Accordingly, an approach to reducing
the possibility of damaging the object is to restrict the end Figure 1. Behaviour of the end effector verti-
effector acceleration [9, 10]. Therefore, the toolbox trajec- cal acceleration: (solid) desired acceleration,
tory generation function includes a framework to control and (dashed) suggested acceleration. Notice
the maximum end effector acceleration when a gripper is that the end effector vertical acceleration is
attached to the robot. Notice that the end effector vertical measured along the gripper’s z axis of the
acceleration is measured along the gripper’s z axis of the gripper’s coordinate frame, zg , rather than in
gripper’s coordinate frame, zg , rather than in the world’s the world’s coordinate frame.
coordinate frame.
The following commands include the gripper and an
object of 5 Kg: 6 Dynamics

>>gripper(Rmotor , KT ); There are four sources of torques and forces which act
>>load(5); %5Kg. on the manipulator: dynamic torques (inertial, centripetal,
Coriolis’) from motion; static torques from friction; grav-
where Rmotor and KT are motor resistance and the ity torques; and external forces and torques [11]. The
motor torque constant, respectively. The actuator of the actuators have to balance these torques. There are dif-
gripper included in the toolbox is a DC motor. ferent approaches to represent the manipulator dynamics:
The following command generates a trajectory (from Newton’s laws together with the concept of virtual work,
the current position) with acceleration limiter: D’Alembert’s principle, Lagrange’s equation, Hamilton’s
equations, and Hamilton’s principle. As manipulators
>>traj([StartPoint],[GoalPoint],t,’limit’) represent a complicated dynamic system, Lagrangian me-
Slip (area)= 0 chanics are used because this method allows us to obtain
Delay (s)= 0.7 the dynamic equations in the simplest way [3]. These
equations relate forces and torques to positions, velocities
where t is a vector which specifies the elapsed time. Start- and accelerations. So, the dynamic behaviour of a robot is
Point and GoalPoint are vector which determine the starting described in terms of how the arm configuration changes
and goal points, respectively. The command moveto can in time in relation to the torques and forces exerted by
also be used with the acceleration limiter. the actuators [11]. The solution to the forward dynamic
Figure 1 shows the behaviour of the acceleration lim- equations gives the equation of motion of the manipulator
iter (dashed) for a pre-determined acceleration behaviour (position, velocity and acceleration). Now, to determine the
(solid). At 7 s the limiter controller predicts that the required torques and forces to provide that motion, inverse
gripper would be unable to cope with more acceleration dynamic equations have to be solved.
and sets a maximum acceleration. This acceleration limit The Lagrangian, L, formulation is based in terms of
eliminates the risk of object slippage [10]. Nevertheless, the kinetic energy, K, and the potential energy, P , of the
this improvement has the cost of a delay to complete the manipulator in any co-ordinate system. Kinetics relates the
trajectory. Thus, the user has to determine which case is forces that cause motion to the resulting motion:
better for the application: (a) no delays but with risk of
slippage or (b) delays with null slippage. L=K −P (5)

5
where K = 12 m v 2 and P = m g d cos(θ). The masses the addition of a two-fingered gripper to the toolbox allows
of the links are assumed to be negligible in comparison to to simulate and evaluate the grasping operation of a object.
the masses of the joints, so the dynamic equations can be The trajectory generation could affect the the gripping
determined easily. The dynamic equations are in terms of action. So, there has to be a interaction between the gripper
the kinetic and potential energy as well as the co-content of controller and the trajectory generation. The acceleration
the system dissipators: controller has shown that by limiting the acceleration, the
system performance can be improved.
d ∂L ∂L ∂C The toolbox for robot manipulators and its manual are
Fi = − + , i = 1, ..., n (6)
dt ∂ q̇i ∂qi ∂ q̇i freely available at http://www.cimat.mx/˜axel/robot.html
All the toolbox functions are described in detail in the
where n is the number of DOF, qi is the co-ordinate in
manual.
which the ith kinetic and potential are expressed and, q̇i
and Fi are the corresponding velocity and force or torque,
respectively. If qi is a linear co-ordinate, Fi is force, while References
if qi is an angular co-ordinate, Fi is torque.
Thus, we are interested in determining the motion of the [1] The MathWorks Inc. Matlab User’s Guide. Natick,
manipulator arose from torques applied by the actuators MA, 1990.
or from external forces applied to the manipulator. The [2] P.I. Corke. A robotics toolbox for MATLAB.
toolbox include the torque, ext_force and accel IEEE Robotics and Automation Magazine, 3(1):24–
commands. The torque command calculates the required 32, March 1996.
torques to produce the specified position, velocities and
accelerations. Then, the ext_force computes the [3] Richard P. Paul. Robot Manipulators: Mathematics,
velocities and accelerations due to external forces. And Programming, and Control. The MIT Press, Cam-
the accel determine the resulting acceleration for the bridge, MA, 1981.
input vector of torques. The format of these commands are [4] JohnJ. Craig. Introduction to Robotics Mechanics and
as follows: Control. Addison-Wesley, Reading, MA, 1986.
torque(Robot, [desired trajectory]) [5] J. Denavit and R.S. Hartenberg. A kinematic notation
>>torque(MyRobot,traj([StartPoint], for lower-pair mechanisms based on matrices. Journal
[GoalPoint])); of Applied Mechanics, 22(2):215–221, 1955.

ext_force(Robot, [forces]) [6] D. Pieper. The Kinematics of Manipulators under


>>ext_force(MyRobot, [gravity]); Computer Control. PhD thesis, University of Stanford,
Palo Alto, CA, 1968.
accel(Robot, [torques])
[7] Anthony C. McDonald. Robot Technology: Theory,
Design and Applications. Prentice-Hall, Englewoods
Cliffs, NJ, 1986.
7 Conclusions
[8] Richard M. Crowder. An anthropomorphic robotic
The reported toolbox is a robust and very complete end effector. Robotics and Autonomous Systems,
instrument for academic and research purposes. Utilizing 7(4):253–268, 1991.
closed-form solutions to solve the inverse kinematic prob- [9] J. A. Domı́nguez-López. Intelligent Neurofuzzy Con-
lem has shown to be a fast and reliable methodology. Com- trol in Robotic Manipulators. PhD thesis, University
paring this approach with the numerical solution, the latter of Southampton, Southampton, UK, 2004.
has frequently problems to find an arm solution, despite the
fact that the inverse kinematic problem is solvable. [10] J. A. Domı́nguez-López, R. I. Damper, R. M. Crow-
The toolbox has increased the number of trajectory der, and C. J. Harris. Adaptive neurofuzzy control of a
options, giving to the user the freedom to choose from robotic gripper with external disturbances. In IEEE
a simple trajectory to a more complex but sophisticated International Conference on Systems, Man and Cy-
trajectory. Including, the option to select a behaviour in the bernetics, pages 3193–3198, The Hague, Netherlands,
end effector orientation. October 2004.
Robot manipulations need a end effector capable of [11] Phillip John McKerrow. Introduction to Robotics.
gripping dexterity. Robotic end effectors are commonly Addison-Wesley, Sydney, Australia, 1991.
required to hold and manipulate various objects. Therefore,

View publication stats

You might also like