MATLAB机器人仿真程序
- 格式:doc
- 大小:26.00 KB
- 文档页数:6
.
精品 附录
MATLAB 机器人工具箱仿真程序:
1)运动学仿真模型程序(Rob1.m)
L1=link([pi/2 150 0 0])
L2=link([0 570 0 0])
L3=link([pi/2 130 0 0])
L4=link([-pi/2 0 0 640])
L5=link([pi/2 0 0 0])
L6=link([0 0 0 95])
r=robot({L1 L2 L3 L4 L5 L6})
=’MOTOMAN-UP6’ % 模型的名称
>>drivebot(r)
2)正运动学仿真程序 (Rob2.m)
L1=link([pi/2 150 0 0])
L2=link([0 570 0 0])
L3=link([pi/2 130 0 0])
L4=link([-pi/2 0 0 640])
L5=link([pi/2 0 0 0])
L6=link([0 0 0 95])
r=robot({L1 L2 L3 L4 L5 L6})
=’MOTOMAN-UP6’
t=[0:0.01:10];%产生时间向量
qA=[0 0 0 0 0 0 ]; %机械手初始关节角度
qAB=[-pi/2 -pi/3 0 pi/6 pi/3 pi/2 ];%机械手终止关节角度
figure('Name','up6机器人正运动学仿真演示');%给仿真图像命名
q=jtraj(qA,qAB,t);%生成关节运动轨迹
T=fkine(r,q);%正向运动学仿真函数
plot(r,q);%生成机器人的运动.
精品 figure('Name','up6机器人末端位移图')
subplot(3,1,1);
plot(t, squeeze(T(1,4,:)));
xlabel('Time (s)');
ylabel('X (m)');
subplot(3,1,2);
plot(t, squeeze(T(2,4,:)));
xlabel('Time (s)');
ylabel('Y (m)');
subplot(3,1,3);
plot(t, squeeze(T(3,4,:)));
xlabel('Time (s)');
ylabel('Z (m)');
x=squeeze(T(1,4,:));
y=squeeze(T(2,4,:));
z=squeeze(T(3,4,:));
figure('Name','up6机器人末端轨迹图');
plot3(x,y,z);
3)机器人各关节转动角度仿真程序:(Rob3.m)
L1=link([pi/2 150 0 0 ])
L2=link([0 570 0 0])
L3=link([pi/2 130 0 0])
L4=link([-pi/2 0 0 640])
L5=link([pi/2 0 0 0 ])
L6=link([0 0 0 95])
r=robot({L1 L2 L3 L4 L5 L6})
='motoman-up6'
t=[0:0.01:10];
qA=[0 0 0 0 0 0 ];.
精品 qAB=[ pi/6 pi/6 pi/6 pi/6 pi/6 pi/6];
q=jtraj(qA,qAB,t);
Plot(r,q);
subplot(6,1,1);
plot(t,q(:,1));
title('转动关节1');
xlabel('时间/s');
ylabel('角度/rad');
subplot(6,1,2);
plot(t,q(:,2));
title('转动关节2');
xlabel('时间/s');
ylabel('角度/rad');
subplot(6,1,3);
plot(t,q(:,3));
title('转动关节3');
xlabel('时间/s');
ylabel('角度/rad');
subplot(6,1,4);
plot(t,q(:,4));
title('转动关节4');
xlabel('时间/s');
ylabel('角度/rad' );
subplot(6,1,5);
plot(t,q(:,5));
title('转动关节5');
xlabel('时间/s');
ylabel('角度/rad');
subplot(6,1,6);
plot(t,q(:,6));.
精品 title('转动关节6');
xlabel('时间/s');
ylabel('角度/rad');
4)机器人各关节转动角速度仿真程序:(Rob4.m)
t=[0:0.01:10];
qA=[0 0 0 0 0 0 ];%机械手初始关节量
qAB=[ 1.5709 -0.8902 -0.0481 -0.5178 1.0645 -1.0201];
[q,qd,qdd]=jtraj(qA,qAB,t);
Plot(r,q);
subplot(6,1,1);
plot(t,qd(:,1));
title('转动关节1');
xlabel('时间/s');
ylabel('rad/s');
subplot(6,1,2);
plot(t,qd(:,2));
title('转动关节2');
xlabel('时间/s');
ylabel('rad/s');
subplot(6,1,3);
plot(t,qd(:,3));
title('转动关节3');
xlabel('时间/s');
ylabel('rad/s');
subplot(6,1,4);
plot(t,qd(:,4));
title('转动关节4');
xlabel('时间/s');
ylabel('rad/s' );.
精品 subplot(6,1,5);
plot(t,qd(:,5));
title('转动关节5');
xlabel('时间/s');
ylabel('rad/s');
subplot(6,1,6);
plot(t,qd(:,6));
title('转动关节6');
xlabel('时间/s');
ylabel('rad/s');
5)机器人各关节转动角加速度仿真程序:(Rob5.m)
t=[0:0.01:10];%产生时间向量
qA=[0 0 0 0 0 0]
qAB =[1.5709 -0.8902 -0.0481 -0.5178 1.0645 -1.0201];
[q,qd,qdd]=jtraj(qA,qAB,t);
figure('name','up6机器人机械手各关节加速度曲线');
subplot(6,1,1);
plot(t,qdd(:,1));
title('关节1');
xlabel('时间 (s)');
ylabel('加速度 (rad/s^2)');
subplot(6,1,2);
plot(t,qdd(:,2));
title('关节2');
xlabel('时间 (s)');
ylabel('加速度 (rad/s^2)');
subplot(6,1,3);
plot(t,qdd(:,3));
title('关节3');.
精品 xlabel('时间 (s)');
ylabel('加速度 (rad/s^2)')
subplot(6,1,4);
plot(t,qdd(:,4));
title('关节4');
xlabel('时间 (s)');
ylabel('加速度 (rad/s^2)')
subplot(6,1,5);
plot(t,qdd(:,5));
title('关节5');
xlabel('时间 (s)');
ylabel('加速度 (rad/s^2)')
subplot(6,1,6);
plot(t,qdd(:,6));
title('关节6');
xlabel('时间 (s)');
ylabel('加速度 (rad/s^2)')
如有侵权请联系告知删除,感谢你们的配合!