最近准备研究下机械臂的你运动分析,本文记录相关过程。
研究机械臂必不可少的就是建立模型进项测试分析,不可能直接用实物测试。本文将采用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 3×1
% I dynamic: link inertia matrix, symmetric 3×3, 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参数确定方法在上一篇博客中,请自行查看
2、SerialLink类。
% 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 (4×4 homog xform)
% tool robot’s tool transform, T6 to tool tip (4×4 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); %显示