hello!!!!
I'm trying to modalise kinematics and dynamics of a scarat 4- DOF (RRPR) with one joint prismatics using toolboxes of Peter Corke.
I don't know how to obtaint dynamics equations with MATLAB and simulate the kinematics.
Thsese are my 2 codes that I have wrote .
the first code this is the error
Error using sym/subsindex (line 769)
Invalid indexing or function definition. When defining a function, ensure that the arguments are symbolic variables and
the body of the function is a SYM expression. When indexing, the input must be numeric, logical, or ':'.
Error in sym/subsref (line 814)
R_tilde = builtin('subsref',L_tilde,Idx);
the second code this the error
Error using tb_optparse (line 303)
unknown options: mask
Error in SerialLink/fkine (line 59)
opt = tb_optparse(opt, varargin);
the first it is to draw et flower and the second is for dynamics

 Respuesta aceptada

Walter Roberson
Walter Roberson el 13 de Feb. de 2020

0 votos

A_02 = simplify( A_01(q1)*A_12(q2));
That returns an array, not a function handle or symbolic function.
A_03 = simplify(A_02(q2)*A_23(d3));
With A_02 being an array, q2 is attempting to index it.
A_02 involves two variables, so I cannot predict which variable you want q2 to substitute for (function handle case.)

8 comentarios

James Patrick
James Patrick el 13 de Feb. de 2020
thank's Mr Roberson
I haved seen my error , I removed q2, q1, d3 in paranthesis and commentry between line 14 to 20 of my code.
after simulation I get thid error
Error using sym/subsasgn (line 853)
SYM objects do not allow nested indexing. Assign intermediate values to variables instead.
Walter Roberson
Walter Roberson el 13 de Feb. de 2020
I need the adjusted code.
James Patrick
James Patrick el 13 de Feb. de 2020
this is the ajusted code
Walter Roberson
Walter Roberson el 13 de Feb. de 2020
Editada: Walter Roberson el 13 de Feb. de 2020
You have
q1.num(:,1) = atan2(s1,c1);
q1 is a symbolic variable, not a structure. You cannot create a field named num for a symbolic variable.
Symbolic variables are "objects" that do have some internal properties, but nothing that can be set by the user.
In particular, this is not Python, and you cannot set the "numeric value" of the symbolic variable to anything.
I would suggest
q1_num(:,i) = atan2(s1,c1);
and likewise for the other variables you try to set .num of -- after all, in a number of other places in the code you are already using _ instead of .
Do watch out that in that particular statement you should be indexing with (:,i) instead of (:,1)
Later you will run into the problem,
prismatic joint 3 has no qlim parameter set, set it or specify 'workspace' plot option
referring to the call
plot(Scarat,[q1_num(1,i),q2_num(1,i),d3_num(1,i),q4_num(1,i)])
When I investigate, I find that Scarat.qlim is a 4 x 2 array in which the third row (corresponding to the prismatic joint) is -inf inf . I also find that the internal routines set the qlim entry to -inf inf in the case of any joint that is not a revolute joint.
If you were to set a qlim for
L(3) = Link([0,0,0,0,1]);
then it looks like it would be copied. So you need to either set qlim there, or else you need to pass the 'workspace' option to plot(Scarat) giving the x and y and z limits of the workspace.
James Patrick
James Patrick el 13 de Feb. de 2020
I have added the notation that you have proposed to me.... And I have defined the workspace of Link(3)
this is i t: L(3).qlim=[0.35 1]; after simulation another comme " Index exceeds matrix dimensions."
thank's for help.
Walter Roberson
Walter Roberson el 13 de Feb. de 2020
Sorry bedtime for me, I will investigate later
James Patrick
James Patrick el 13 de Feb. de 2020
Thank's ...
I have arrange the code like you have told me but the the simulation give me a new error . this is it:
Index exceeds matrix dimensions.
Error in SerialLink/plot>create_robot (line 469)
d = norm( d(4:6)-d(1:3) ) / 72;
Error in SerialLink/plot (line 252)
handle = create_robot(robot, opt);
this is the new code. I think that the error is in the plot
James Patrick
James Patrick el 13 de Feb. de 2020
Thank's for your help it is good now!!!!

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 13 de Feb. de 2020

Comentada:

el 13 de Feb. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by