启用工具箱:在命令栏输入startup_rvc
常用函数:
1.Link
eg:L = Link([0 1.2 0.3 pi/2]); %Link(theta, d,a,alpha)
theta kinematic: joint angle
d kinematic: link offset
a kinematic: link length
alpha kinematic: link twist
L = Link('revolute', 'd', 1.2, 'a', 0.3, 'alpha', pi/2);
revolute for a revolute joint (default)
L = Revolute('d', 1.2, 'a', 0.3, 'alpha', pi/2);
Revolute construct a revolute joint+link using standard DH
三者结果一样。
create robot link object
L=Link( );is a Link object with default parameters.
L1=Link()
L1 =
Revolute(std): theta=q, d=0, a=0, alpha=0, offset=0
L=Link(LNK); is a Link object that is a deep copy of the link object LNK and has type Link, even if LNK is a subclass.
L2 = Revolute('d', 1.2, 'a', 0.3, 'alpha', pi/2);
>> L3=Link(L2);
运行后L3和L2有一样的参数
L = Link(OPTIONS) is a link object with the kinematic and dynamic parameters specified by the key/value pairs.(最常用)
Options:
% 'theta',TH joint angle, if not specified joint is revolute
% 'd',D joint extension, if not specified joint is prismatic
% 'a',A joint offset (default 0)
% 'alpha',A joint twist (default 0)
% 'standard' defined using standard D&H parameters (default).
% 'modified' defined using modified D&H parameters.
% 'offset',O joint variable offset (default 0)
% 'qlim',L joint limit (default [])
% 'I',I link inertia matrix (3x1, 6x1 or 3x3)
% 'r',R link centre of gravity (3x1)
% 'm',M link mass (1x1)
% 'G',G motor gear ratio (default 0)
% 'B',B joint friction, motor referenced (default 0)
% 'Jm',J motor inertia, motor referenced (default 0)
% 'Tc',T Coulomb friction, motor referenced (1x1 or 2x1), (default [0 0])
% 'revolute' for a revolute joint (default)
% 'prismatic' for a prismatic joint 'p'
% 'standard' for standard D&H parameters (default).
% 'modified' for modified D&H parameters.
% 'sym' consider all parameter values as symbolic not numeric
Notes:
- It is an error to specify both 'theta'and 'd'
- The joint variable, either theta or d, is provided as an argument to the A() method.
- The link inertia matrix (3×3) is symmetric and can be specified by giving a 3×3 matrix, the diagonal elements [Ixx Iyy Izz], or the moments and products of inertia [Ixx Iyy Izz Ixy Iyz Ixz].
- All friction quantities are referenced to the motor not the load.
- Gear ratio is used only to convert motor referenced quantities such as friction and interia to the link frame.
the tobotics also support the old syntax
Old syntax:
L = Link(DH, OPTIONS) is a link object using the specified kinematic convention and with parameters:
- DH = [THETA D A ALPHA SIGMA OFFSET] where SIGMA=0 for a revolute and 1 for a prismatic joint; and OFFSET is a constant displacement between the user joint variable and the value used by the kinematic model.
- DH = [THETA D A ALPHA SIGMA] where OFFSET is zero.
- DH = [THETA D A ALPHA], joint is assumed revolute and OFFSET is zero.
Options:
'standard' for standard D&H parameters (default).
'modified' for modified D&H parameters.
'revolute' for a revolute joint, can be abbreviated to 'r'(default)
'prismatic' for a prismatic joint, can be abbreviated to 'p'
Notes:
- The parameter D is unused in a revolute joint, it is simply a placeholder in the vector and the value given is ignored.
- The parameter THETA is unused in a prismatic joint, it is simply a placeholder in the vector and the value given is ignored.
Link.char
Convert to string
s = L.char() is a string showing link parameters in a compact single line format. If L is a vector of Link objects return a string with one line per Link
L3.char
ans =
'Revolute(std): theta=q, d=1.2, a=0.3, alpha=1.5708, offset=0'
Link.display
Display parameters
L.display() displays the link parameters in compact single line format. If L is a vector of Link objects displays one line per element.
L3.display
L3 =
Revolute(std): theta=q, d=1.2, a=0.3, alpha=1.5708, offset=0
2.SerialLink
bot = SerialLink([L1 L2], 'name', 'my robot');
bot.n;%查看连杆数目
bot.fkine([0.1 0.2]);%前向运动学
bot.plot([0.1 0.2]);%绘制机器人
Five_Link=SerialLink([L(1),L(2),L(3),L(4),L(5)]);
clear;clc
startup_rvc
L(1)=Link([0 0 0 0],'modified');
L(2)=Link([0 0.5 0.2 0],'modified');
L(3)=Link([0 0.6 0.3 pi/4],'modified');
L(4)=Link([0 4 0.8 pi/2],'modified');
L(5)=Link([1 0.6 1 pi],'modified');
Five_Link=SerialLink([L(1),L(2),L(3),L(4),L(5)]);
Five_Link.display
Five_Link.teach