遨博I20协作臂关节逆解组Matlab可视化

AUBO I20协作臂关节逆解组Matlab可视化


前言

注意:请预先配置好Matlab和RTB机器人工具箱环境,本文使用matlab2022b和RTB10.04版本

工作需要,使用matlab实现对六轴机械臂的逆解八组解数据可视化。本文针对遨博AUBO I20型号的协作臂进行处理。


提示:以下是本篇文章正文内容,下面案例可供参考

1、RTB使用注意点

当图形需要显示多个机器人或者多个不同关节角时,每个plot都需要一个唯一的名称,否则,只会显示同名的最新一组调用plot的关节角。例如,现在针对同一个DH参数的臂型,有两组关节角希望显示出来,那么应该这么写才正确

matlab 复制代码
joints_type1 = [a1 b1 c1 d1 e1 f1];
joints_type2 = [a2 b2 c2 d2 e2 f2];

% robot1和robot2调用SerialLink创建时使用用一组DH参数L
% 'name'参数需要不同,作为区分。
robot1.plot(joints_type1);
hold on;
robot2.plot(joints_type2);

如果使用错误的写法,自始至终只有一个robot变量,即:

matlab 复制代码
joints_type1 = [a1 b1 c1 d1 e1 f1];
joints_type2 = [a2 b2 c2 d2 e2 f2];

robot1.plot(joints_type1);
hold on;
robot1.plot(joints_type2);

最终的效果,可以看到两个plot都是joints_type2的数据,即便是已经使用了hold on,这个问题和RTB的内部plot函数实现逻辑有关联;

2、代码与效果

2.1、完整代码

代码如下:

matlab 复制代码
clear;
clc;
warning off

% 定义连杆的DH参数
%             theta       d         a       alpha     sigma     offset
L(1) = Link([    0     0.1855      0         0          0         pi      ],'modified'); 
L(2) = Link([    0     0.177       0       -pi/2        0       -pi/2     ],'modified');
L(3) = Link([    0       0       0.803       pi         0          0      ],'modified');
L(4) = Link([    0       0       0.72        pi         0       -pi/2     ],'modified');
L(5) = Link([    0     0.127       0       -pi/2        0          0      ],'modified');
L(6) = Link([    0     0.1063      0        pi/2        0          0      ],'modified');
 
% 限制转动角度
L(1).qlim=[-359,359]/180*pi;
L(2).qlim=[-174,174]/180*pi;
L(3).qlim=[-174,174]/180*pi;
L(4).qlim=[-174,174]/180*pi;
L(5).qlim=[-174,174]/180*pi;
L(6).qlim=[-359,359]/180*pi;

aubo_robots = struct();
aubo_robots_num = 8;
robot_name_prefix = 'I20-';

% 创建机器人模型
for i = 1 : aubo_robots_num
    aubo_robots.(sprintf('robot%d', i)) = SerialLink(L, 'name', [robot_name_prefix, num2str(i)]);
    aubo_robots.(sprintf('robot%d', i)).base = transl(0, 0, 0);
    % 可选:显示D-H参数
    % aubo_robots.(sprintf('robot%d', i)).display();
end

% 逆解组的八组关节角
joints = struct();
joints.type1 = [0.412302 -1.365035 -0.573020 2.362811 -1.570796 -2.729291];
joints.type2 = [0.412302 -0.824124 0.573020 2.967940 -1.570796 -2.729291];
joints.type3 = [0.412302 -1.581334 -1.239168 -1.228631 1.570796 0.412302];
joints.type4 = [0.412302 -0.419871 1.239168 0.088243 1.570796 0.412302];
joints.type5 = [-3.029190 0.419871 -1.239168 -0.088243 -1.570796 0.112402];
joints.type6 = [-3.029190 1.581334 1.239168 1.228631 -1.570796 0.112402];
joints.type7 = [-3.029190 0.824124 -0.573020 -2.967940 1.570796 -3.029190];
joints.type8 = [-3.029190 1.365035 0.573020 -2.362811 1.570796 -3.029190];

% 分为二行四列的子图显示
for i = 1:aubo_robots_num
    row = ceil(i / 4) - 1;
    col = mod(i - 1, 4) + 1;
    subplot(2, 4, row * 4 + col);
    aubo_robots.(sprintf('robot%d', i)).plot(joints.(sprintf('type%d', i)), 'view', [51, 38]);
    hold on;
end
hold off;
grid on;

2.2、运行效果

运行效果截图:

总结

八组解可视化,可以看出对应 左/右手位 * 肘关节高/低于髋关节 * 腕关节是否翻转。想起高中时数学老师常说的一个词 数形结合 ,可视化确实方便了不少对数据的分析。

相关推荐
我命由我123452 分钟前
SSL 协议(HTTPS 协议的关键)
网络·经验分享·笔记·学习·https·ssl·学习方法
吱吱鼠叔2 小时前
MATLAB数据文件读写:2.矩阵数据读取
数据库·matlab·矩阵
数据分析螺丝钉2 小时前
力扣第240题“搜索二维矩阵 II”
经验分享·python·算法·leetcode·面试
橙意满满的西瓜大侠2 小时前
matlab入门学习(二)矩阵、字符串、基本语句、函数
matlab
LHNC3 小时前
2024.9.29 问卷数据分析
数据分析
云端奇趣3 小时前
探索 3 个有趣的 GitHub 学习资源库
经验分享·git·学习·github
知识分享小能手3 小时前
mysql学习教程,从入门到精通,SQL 修改表(ALTER TABLE 语句)(29)
大数据·开发语言·数据库·sql·学习·mysql·数据分析
万界星空科技4 小时前
界星空科技漆包线行业称重系统
运维·经验分享·科技·5g·能源·制造·业界资讯
IG工程师4 小时前
关于 S7 - 1200 通过存储卡进行程序更新
经验分享·笔记·自动化
kuan_li_lyg5 小时前
MATLAB - 机械臂手眼标定(眼在手内) - 估计安装在机器人上的移动相机的姿态
开发语言·人工智能·matlab·机器人·ros·机械臂·手眼标定