Thanks Peter Corke for his great work of Robotics Toolbox .
OS: Win10 x64
Matlab: R2016b
Toolbox Release: 10.2
We highly recommand to learn to use the Robotics System Toolbox designed by MathWorks firstly. Of course, it is not necessary. Here we just show some simple processes to imply the usage of Robotics Toolbox. The way to access detailed explanations can be found in section Support.
Download and Install
How to install the Robotics Toolbox? Just follow the instructions here. It is free and easy.
Support
If you have this book, congraduations, you are accessible to the official tutorial as well as mammal. Otherwise, there is a free but cut version of it. There is no exclusive forum.
There is an official: rtbdemo() by which you can survey the functions of Robotics Toolbox.
Untilities
Here are some normal functions to boost your coding efficiency.
about(x) or about x
>> a=1;
>> about a
a [double] : 1x1 (8 bytes)
>> a = rand(5,7);
>> about a
a [double] : 5x7 (280 bytes)
angdiff(th1, th2)
>> th = angdiff(pi/2, -3*pi/2)
th = 0;
unit(v)
A unit-vector parallel to v.
>> vn = unit([4,0])
vn =
1 0
Homogeneous Representation
There are some functions to help you transform any kinds of representative to
Available representatives are angvec (angle and vector), r (
The following functions are some puplar examples.
angvec2r(theta, v) (axang2rotm in robotics system toolbox)
>> angvec2r(pi/2,[1,0,0]')
ans =
1.0000 0 0
0 0.0000 -1.0000
0 1.0000 0.0000
angvec2tr(theta,k) (axang2tform in robotics system toolbox)
>> angvec2tr(pi/2,[1,0,0])
ans =
1.0000 0 0 0
0 0.0000 -1.0000 0
0 1.0000 0.0000 0
0 0 0 1.0000
transl(x,y,z) ( vec2tform in robotics system toolbox )
>> transl(1,0,0)
ans =
1 0 0 1
0 1 0 0
0 0 1 0
0 0 0 1
The Lie Algebra (
SerialLink
SerialLink is the Serial-link robot class in Robotics Toolbox that is a concrete class that represents a serial-link arm-type robot. Each link and joint in the chain is described by a Link-class object using Denavit-Hartenberg parameters. There are some models already constructed of popular robots, such as Universal Robots.
Ex:
mdl_ur5();
ur5.plot(qz);
The function mdl_ur5 provides three variables: ur5 is an object of SerialLink class, qz is the initial joint configuration and qr is the joint configuration to render the robot arm along +ve x-axis. plot is a normal method of SerialLink class.
There are constructor methods, display methods, testing methods and conversion methods in SerialLink class.
plot() can also be used to animate the robot model:
mdl_ur5();
figure
ur5.plot(qr);
qt = zeros(50,6);
qt(:,6) = linspace(0,pi,50)';
qt(:,1) = pi;
qt(:,5) = pi/2;
ur5.plot(qt);
Kinematics
Forward Kinematics
The forward kinematics of a SerialLink object is given by fkine method.
>> T = ur5.fkine([0, -pi/2, 0, -pi/2, -pi/2, 0])
T =
0 0.0000 -1 -0.0823
1 0 0 -0.1092
0 -1 -0.0000 1.001
0 0 0 1
The output T is a SE3 object rather than a
>> T.T % Or T.T()
ans =
-0.0000 0.0000 -1.0000 -0.0823
1.0000 0.0000 -0.0000 -0.1092
-0.0000 -1.0000 -0.0000 1.0014
0 0 0 1.0000
Inverse Kinematics
SerialLink provides several methods to solve the inverse kinematics.
ikine: Inverse kinematics by optimization without joint limits. Solution is computed iteratively.
ikine3: Inverse kinematics for 3-axis robot with no wrist.
ikine6s: Analytical inverse kinematics for a 6-axis robot with a spherical wrist.
ikine_sym: Symbolic inverse kinematics. q = R.ikine_sym(k, options) is a cell array (
ikinem: Numerical inverse kinematics by minimization.
ikcon: Inverse kinematics by optimization with joint limits.
ikunc: Inverse manipulator by optimization without joint limits.
Except for ikine_sym, the input argument of all these methods is a SE3 object or a homogeneous matrix while the output argument is a vector of joint variable. Anyway, you can never expect the general inverse kinematics solver to give you an accurate solution.
>> qInitial
qInitial =
0 -1.5708 0 -1.5708 -1.5708 0
>> T = ur5.fkine(qInitial);
>> q1 = ur5.ikcon(T)
reach =
1.1928
ans =
3.8271
q1 =
-0.1273 -1.5683 -3.1416 1.4062 -1.4463 0.0202
>> q2 = ur5.ikunc(T)
q2 =
-0.0102 -1.5633 -0.0184 -1.5599 -1.5606 0.0000
Enjoy yourself with Robotics Toolbox! I will keep updating this article.