clc;
clear all;
% theta d a alpha
L1 = Link([0 1.38 0 pi/2]);
L2 = Link([0 0 1.35 0]);
L3 = Link([0 0 1.47 pi/2]);
L4 = Link([0 0 0 0]);
% Define the range of joint angles
L1.qlim = [deg2rad(-90) deg2rad(90)];
L2.qlim = [deg2rad(-30) deg2rad(55)];
L3.qlim = [deg2rad(-40) deg2rad(60)];
L4.qlim = [deg2rad(-90) deg2rad(90)];
L1.offset = pi;
L2.offset = 2*pi/3;
L3.offset = pi/2;
% Connecting link%
dobot = SerialLink([L1 L2 L3 L4],'name','Dobot');
dobot.teach();
% Set five points in space
T1=transl(2,0,2.38);
T2=transl(2.5,1,1.13);
T3=transl(2,-1.5,2.38);
T4=transl(2,-1.5,1.13);
T5=transl(2.6,0,1.38);
% straight lines between points
TT0=ctraj(T1,T2,50);
TT1=ctraj(T2,T3,50);
TT2=ctraj(T3,T4,50);
TT3=ctraj(T4,T5,50);
% Using the transl function to find the position information in the transformation matrix
Tj0=transl(TT0);
Tj1=transl(TT1);
Tj2=transl(TT2);
Tj3=transl(TT3);
% Merger all trajectories
Tj=[Tj0;Tj1;Tj2;Tj3];
qq = mstraj(Tj,[1,1,1],[],[],1,10);
TTT=transl(qq);
plot(qq)
plot3(Tj(:,1),Tj(:,2),Tj(:,3),'r','linewidth',3);%Show end trajectory
grid on;
% Define the size of the 3D space (range of X Y Z)
axis([-5 5 -5 5 -6 6]);
% Convert trajectory points into dobot joint angles using the inverse solution function
q0 = dobot.ikine(TT0,'mask',[1 1 1 0 0 1]);
q1 = dobot.ikine(TT1,'mask',[1 1 1 0 0 0]);
q2 = dobot.ikine(TT2,'mask',[1 1 1 0 0 0]);
q3 = dobot.ikine(TT3,'mask',[1 1 1 0 0 0]);
hold on;
% Splice all joint corners
q=[q0;q1;q2;q3];
% Calculating speed and acceleration
step=50;
qd = zeros(step-1,4);
for i = 2:step
qd(i,1) = q(i,1)-q(i-1,1);
qd(i,2) = q(i,2)-q(i-1,2);
qd(i,3) = q(i,3)-q(i-1,3);
end
qdd = zeros(step-2,4);
for i = 2:step-1
qdd(i,1) = qd(i,1)-qd(i-1,1);
qdd(i,2) = qd(i,2)-qd(i-1,2);
qdd(i,3) = qd(i,3)-qd(i-1,3);
end
% Dobot movement according to joint angle
dobot.plot(q);
hold on;
plot3(Tj(:,1),Tj(:,2),Tj(:,3),'r','linewidth',3);%Show end trajectory
hold on;
figure(2)
subplot(2,2,2)
plot3(Tj(:,1),Tj(:,2),Tj(:,3),'r','linewidth',3);%Show end trajectory
grid on;
subplot(2,2,1)
plot(q);
legend('joint1','joint2','joint3','joint4')
grid on;
title('Position');
subplot(2,2,3)
plot(qd);
legend('joint1','joint2','joint3','joint4')
grid on;
title('Speed');
subplot(2,2,4)
plot(qdd);
legend('joint1','joint2','joint3','joint4')
grid on;
title('Acceleration');
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
以 Dobot Mangician 四自由度机械臂为例。实验研究了机器人的运动学和轨迹规划问题。为了实现对 Dobot 机械臂的运动学控制,采用了 Denavit-Hartenberg (D-H)建模方法来建立 Dobot 机械臂的运动学模型。其运动学正解和逆解是利用机械臂的奇偶变换矩阵获得的矩阵得到运动学正解和反解;并使用机器人工具箱对 Dobot 机械臂进行轨迹规划仿真。使用机器人工具箱对 Dobot 机械臂进行轨迹规划仿真。在本实验中,将使用 Matlab Robotics Toolbox和Dobot Mangician功能。
资源推荐
资源详情
资源评论
收起资源包目录
dobot1.zip (6个子文件)
dobot1
新建文件夹
ForwardandInversekinematics.m 743B
Trajectoryplanning.m 2KB
workspace.m 1KB
Forwardkinematic.m 1KB
model.m 641B
Inversekinematic.m 744B
共 6 条
- 1
资源评论
- robot_lll2024-04-14#内容详尽 #完美解决问题
TENET-
- 粉丝: 1526
- 资源: 17
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功