Index in position 1 is invalid. Array indices must be positive integers or logical values.

1 vue (au cours des 30 derniers jours)
Hi everyone, I am getting the following error,
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Error in reversepuma (line 44)
c71 = dot(S7_f, S1_f)
lin44: c71 = dot(S7_f, S1_f)
I created a function to give 6 outputs based on 4 inputs ,( Reverse kinematic analysis)
To test the function i gave some sample values and i got that error,
Any help would be greatly appreciated ,
TIA
%close-the-loop analysis of Puma Robot
%Following paramters are given
%function [a71, S7, S1, al71, th7, gam1] = close_loop_puma ( P_tool_6, P_tool_f, S6_f , a67_f)
P_tool_6 = [5; 3; 7];
P_tool_f = [ 25; 23; 24];
S6_f = [ 0.177; 0.884; -0.433];
a67_f = [-0.153; 0.459; 0.875];
S1_f = [ 0; 0; 1];
P_x = P_tool_6(1)
P_y = P_tool_6(2)
P_z = P_tool_6(3)
a56 = 0
%Twist angle
al12 = 90
al23 = 0
al34 = 270
al45 = 90
al56 = 90
%Joint Offset
S2 = 5.9
S3 = 0
S4 = 17
S5 = 0
R6_f = [ a67_f cross(S6_f, a67_f) S6_f]
P_6orig_f = P_tool_f -(P_x * a67_f)-cross(P_y*S6_f, a67_f)-P_z*S6_f
T6_f = [ R6_f P_6orig_f ; 0 0 0 1]
%Hypotehtical closure link
S7_f = cross(a67_f, S6_f)
%Determination of close loop parameters
a71_cross = cross(S7_f , S1_f)%crossproduct
premag = a71_cross.*a71_cross %Finding the magnitude of the vector
mag = sqrt( premag(1)+premag(2)+premag(3))%Finding the magnitude of vector
a71_f = a71_cross / mag %unit vector
%twist angle
c71 = dot(S7_f, S1_f)
s71 = dot(cross(S7_f,S1_f),a71_f)
al71= atan2(s71,c)
%Joint angle
c7 = dot(a67_f,a71_f)
s7 = dot(cross(a67_f,a71_f),S7_f)
th7 = atan2(s7,c7)
%The angle gam1 is t n e angle between the vector a7i and the X axis of the fixed coordinate system
cos(gam1) = dot( a71_f, [1;0;0])
sin(gam1) = dot(cross(a71_f, [1; 0; 0]), S1_f)
gam1 = atan2( sin(gam1), cos(gam1))
S7 = (dot(cross(S1_f,P_6orig_f),a71_f))/s71
a71 = (dot(cross(P_6orig_f,S1_f),S7_f))/s71
S1 = (dot(cross(P_6orig_f,S1_f),a71_f))/s71
%end

Réponse acceptée

the cyclist
the cyclist le 4 Oct 2019
Just a guess, but I think you probably named a variable dot, which is being used instead of the function you want.
What does
which dot
give as output?
  1 commentaire
Defrauxche
Defrauxche le 4 Oct 2019
Yeah, even after changing the variable name , it was left in the workspace so that caused the error. Thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by