天天看點

MATLAB-Robot(0):MATLAB Robotics Toolbox機器人仿真基礎基礎

一:基本變換

1. 平移:  T=transl(0.5,0,0)%分别沿着xyz軸的平移

>> T=transl(0.5,0,0)  %x方向平移0.5個機關長度

T =

    1.0000         0         0    0.5000
         0    1.0000         0         0
         0         0    1.0000         0
         0         0         0    1.0000
           

2.旋轉:

(1)得到3x3階矩陣: rotx(a)   roty(b)  rotz(c)%分别繞xyz軸的旋轉

>> T = roty(pi/2)

T =

    0.9996         0    0.0274
         0    1.0000         0
   -0.0274         0    0.9996
           

(2)得到4x4階矩陣:trotx(a)   troty(b)  trotz(c)%分别繞xyz軸的旋轉

>> trotx(pi/2)

ans =

    1.0000         0         0         0
         0    0.9996   -0.0274         0
         0    0.0274    0.9996         0
         0         0         0    1.0000
           

3.複合變換: 平移加旋轉

>> trotx(pi/2)

ans =

    1.0000         0         0         0
         0    0.9996   -0.0274         0
         0    0.0274    0.9996         0
         0         0         0    1.0000
           

二:建立機器人對象

1.Link類

A Link object holds all information related to a robot joint and link such as kinematics parameters, rigid-body inertial parameters, motor and transmission parameters.

1.1 Link類相應函數:

A               連杆變換矩陣

RP            關節類型: 'R' 或 'P'

friction      摩擦力

nofriction    摩擦力忽略

dyn           顯示動力學參數

islimit       測試關節是否超出軟限制

isrevolute    測試是否為旋轉關節

isprismatic   測試是否為移動關節

display       連杆參數以表格形式顯示

char          轉為字元串

1.2link類的運動學,動力學屬性參數

  theta    關節角度

  d        連杆偏移量

  a        連杆長度

  alpha    連杆扭角

  sigma    旋轉關節為0,移動關節為1

  mdh      标準的D&H為0,否則為1

  offset   關節變量偏移量(例如繞Z軸的旋轉量)

  qlim     關節變量範圍[min max]

  m: 品質 

  r: 質心 

  I: 慣性張量 

  B: 粘性摩擦 

  Tc: 靜摩擦 

  G: 減速比 

  Jm: 轉子慣量

2.SerialLink類

定義: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 (standard or modified).

2.1 SerialLink相應函數:

  SerialLink(L1 ... Ln) 建立機器人關節連接配接

  plot(theta)顯示機器人圖形(theta=[x0 ... xn])x為關節變量,如角度

2.2 SerialLink的相應屬性: links :連杆向量 

gravity :重力加速度 

base :基座标系 

tool:與基座标系的變換矩陣 

qlim :關節極限位置 

offset :關節偏移量 

name :機器人的名字 

manuf :制造者的名字 

comment: 注釋

n :關節數 

config: 關節配置,如‘RRRRRR’ 

mdh :D-H矩陣類型 

theta :D-H參數 

d :D-H參數 

a :D-H參數 

alpha: D-H參數

3. 建立機器人 3.1 第一種建立方式(标準DH)

%定義機器人關節連杆參數,預設為标準DH
L1 = Link('d', 0, 'a', 0, 'alpha', pi/2);
L2 = Link('d', 0, 'a', 0.5, 'alpha', 0,'offset',pi/2);
L3 = Link('d', 0, 'a', 0, 'alpha', pi/2,'offset',pi/4);
L4 = Link('d', 1, 'a', 0, 'alpha', -pi/2);
L5 = Link('d', 0, 'a', 0, 'alpha', pi/2);
L6 = Link('d', 1, 'a', 0, 'alpha', 0);
robot=SerialLink([L1,L2,L3,L4,L5,L6]); %用定義好的關節建立機器人
robot.display();  %顯示建立的機器人的DH參數
theta=[0 0 0 0 0 0]; 	%6個關節的角度變量值都設為0,可以更改
robot.plot(theta); 	%顯示機器人的圖像
           

此處一直沒有成功用此方式調出改進型dh,希望知道的大神能告知一下

3.2 第二種建立方式(标準DH和改進DH)

L1 =  Link([ pi/4, 0, 0, 0, 0], 'modified');
L2 =  Link([ pi/2, 0.2, 0.1, 0 ,0], 'modified');
L3 =  Link([ 0, 0.1, 0.2, 0 ,0], 'modified');
robot=SerialLink([L1,L2,L3]); %用定義好的關節建立機器人
robot.display();  %顯示建立的機器人的DH參數
theta=[0 0 0]; 	%6個關節的角度變量值都設為0,可以更改
robot.plot(theta); 	%顯示機器人的圖像
           

此處Link文法為:   L = Link(DH, OPTIONS)             %  - 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.

但theta的值在定義時我改變後沒有效果,而在下方的theta=[0 0 0]中可以通過改變0的值改變相應的theta值

3.3 标準型DH和改進型DH的差別

MATLAB-Robot(0):MATLAB Robotics Toolbox機器人仿真基礎基礎