1. 程式人生 > >機械臂(3)——使用MATLAB建立機械臂模型

機械臂(3)——使用MATLAB建立機械臂模型

最近準備研究下機械臂的你運動分析,本文記錄相關過程。

研究機械臂必不可少的就是建立模型進項測試分析,不可能直接用實物測試。本文將採用MATLAB進行建立模型,已經安裝好機器人工具箱

1、首先要搞清楚Link類,類中包含了方法、屬性,下面為官方函式說明,可自行翻譯成中文

% A Link object holds all information related to a robot link such as

% kinematics parameters, rigid-body inertial parameters, motor and

% transmission parameters.

% Methods::

% A link transform matrix

% RP joint type: 'R' or 'P'

% friction friction force

% nofriction Link object with friction parameters set to zero

% dyn display link dynamic parameters

% islimit test if joint exceeds soft limit

% isrevolute test if joint is revolute

% isprismatic test if joint is prismatic

% display print the link parameters in human readable form

% char convert to string

%

% Properties (read/write)::

%

% theta kinematic: joint angle

% d kinematic: link offset

% a kinematic: link length

% alpha kinematic: link twist

% sigma kinematic: 0 if revolute, 1 if prismatic

% mdh kinematic: 0 if standard D&H, else 1

% offset kinematic: joint variable offset

% qlim kinematic: joint variable limits [min max]

%-

% m dynamic: link mass

% r dynamic: link COG wrt link coordinate frame 3x1

% I dynamic: link inertia matrix, symmetric 3x3, about link COG.

% B dynamic: link viscous friction (motor referred)

% Tc dynamic: link Coulomb friction

%-

% G actuator: gear ratio

% Jm actuator: motor inertia (motor referred)

%

% Examples::

%

% L = Link([0 1.2 0.3 pi/2]);

% L = Link('revolute', 'd', 1.2, 'a', 0.3, 'alpha', pi/2);

% L = Revolute('d', 1.2, 'a', 0.3, 'alpha', pi/2);

%

% Notes::

% - This is a reference class object.

% - Link objects can be used in vectors and arrays.

其中我們D-H引數相關的屬性有

% theta kinematic: joint angle    關節角度

% d kinematic: link offset    偏距

% a kinematic: link length    長度

% alpha kinematic: link twist    扭角

D-H引數確定方法在上一篇部落格中,請自行檢視

2SerialLink類。

% A concrete class that represents a serial-link arm-type robot. The

% mechanism is described using Denavit-Hartenberg parameters, one set

% per joint.

%

% Methods::

%

% plot display graphical representation of robot

% plot3d display 3D graphical model of robot

% teach drive the graphical robot

% getpos get position of graphical robot

%-

% jtraj a joint space trajectory

%-

% edit display and edit kinematic and dynamic parameters

%-

% isspherical test if robot has spherical wrist

% islimit test if robot at joint limit

% isconfig test robot joint configuration

%-

% fkine forward kinematics

% A link transforms

% trchain forward kinematics as a chain of elementary transforms

%-

% ikine6s inverse kinematics for 6-axis spherical wrist revolute robot

% ikine inverse kinematics using iterative numerical method

% ikunc inverse kinematics using optimisation

% ikcon inverse kinematics using optimisation with joint limits

% ikine_sym analytic inverse kinematics obtained symbolically

%-

% jacob0 Jacobian matrix in world frame

% jacobn Jacobian matrix in tool frame

% jacob_dot Jacobian derivative

% maniplty manipulability

% vellipse display velocity ellipsoid

% fellipse display force ellipsoid

% qmincon null space motion to centre joints between limits

%-

% accel joint acceleration

% coriolis Coriolis joint force

% dyn show dynamic properties of links

% friction friction force

% gravload gravity joint force

% inertia joint inertia matrix

% cinertia Cartesian inertia matrix

% nofriction set friction parameters to zero

% rne inverse dynamics

% fdyn forward dynamics

%-

% payload add a payload in end-effector frame

% perturb randomly perturb link dynamic parameters

% gravjac gravity load and Jacobian

% paycap payload capacity

% pay payload effect

%-

% sym a symbolic version of the object

% gencoords symbolic generalized coordinates

% genforces symbolic generalized forces

% issym test if object is symbolic

%

% Properties (read/write)::

%

% links vector of Link objects (1xN)

% gravity direction of gravity [gx gy gz]

% base pose of robot's base (4x4 homog xform)

% tool robot's tool transform, T6 to tool tip (4x4 homog xform)

% qlim joint limits, [qmin qmax] (Nx2)

% offset kinematic joint coordinate offsets (Nx1)

% name name of robot, used for graphical display

% manuf annotation, manufacturer's name

% comment annotation, general comment

% plotopt options for plot() method (cell array)

% fast use MEX version of RNE. Can only be set true if the mex

% file exists. Default is true.

%

% Properties (read only)::

%

% n number of joints

% config joint configuration string, eg. 'RRRRRR'

% mdh kinematic convention boolean (0=DH, 1=MDH)

% theta kinematic: joint angles (1xN)

% d kinematic: link offsets (1xN)

% a kinematic: link lengths (1xN)

% alpha kinematic: link twists (1xN)

%

% Overloaded operators::

% R1*R2 concatenate two SerialLink manipulators R1 and R2

%

% Note::

% - SerialLink is a reference object.

% - SerialLink objects can be used in vectors and arrays

3、兩個類瞭解後便可建立我哦們的模型,首先列出自己所用機器人的D-H引數表

i

theta

d

a

alpha

1

theta1

0

3

-pi/2

2

theta2

0

6.4

0

3

theta3

0

5.5

0

4

theta4

2.5

5.5

0

4、根據D-H表列出

L1 = Link('d', 0, 'a', 3, 'alpha', -pi/2);

L2 = Link('d', 0, 'a', 6.4, 'alpha',0);

L3 = Link('d', 0, 'a', 5.5, 'alpha', 0);

L4 = Link('d', 2.5, 'a', 5.5, 'alpha', 0);

armbot=SerialLink([L1,L2,L3,L4]); %SerialLink 機器人

armbot.name = 'ArmBot';

armbot.comment = 'shaynerain';

armbot.display(); %列印

theta = [0,0,0,0];

armbot.plot(theta); %顯示

本篇至此