MATLAB robot toolbox 机械臂轨迹规划

来源:互联网 发布:淘宝网第三方支付平台 编辑:程序博客网 时间:2024/05/01 20:28
%机器人构建  clc; clear;  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}); r.name='MOTOMAN-UP6';% 模型的名称 %drivebot(r) 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);  

1 0