• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Matlab Robotic Toolbox工具箱学习笔记

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

Arm/Robots

机器人是由多个连杆连接而成的,机器人关节分为旋转关节和移动关节。创建机器人的两个最重要的函数是:Link和SerialLink。

1、Link类

一个Link包含了机器人的运动学参数、动力学参数、刚体惯性矩参数、电机和传动参数。

操作函数:

%A               连杆变换矩阵
%  RP            关节类型: 'R' 或 'P'
%  friction      摩擦力
%  nofriction    摩擦力忽略

%  dyn           显示动力学参数
%  islimit       测试关节是否超出软限制
%  isrevolute    测试是否为旋转关节
%  isprismatic   测试是否为移动关节
%  display       连杆参数以表格形式显示
%  char          转为字符串

运动学参数:

%  theta    关节角度
%  d        连杆偏移量
%  a        连杆长度
%  alpha    连杆扭角
%  sigma    旋转关节为0,移动关节为1
%  mdh      标准的D&H为0,否则为1
%  offset   关节变量偏移量

%  qlim     关节变量范围[min max]

动力学参数:

%  m        连杆质量

%  r        连杆相对于坐标系的质心位置3x1

%  I        连杆的惯性矩阵(关于连杆重心)3x3
%  B        粘性摩擦力(对于电机)1x1或2x1
%  Tc       库仑摩擦力1x1或2x1
电机和传动参数:

%  G        齿轮传动比
%  Jm       电机惯性矩(对于电机)

2、SerialLink类

操作函数:

%  plot          以图形形式显示机器人

%  teach         驱动机器人
%  isspherical   测试机器人是否有球腕关节
%  islimit       测试机器人是否抵达关节极限

%  fkine         前向运动学求解
%  ikine6s       6旋转轴球腕关节机器人的逆向运动学求解

%  ikine3        3旋转轴机器人的逆向运动学求解

%  ikine         采用迭代方法的逆向运动学求解

%  jacob0        在世界坐标系描述的雅克比矩阵

%  jacobn        在工具坐标系描述的雅克比矩阵
%  maniplty      可操纵性度

%  jtraj         关节空间轨迹
%  accel         关节加速度
%  coriolis      关节柯氏力

%  dyn           显示连杆的动力学属性
%  fdyn          关节运动

%  friction      摩擦力

%  gravload      关节重力

%  inertia       关节惯性矩阵
%  nofriction    设置摩擦力为0
%  rne           关节的力/力矩

%  payload       在末端坐标系增加负载

%  perturb       随机扰动连杆的动力学参数

属性:
%  links      连杆向量(1xN)
%  gravity    重力的方向[gx gy gz]
%  base       机器人基座的位姿(4x4)
%  tool       机器人的工具变换矩阵[ T6 to tool tip] (4x4)
%  qlim       关节范围[qmin qmax] (Nx2)
%  offset     偏置(Nx1)
%  name       机器人名字(在图形中显示)
%  manuf      注释, 制造商名
%  comment    注释, 总评
%  plotopt    options for plot() method (cell array)
%  n           关节数
%  config      机器人结构字符串, 例如 'RRRRRR'
%  mdh         运动学中约定的布尔数 (0=DH, 1=MDH)

怎样创建一个机器人?

  %Link调用格式:
 %{
             (1) L = Link() 创建一个带默认参数的连杆
             (2)L = Link(L1)复制连杆L1
             (3)L = Link(OPTIONS) 创建一个指定运动学、动力学参数的连杆
            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
            注:不能同时指定“theta”和“d”
               连杆的惯性矩阵(3x3)是对称矩阵,可以写成3x3矩阵,也可以是[Ixx Iyy Izz Ixy Iyz Ixz]
               所有摩擦均针对电机而不是负载
               齿轮传动比只用于传递电机的摩擦力和惯性矩给连杆坐标系。
 %}
%SerialLink调用格式:
 %{     
        (1)R = SerialLink(LINKS, OPTIONS),OPTIONS可以是:'name'、'comment'、'manufacturer'
         'base'、'tool'、'gravity'、'plotopt'
        (2)R = SerialLink(DH, OPTIONS),矩阵DH的构成:每个关节一行,每一行为[theta d a alpha]
         (默认为旋转关节),第五列(sigma)为可选列,sigma=0(默认)为旋转关节,sigma=1为移动关节
       
        (3) R = SerialLink(OPTIONS) 没有连杆的机器人
       
        (4)R = SerialLink([R1 R2 ...], OPTIONS) 机器人连接, 将R2的基座连接到R1的末端.
       
        (5)R = SerialLink(R1, options) 复制机器人R1
%}
 L1 = Link('d', 0, 'a', 1, 'alpha', pi/2);%定义连杆1,没有写theta说明theta为关节变量
 L1.a;%查看a的值
 L1.d;%查看d的值
%还可以L1.RP,L1.display,L1.mdh,L1.isprismatic,L1.isrevolute等等,这样就可以查看一些默认值
 L2 = Link('d', 0, 'a', 1, 'alpha', 0);
 bot = SerialLink([L1 L2], 'name', 'my robot');
 bot.n;%查看连杆数目
 bot.fkine([0.1 0.2]);%前向运动学
 bot.plot([0.1 0.2]);%绘制机器人

定义完连杆和机器人便可以求机器人前和逆向运动学、动力学等等。

L1.参数或属性():查看连杆的参数或属性

L1.操作函数(参数):操作连杆参数

bot.属性():查看机器人的属性

bot.操作函数(参数):操作机器人,可以进行前向、逆向运动学求解等

 

实例:Stanford Manipulator


D-H参数表:

clear;
clc;
 L1 = Link('d', 0, 'a', 0, 'alpha', -pi/2);%定义连杆
 L2 = Link('d', 1, 'a', 0, 'alpha', pi/2);
 L3 = Link('theta', 0, 'a', 0, 'alpha', 0);
 L4 = Link('d', 0, 'a', 0, 'alpha', -pi/2);
 L5 = Link('d', 0, 'a', 0, 'alpha', pi/2);
 L6 = Link('d', 1, 'a', 0, 'alpha', 0);
 bot = SerialLink([L1 L2 L3 L4 L5 L6]);%连接连杆
 bot.display();%显示D-H参数表
 forward_kinematics=bot.fkine([-0.2 0.1 10 0.1 1 2])%前向运动学


求解Stanford arm在世界坐标系描述的雅克比矩阵

clear;
clc;
clear L
%             th    d       a    alpha
L(1) = Link([ 0     0       0   -pi/2     0]);%定义连杆
L(2) = Link([ 0     1       0    pi/2     0]);
L(3) = Link([ 0     0       0    0        1]);
L(4) = Link([ 0     0       0   -pi/2     0]);
L(5) = Link([ 0     0       0    pi/2     0]);
L(6) = Link([ 0     1       0    0        0]);
bot = SerialLink(L, 'name', 'Stanford arm');%连接连杆
syms theta1 theta2 d3 theta4 theta5 theta6;
J0=vpa(bot.jacob0([theta1 theta2 d3 theta4 theta5 theta6]),4)

求平面二自由度机器人在世界坐标系描述的雅克比矩阵


D-H参数表:


clear;
clc;
clear L
L(1) = Link('d',0,'a','a1','alpha',0,'sym');%定义连杆
L(2) = Link('d',0,'a','a2','alpha',0,'sym');
bot = SerialLink(L, 'name', 'Planar 2-dof robot');%连接连杆
syms theta1 theta2;
J0=bot.jacob0([theta1 theta2]);

J0=simplify(J0)

求得:

J0 =
 
[ - a2*sin(theta1 + theta2) - a1*sin(theta1), -a2*sin(theta1 + theta2)]
[   a2*cos(theta1 + theta2) + a1*cos(theta1),  a2*cos(theta1 + theta2)]
[                                          0,                        0]
[                                          0,                        0]
[                                          0,                        0]
[                                          1,                        1]

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Delphi使用进行post数据时超时设置发布时间:2022-07-18
下一篇:
MATLAB导入数据发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap