Robotics Toolbox
for MATLAB R
Release 10
Peter Corke
2
Release
Release date
10.3
August 2018
Licence
Toolbox home page
Discussion group
LGPL
http://www.petercorke.com/robot
http://groups.google.com.au/group/robotics-tool-box
Copyright c2018Peter Corke
peter.i.corke@gmail.com
http://www.petercorke.com
Preface
This, the tenth major release of the Toolbox, represent-
ing over twenty five years of continuous development
and a substantial level of maturity. This version cor-
responds to the second edition of the book “Robotics,
Vision & Control” published in June 2017 – RVC2.
This MATLAB R Toolbox has a rich collection of func-
tions that are useful for the study and simulation of
robots: arm-type robot manipulators and mobile robots.
For robot manipulators, functions include kinematics,
trajectory generation, dynamics and control. For mobile
robots, functions include path planning, kinodynamic
planning, localization, map building and simultaneous
localization and mapping (SLAM).
The Toolbox makes strong use of classes to represent robots and such things as sen-
It includes Simulink R models to describe the evolution of arm or
sors and maps.
mobile robot state over time for a number of classical control strategies. The Tool-
box also provides functions for manipulating and converting between datatypes such
as vectors, rotation matrices, unit-quaternions, quaternions, homogeneous transforma-
tions and twists which are necessary to represent position and orientation in 2- and
3-dimensions.
The code is written in a straightforward manner which allows for easy understanding,
perhaps at the expense of computational efficiency. If you feel strongly about computa-
tional efficiency then you can always rewrite the function to be more efficient, compile
the M-file using the MATLAB compiler, or create a MEX version.
The bulk of this manual is auto-generated from the comments in the MATLAB code
itself. For elaboration on the underlying principles, extensive illustrations and worked
examples please consult “Robotics, Vision & Control, second edition” which provides
a detailed discussion (720 pages, nearly 500 figures and over 1000 code examples) of
how to use the Toolbox functions to solve many types of problems in robotics.
Robotics Toolbox 10.3 for MATLAB R 3
Copyright cPeter Corke 2018
Robotics Toolbox 10.3 for MATLAB R 4
Copyright cPeter Corke 2018
Functions by category
transforma-
Homogeneous
tions 3D
angvec2r . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
angvec2tr . . . . . . . . . . . . . . . . . . . . . . . . . . 26
eul2r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
eul2tr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
ishomog . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
isrot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
isunit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
oa2r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
oa2tr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
rotx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
roty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
rotz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
rpy2r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
rpy2tr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
tr2angvec . . . . . . . . . . . . . . . . . . . . . . . . . 356
tr2eul . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
tr2rpy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
transl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
trchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
trexp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .365
trinterp . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
trlog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
trnorm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
trotx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
troty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
trotz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
trprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
trscale . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
transforma-
Homogeneous
tions 2D
ishomog2 . . . . . . . . . . . . . . . . . . . . . . . . . . 86
isrot2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
rot2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
transl2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
trchain2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
trexp2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
trinterp2 . . . . . . . . . . . . . . . . . . . . . . . . . . 368
trot2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
trprint2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
transforma-
Homogeneous
tion utilities
r2t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
rt2tr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
t2r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
tr2rt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
and
Homogeneous points
lines
e2h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
h2e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
homline . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
homtrans . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Differential motion
delta2tr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
eul2jac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
rpy2jac . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
skewa. . . . . . . . . . . . . . . . . . . . . . . . . . . . .329
skew. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .328
tr2delta . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
tr2jac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
vexa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
vex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
wtrans . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Robotics Toolbox 10.3 for MATLAB R 5
Copyright cPeter Corke 2018
Trajectory generation
ctraj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
jtraj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
lspb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
mstraj . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
mtraj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
tpoly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
trinterp2 . . . . . . . . . . . . . . . . . . . . . . . . . . 368
trinterp . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Pose representation classes
Quaternion . . . . . . . . . . . . . . . . . . . . . . . . 208
RTBPose. . . . . . . . . . . . . . . . . . . . . . . . . .243
SE2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
SE3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
SO2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
SO3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Twist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
UnitQuaternion . . . . . . . . . . . . . . . . . . . . 387
Serial-link manipulator
DHFactor . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
PrismaticMDH . . . . . . . . . . . . . . . . . . . . 202
Prismatic. . . . . . . . . . . . . . . . . . . . . . . . . .200
RevoluteMDH . . . . . . . . . . . . . . . . . . . . . 230
Revolute . . . . . . . . . . . . . . . . . . . . . . . . . . 228
SerialLink.friction . . . . . . . . . . . . . . . . . 293
SerialLink.nofriction . . . . . . . . . . . . . . . 315
SerialLink.perturb . . . . . . . . . . . . . . . . . 317
SerialLink.plot . . . . . . . . . . . . . . . . . . . . 318
SerialLink.teach . . . . . . . . . . . . . . . . . . . 326
SerialLink. . . . . . . . . . . . . . . . . . . . . . . . .283
Models
mdl_KR5 . . . . . . . . . . . . . . . . . . . . . . . . . 114
mdl_LWR. . . . . . . . . . . . . . . . . . . . . . . . .115
mdl_S4ABB2p8 . . . . . . . . . . . . . . . . . . . 127
mdl_ball . . . . . . . . . . . . . . . . . . . . . . . . . . 107
mdl_baxter . . . . . . . . . . . . . . . . . . . . . . . . 108
mdl_cobra600 . . . . . . . . . . . . . . . . . . . . . 109
mdl_coil . . . . . . . . . . . . . . . . . . . . . . . . . . 109
mdl_hyper2d . . . . . . . . . . . . . . . . . . . . . . 111
mdl_hyper3d . . . . . . . . . . . . . . . . . . . . . . 111
mdl_irb140_mdh . . . . . . . . . . . . . . . . . . 113
mdl_irb140. . . . . . . . . . . . . . . . . . . . . . . .112
mdl_jaco . . . . . . . . . . . . . . . . . . . . . . . . . . 114
mdl_mico . . . . . . . . . . . . . . . . . . . . . . . . . 116
mdl_nao . . . . . . . . . . . . . . . . . . . . . . . . . . 118
mdl_p8 . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
mdl_panda . . . . . . . . . . . . . . . . . . . . . . . . 121
mdl_phantomx . . . . . . . . . . . . . . . . . . . . 121
mdl_planar1 . . . . . . . . . . . . . . . . . . . . . . . 122
mdl_planar2 . . . . . . . . . . . . . . . . . . . . . . . 123
mdl_planar3 . . . . . . . . . . . . . . . . . . . . . . . 124
mdl_puma560akb . . . . . . . . . . . . . . . . . . 125
mdl_puma560 . . . . . . . . . . . . . . . . . . . . . 124
mdl_quadrotor . . . . . . . . . . . . . . . . . . . . . 126
mdl_sawyer . . . . . . . . . . . . . . . . . . . . . . . 128
mdl_stanford_mdh . . . . . . . . . . . . . . . . . 130
mdl_stanford . . . . . . . . . . . . . . . . . . . . . . 129
mdl_twolink_mdh . . . . . . . . . . . . . . . . . 131
mdl_twolink_sym . . . . . . . . . . . . . . . . . . 132
mdl_twolink. . . . . . . . . . . . . . . . . . . . . . .130
mdl_ur10 . . . . . . . . . . . . . . . . . . . . . . . . . 133
mdl_ur3 . . . . . . . . . . . . . . . . . . . . . . . . . . 133
mdl_ur5 . . . . . . . . . . . . . . . . . . . . . . . . . . 134
models. . . . . . . . . . . . . . . . . . . . . . . . . . . .135
Kinematics
DHFactor . . . . . . . . . . . . . . . . . . . . . . . . . . 45
ETS2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
ETS3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
SerialLink.fkine . . . . . . . . . . . . . . . . . . . 293
SerialLink.ikine6s . . . . . . . . . . . . . . . . . 301
SerialLink.ikine . . . . . . . . . . . . . . . . . . . 298
SerialLink.jacob0 . . . . . . . . . . . . . . . . . . 308
SerialLink.jacobe . . . . . . . . . . . . . . . . . . 311
SerialLink.maniplty . . . . . . . . . . . . . . . . 313
jsingu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
trchain2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
trchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Dynamics
SerialLink.accel . . . . . . . . . . . . . . . . . . . 286
SerialLink.cinertia . . . . . . . . . . . . . . . . . 287
SerialLink.coriolis . . . . . . . . . . . . . . . . . 289
SerialLink.fdyn . . . . . . . . . . . . . . . . . . . . 291
SerialLink.gravload . . . . . . . . . . . . . . . . 296
SerialLink.inertia . . . . . . . . . . . . . . . . . . 306
SerialLink.itorque. . . . . . . . . . . . . . . . . .308
SerialLink.rne . . . . . . . . . . . . . . . . . . . . . 324
Robotics Toolbox 10.3 for MATLAB R 6
Copyright cPeter Corke 2018
wtrans . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Mobile robot
Bicycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
LandmarkMap . . . . . . . . . . . . . . . . . . . . . . 89
Navigation . . . . . . . . . . . . . . . . . . . . . . . . 139
RandomPath . . . . . . . . . . . . . . . . . . . . . . 220
RangeBearingSensor . . . . . . . . . . . . . . . 223
Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Unicycle . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Vehicle . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
plot_vehicle . . . . . . . . . . . . . . . . . . . . . . . 182
Localization
EKF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
ParticleFilter . . . . . . . . . . . . . . . . . . . . . . 150
PoseGraph . . . . . . . . . . . . . . . . . . . . . . . . 199
Path planning
Bug2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
DXform. . . . . . . . . . . . . . . . . . . . . . . . . . . .52
Dstar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Lattice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
PRM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
RRT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
makemap . . . . . . . . . . . . . . . . . . . . . . . . . 107
Graphics
circle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
mplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
plot2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
plot_arrow . . . . . . . . . . . . . . . . . . . . . . . . 175
plot_box . . . . . . . . . . . . . . . . . . . . . . . . . . 175
plot_circle . . . . . . . . . . . . . . . . . . . . . . . . 176
plot_ellipse. . . . . . . . . . . . . . . . . . . . . . . .177
plot_homline . . . . . . . . . . . . . . . . . . . . . . 178
plot_point . . . . . . . . . . . . . . . . . . . . . . . . . 179
plot_poly . . . . . . . . . . . . . . . . . . . . . . . . . 180
plot_sphere. . . . . . . . . . . . . . . . . . . . . . . .181
plotp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
plotvol . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
qplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
tranimate2 . . . . . . . . . . . . . . . . . . . . . . . . 361
tranimate. . . . . . . . . . . . . . . . . . . . . . . . . .360
trplot2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
trplot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
xaxis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
xyzlabel . . . . . . . . . . . . . . . . . . . . . . . . . . 448
yaxis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
Utility
PGraph . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Plucker . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Polygon. . . . . . . . . . . . . . . . . . . . . . . . . . .194
RTBPlot . . . . . . . . . . . . . . . . . . . . . . . . . . 242
about . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
angdiff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
bresenham . . . . . . . . . . . . . . . . . . . . . . . . . 40
chi2inv_rtb . . . . . . . . . . . . . . . . . . . . . . . . . 42
colnorm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
diff2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
distancexform . . . . . . . . . . . . . . . . . . . . . . 47
edgelist . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
gauss2d . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
isunit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
isvec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
numcols . . . . . . . . . . . . . . . . . . . . . . . . . . 148
numrows . . . . . . . . . . . . . . . . . . . . . . . . . . 148
peak2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
peak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
pickregion . . . . . . . . . . . . . . . . . . . . . . . . 174
polydiff . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
randinit . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
runscript . . . . . . . . . . . . . . . . . . . . . . . . . . 254
stlRead . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
tb_optparse. . . . . . . . . . . . . . . . . . . . . . . .353
unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Demonstrations
rtbdemo. . . . . . . . . . . . . . . . . . . . . . . . . . .241
Examples
plotbotopt . . . . . . . . . . . . . . . . . . . . . . . . . 183
Robotics Toolbox 10.3 for MATLAB R 7
Copyright cPeter Corke 2018
Robotics Toolbox 10.3 for MATLAB R 8
Copyright cPeter Corke 2018