遨博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、运行效果

运行效果截图:

总结

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

相关推荐
GrowingIO技术社区2 小时前
分析云202611发版速览:7大硬核功能重磅升级!
数据分析·运营
仓库日记3 小时前
Excel进销存何时该换?用3项检查判断是否需要软件
经验分享·excel·进销存·开单软件
AI工具挖掘机5 小时前
开源!2个Skill复刻带货视频、图文和Live,做百号矩阵
经验分享
虹科网络安全14 小时前
Redis Radar:在统一视图中掌握 Redis 部署、健康与容量
经验分享·redis·艾体宝·艾体宝it·艾体宝redis
聪明的笨猪猪19 小时前
实际工程问题:AI 生成 Spring Cache(@Cacheable / @CachePut / @CacheEvict)缓存注解踩坑
java·经验分享·面试·ai编程
GrowingIO技术社区19 小时前
留存率怎么算?用户范围、回访行为与时间窗口
数据分析
David猪大卫21 小时前
【C++修炼】map 和 set 的使用
c语言·开发语言·数据结构·c++·经验分享·笔记·学习
爱分享的康康1 天前
车载服务器如何选型|康谋自动驾驶实车测试硬件评估指南
经验分享·车载系统
yuenineon1 天前
智能体加 RPA 能提升效率吗?企业智能体(腾讯workbuddy+金智维RPA)先看任务、流程和维护成本
经验分享
虹科网络安全1 天前
Search on Flex:用分层存储承载更大规模的 Redis 搜索索引
经验分享·redis·艾体宝·艾体宝it