计算7自由度机器人的工作空间

时间:2019-07-22 18:50:26

标签: matlab matrix robotics kinematics

我正在使用下表中的值生成一个7自由度机械手的工作空间,但是根据我在下面编写的代码,获得的x和y范围似乎不准确,因为该图表明该效应器能够在x和y轴上任一方向移动1000mm-这是不正确的,因为末端执行器只能在x和y轴上任一方向移动约200mm。

DH Parameters for 7DOF robot

我已经实现了生成工作空间的蒙特卡洛方法,但是我不确定这是否是我应该使用的正确方法。是否有其他方法可以计算机器人的运动学?

您能为我提供的任何帮助将不胜感激!

a1 = 0; 
a2_0 = 0;
a2_1 = 40.09;
a2_2 = 144.54;
a2_3 = 182.62;
a2_4 = 516;
a2_5 = 96;
a3_0 = 40.09;
a3_1 = 40.09;
a4 = 0;
a5 = 0;
a6 = 0.91;
a7 = 0.91;
alph1 = pi/2;
alph2_0 = -pi/2;
alph2_1 = 0;
alph2_2 = 0;
alph2_3 = 0;
alph2_4 = 0;
alph2_5 = 0;
alph3_0 = -pi/2;
alph3_1 = -pi/2;
alph4 = 0;
alph5 = pi/2;
alph6 = -pi/2;
alph7 = -pi/2;
alpha1_min = -1.4835298642 + pi/2;
alpha1_max = 1.4835298642 + pi/2;
alpha2_0_min = -0.75049157836 - pi/2;
alpha2_0_max = 0.80285145592 - pi/2;
alpha2_1_min = pi/2;
alpha2_1_max = pi/2;
alpha2_2_min = 0.75049157836 + pi/2;
alpha2_2_max = -0.80285145592 + pi/2;
alpha2_3_min = 0.75049157836 + pi/2;
alpha2_3_max = -0.80285145592 + pi/2;
alpha2_4_min = -0.75049157836;
alpha2_4_max = 0.80285145592;
alpha2_5_min = -0.75049157836 + pi;
alpha2_5_max = 0.80285145592 + pi;
alpha3_0_min = 0;
alpha3_0_max = 0;
alpha3_1_min = 0;
alpha3_1_max = 0;
alpha4_min = -1.5009831567;
alpha4_max = 1.5009831567;
alpha5_min = -1.3962634016 + pi/2;
alpha5_max = 1.3962634016 + pi/2;
alpha6_min = -1.5009831567 + pi/2;
alpha6_max = 1.5009831567 + pi/2;
alpha7_min = -1.5009831567 + pi/2;
alpha7_max = 1.5009831567 + pi/2;
d1 = 0;
d2_0 = 0;
d2_1 = 0;
d2_2 = 0;
d2_3 = 0;
d2_4 = 0;
d2_5 = 0;
d3_0 = 0.0012217304764 - 431.8 + 144.54;
d3_1 = 0.0012217304764;
d4 = 416.2;
d5 = 0;
d6 = 0;
d7 = 0;
N = 20000;
t1 = alpha1_max + (alpha1_max - alpha1_min)*rand(N,1);
t2_0 = alpha2_0_max + (alpha2_0_max - alpha2_0_min)*rand(N,1);
t2_1 = alpha2_1_max + (alpha2_1_max - alpha2_1_min)*rand(N,1);
t2_2 = alpha2_2_max + (alpha2_2_max - alpha2_2_min)*rand(N,1);
t2_3 = alpha2_3_max + (alpha2_3_max - alpha2_3_min)*rand(N,1);
t2_4 = alpha2_4_max + (alpha2_4_max - alpha2_4_min)*rand(N,1);
t2_5 = alpha2_5_max + (alpha2_5_max - alpha2_5_min)*rand(N,1);
t3_0 = alpha3_0_max + (alpha3_0_max - alpha3_0_min)*rand(N,1);
t3_1 = alpha3_1_max + (alpha3_1_max - alpha3_1_min)*rand(N,1);
t4 = alpha4_max + (alpha4_max - alpha4_min)*rand(N,1);
t5 = alpha5_max + (alpha5_max - alpha5_min)*rand(N,1);
t6 = alpha6_max + (alpha6_max - alpha6_min)*rand(N,1);
t7 = alpha7_max + (alpha7_max - alpha7_min)*rand(N,1);

for i = 1:N
    A1 = TransMat(a1,alph1,d1,t1(i));
    A2_0 = TransMat(a2_0,alph2_0,d2_0,t2_0(i));
    A2_1 = TransMat(a2_1,alph2_1,d2_1,t2_1(i));
    A2_2 = TransMat(a2_2,alph2_2,d2_2,t2_2(i));
    A2_3 = TransMat(a2_3,alph2_3,d2_3,t2_3(i));
    A2_4 = TransMat(a2_4,alph2_4,d2_4,t2_4(i));
    A2_5 = TransMat(a2_5,alph2_5,d2_5,t2_5(i));
    A3_0 = TransMat(a3_0,alph3_0,d3_0,t3_0(i));
    A3_1 = TransMat(a3_1,alph3_1,d3_1,t3_1(i));
    A4 = TransMat(a4,alph4,d4,t4(i));
    A5 = TransMat(a5,alph5,d5,t5(i));
    A6 = TransMat(a6,alph6,d6,t6(i));
    A7 = TransMat(a7,alph7,d7,t7(i));
    T = A1 * A2_0 * A2_2 * A2_3 * A2_4 * A2_5 * A3_0 * A3_1 * A4 * A5 * A6 * A7;
    X=T(1,4);
    Y=T(2,4);
    Z=T(3,4);
    plot3(X,Y,Z,'.')
    hold on;
end
view(3);
title('Isometric view');
xlabel('x (mm)');
ylabel('y (mm)');
zlabel('z (mm) ');
% view(2); % top view
% title(' Top view');
% xlabel('x (mm)');
% ylabel('y (mm)');
% view([0 0 1]); % y-z plane
% title('Side view, Y-Z');
% ylabel('y (mm)');
% zlabel('z (mm)');


function [ T ] = TransMat( a,b,c,d )
T = [ cos(d), -sin(d)*cos(b), sin(d)*sin(b), a*cos(d);
      sin(d), cos(d)*cos(b), -cos(d)*sin(b), a*sin(d);
      0, sin(b), cos(b), c;
      0, 0, 0, 1];
end

0 个答案:

没有答案