My MetLab program works properly when the angle is in radians and thus I call the code and sin function in the code below I do When angles are in degree and thus I call cosd and sind, my program does not work as expected. The initial configuration of the robot manipulator%% 7DOF (degree of independence) - 1 prismatic, 6 rebel% vector curi indicates these dof% indexes: d = gd (1), q1 = Qd (2), ..., q6 = qd (7) qd (1) = 1; % D = 1 m qd (2) = pi / 2; % Q1 = 90 degrees qd (3: 6) = 0; % Q2 = ... = q6 = 0 degree qd (7) = -pi / 2; % The initial state of each joint - the tool manipulates different% sinusoids and cosines calculate [c, s] = sinCos (qd (2: length (qd));
And here is the sinCos code
function [c, s] = sinCos (angle) takes the row array of angles in degrees and gives it to everyone Is% sin (angle (1) + angle (2) + ... + angle (i)) and% cos (angle (1) + angle (2) + ... + angle (i) where% 1 and Lieutenant; = I and lt; = Length (angle) yoga = 0; S = zero (1, length (angle)); Speed c =% preallocate for zero (1, length (angle)); I = for 1: length (angle) sum = sum + angle (i); S (i) = sin (zodiac); % S (i) = sin (angle (1) + ... + angle (i)) c (i) = cos (yoga); % C (i) = cos (angle (1) + ... + angle (i))% end for% end function The entire program is ~ 700 lines, so I showed Only the above mentioned part of my program signals the speed of an unnecessary robot which tries to reach a goal while avoiding two obstacles.
So my problem is related to Cos and the Universe? What and cosd is a different behavior that affects my program? Or have I got a bug in my program that is detected?
By the difference, do you mean something on order less than 00001? Because floating point arithmetic errors can cause very small errors to be waived. Computers are not able to accurately calculate decimal numbers because they are able to store them. This is for the reason that you do not compare two floating-point numbers directly; A chain permit should be allowed for error You can read more about this here:
If your error is .0001 or greater, then you can search for a bug in your program . If you are not already using Matlab to convert units, consider doing so that it can eliminate many 'clear' errors (and in some cases precision increases).
Comments
Post a Comment