六自由度机械臂的正运动学解with RTB

       本文采用机械人工具箱(RTB),通过MDH法建立坐标参数表并计算正运动学。基于工具箱生成的三维图与自己建立的坐标系初始状态比对,进一步验证正确性。


                                                                               图1 坐标系及参数表


matlab代码:

function MyCoordinateARM6RPart
%计算操作臂部分坐标系并验证
%工具:RobotToolBox V9.10
%时间:2019/1/30
%更新:2019/

%%
%parameters of coordinate
clear all; 
clc;
tic
%****************************************************
d1=0.50;d5=0.45;d6=0.20;
a2=0.4; a3=0.35; a6=0.55;
alpha1=pi/2;alpha4=pi/2; alpha5=pi/2;
%****************************************************
%%
%MDH coordinate
%         θ    d   a    α       offset  
L(1)=Link([0   d1   0    0          0  ],'modified');
L(2)=Link([0   0    0    alpha1     0  ],'modified');
L(3)=Link([0   0   a2    0          0  ],'modified');
L(4)=Link([0   0   a3    0          0  ],'modified');
L(5)=Link([0   d5   0    alpha4     0  ],'modified');
L(6)=Link([0   d6   0    alpha5     0  ],'modified');
L(7)=Link([0   0   a6     0         0  ],'modified');

%%
%posture
qr=[0 0 0 pi/2 0 pi/2 0] ;  % ready
qu=[0 pi/3 -pi/6 5*pi/9 -3*pi/4 pi/2 0]; % standup 
%%
%display table of MDH
robot=SerialLink(L,'name','robot6R','manufacturer','Unimation','comment','AK&B');
robot.display();  %display MDH table

%%
%in workspace display climb
% robot.fkine:forward compute of kinematics 
% robot.plot :plot state
%qr:robot posture of ready
%qu:robot posture of standup
robot.fkine(qr) %zero
robot.plot(qr); %ready

robot.fkine(qu); 
robot.plot(qu); %standup
%%
%inverse kinematics 
%ikine6s:only adapt have a sphere wrist joint robot and only standard DH 
%ikine :suit for general joint

%%
%jtraj: Compute a joint space trajectory between two configurations;
%       A quintic (5th order) polynomial is used with default zero boundary
%       conditions for velocity and acceleration.
% qd:velocity
% qdd:acceleration
% N=100;
% [q,qd,qdd]=jtraj(qr,qu,N);

t=0:0.01:1;
[q,qd,qdd]=jtraj(qr,qu,t);
plot(t,qd,t,qdd); 

T=robot.fkine(q);  %transform Matrix of the endcoordinate respacts to basementCoordinate
plot3(squeeze(T(1,4,:)),squeeze(T(2,4,:)),squeeze(T(3,4,:)));
hold on;
robot.plot(q);

%compute Jacobian matrix
% J=robot.jacob0(qr);
%compute torque of joints
% tao=robot.jacob0(qr)'*[0 0 20 0 0 0]'
%%
teach(robot)

%%
tic;
end

代码生成结果:

1.代码生成参数表


 

 

2.坐标验证段图像


3.轨迹规划示教段图像


4.两处位置的正运动解

qr:起始时刻工具端坐标位置

qr=

    1.0000         0    0.0000    1.7500
   -0.0000   -0.0000    1.0000    0.2000
         0   -1.0000   -0.0000    0.5000
         0         0         0    1.0000

qu:终时刻工具端关节坐标位置

qu =

    0.7660   -0.4545    0.4545    1.3601
    0.0000   -0.7071   -0.7071   -0.1414
    0.6428    0.5417   -0.5417    1.5559
         0         0         0    1.0000


总结

        MDH建立坐标系的时候尤其注意Z轴与X轴关系,同时在建系的过程中时刻想着二者是如何绕着旋转的会简化操作和理解。同时,MDH是建立在坐标系的前端,所以最后一个坐标系其实是控制的最后一个关节处而没有控制到连杆的末端,这样通过增加的关节,也即平移坐标系实现实际工具端的位置。

  • 2
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
对于七自由度机械臂的建模和控制,Matlab是一个非常强大的工具。你可以使用Matlab的机器人工具箱(Robotics Toolbox)来实现相关功能。以下是一些基本的步骤: 1. 首先,安装并加载Matlab的机器人工具箱。 ```matlab addpath('路径/robotics-toolbox'); % 添加机器人工具箱的路径 startup_rtb % 启动机器人工具箱 ``` 2. 创建机器人模型。你可以使用已经定义好的机器人模型,也可以根据自己的需求创建。下面是一个创建七自由度机械臂模型的示例: ```matlab L1 = Link([0 0 0 pi/2]); % 前三个参数分别为a alpha d,最后一个参数为theta初始值 L2 = Link([0 0 0 -pi/2]); L3 = Link([0 0 0 pi/2]); L4 = Link([0 0 0 -pi/2]); L5 = Link([0 0 0 pi/2]); L6 = Link([0 0 0 -pi/2]); L7 = Link([0 0 0 0]); robot = SerialLink([L1 L2 L3 L4 L5 L6 L7], 'name', '七自由度机械臂'); ``` 3. 通过运动学计算机械臂的末端位置。可以使用机器人模型的`fkine`方法。 ```matlab T = robot.fkine(q); % q为机械臂关节角度 ``` 4. 通过逆运动学控制机械臂。可以使用机器人模型的`ikine`方法。 ```matlab q = robot.ikine(T, q0); % T为目标末端位置,q0为机械臂当前关节角度 ``` 5. 设计控制器来控制机械臂。你可以使用传统的PID控制器或者其他控制算法。 以上只是一些基本的步骤,实际应用中可能还需要考虑到运动规划、碰撞检测等问题。你可以通过查阅Matlab的机器人工具箱文档来进一步了和学习。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

easy_R

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值