How to fix Error using atan2 Inputs must be real?
    7 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Konard Adams
 el 26 de En. de 2022
  
    
    
    
    
    Respondida: Konard Adams
 el 27 de En. de 2022
            
Function
function ConcLin = Line(A,B)
%% Linear Moving along desired path
%  **** Linear First Movement ***
% Calling Inverse Kinematics to
%% number of increments 
ResLin = 100;
  %% Equations
DeltaX = (B(1,1) - A(1,1)) / ResLin;
DeltaY = (B(1,2) - A(1,2)) / ResLin;
DeltaZ = (B(1,3) - A(1,3)) / ResLin;
%% Looping through each point of the line
tic;
AnglesLin = zeros(6); %preallocating memory
for f = 1:ResLin
    %% calculating actual point  
   A(1,1) = A(1,1) + DeltaX * f; 
   A(1,2) = A(1,2) + DeltaY * f;
   A(1,3) = A(1,3) + DeltaZ * f;
   AnglesLin(f,:) = IKine(A); 
end
toc
%% Increments of Time
tic;
TimeLin = zeros(1); %preallocating memory
for clockLin = 1:ResLin
    TickTockLin = clockLin*0.1+10;
    TimeLin(clockLin,:) = TickTockLin;
end
toc
%% Concatenating Time & Angles. Time will be the first column
ConcLin = [TimeLin,AnglesLin];
Main
%% Coordinates Input
% LINE desired Paths. If Input method is used, comment out this block of code.
% *****We will define these as one matrix 1x12*****
Lin1 = [750, -75,  670, 0, 0, 1, 0, -1, 0, 1, 0,  0];%A
% Xa = Lin1(1,1);  Ya = Lin1(1,2); Za = Lin1(1,3); 
Lin2 = [750, -75,  550, 0, 0, 1, 0, -1, 0, 1, 0,  0];%B
% Xb = Lin2(1,1);  Yb = Lin2(1,2); Zb = Lin2(1,3);
Lin3 = [750,  75,  550, 0, 0, 1, 0, -1, 0, 1, 0,  0];
Lin4 = [750,  75,  670, 0, 0, 1, 0, -1, 0, 1, 0,  0]; 
Lin5 = [750,   0,  700, 0, 0, 1, 0, -1, 0, 1, 0,  0];
Lin6 = [750,   0,  550, 0, 0, 1  0, -1, 0, 1, 0,  0]; 
%% Calling Linear Motion
ConcLin = Line(Lin1, Lin2);
5 comentarios
  Steven Lord
    
      
 el 26 de En. de 2022
				You're assuming d3/p1 is strictly less than or equal to 1. What guarantee do you have that this is the case?
If it was ever so slightly greater than 1:
d3 = 2;
p1 = 2 - eps(2); % Just barely less than 2
s = (d3/p1)
s > 1 % true
sqrt(1-s^2) % complex
You can use min and max to ensure s is strictly in a desired range.
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
				Más información sobre Point Cloud Processing en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


