Not sure why I get this error: Error using SerialLink/fkine (line 84) q must have 4 columns Error in fedr (line 36) T = robo.fkine(qn);

26 次查看(过去 30 天)
%%I should get a value of less than 2 when running the program
function err = dhobjective1 (para)
%initial error is zero
robo = [0 0 0 0]; %robot to pass new parameters
%disturbing the parameters
d1 = 0;
a1 = 7.5;
a2 = 3.0;
d2 = 10;
d4 = 0.7;
a4 = 1;
para = [d1 a1 d2 a2 d4 a4];
L(1) = Link([pi/2 para(2) para(1) 0]);
%L1.qlim = [0, pi];
L(2) = Link([pi/2 para(4) para(3) 0]);
%L2.qlim = [0, pi];
L(3) = Link([0 0 0 -pi/2]);
%L3.qlim = [0, pi];
%L(4) is the end effector where the pen attaches
L(4) = Link([10 para(5) para(1) 10]);
%L4.qlim = [0, pi];
robo = SerialLink(L, 'name', 'robo');
data = [0 180 8; 0 135 14.5; 45 135 14.5;...
45 180 8.5; 90 180 8.5];
% robo.base = [0 2 0 0];
%open file of precompute values
err = 0;
for i = 1:5
qn = data(i,1:2);
dist = data(i, 3);
T = robo.fkine(qn);
Ndist = sqrt((T.t(1).^2) + (T.t(2).^2) + (T.t(3).^2));
%compute error
Eerr = abs(dist - Ndist);
err = err + Eerr;
end
err = err/5;
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Robotics 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by