How to shorten these values?
When I individually run sin(theta1) and such functions, it would give me the correct value as a zero or a one (the angles I am working with are 0 or 90 degrees)
In some cases they may go on to be values like 1.574.
I know there is a round off function in MATLAB, but then I would have to add that function to every element individually. Is there any easier way to achieve this?
PS.: ST stands for sin(Theta) SA for Sin(Alpha) CA for cos(Alpha) and so on..
PPS. : I tried eval function, not working at all.
Edit 1: The code I am using is as follows:
init_lib; clc; load_robot; syms q1 q2 q3 q4 q5; %DH Parameters for the robot: robot.DH.theta= '[pi/2 pi/2 0 q(4) q(5)]'; robot.DH.d='[q(1) q(2) q(3) 0.1 0.020]'; robot.DH.a='[0 0 0 0 0]'; robot.DH.alpha= '[pi/2 pi/2 0 pi/2 0]'; % We input the joint parameters: q = [q1 q2 q3 q4 q5]; %Storing the evaulated values of 'q' Theta=eval(robot.DH.theta); d=eval(robot.DH.d); a=eval(robot.DH.a); alpha=eval(robot.DH.alpha); A01=dh(Theta(1), d(1), a(1), alpha(1)); A12=dh(Theta(2), d(2), a(2), alpha(2)); A23=dh(Theta(3), d(3), a(3), alpha(3)); A34=dh(Theta(4), d(4), a(4), alpha(4)); A45=dh(Theta(5), d(5), a(5), alpha(5)); A05 = A01*A12*A23*A34*A45; disp(A05);
Where, dh is a function that comes from a predefined library. It basically substitutes the four values into a generalized form of the matrix I posted as the second image.