Warning: Imaginary part is currently ignored.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello !
I am currently making a small program about the movement of a robotic finger (kinematics). This one is for the inverse kinematics
function [T]=anti_kinimatiko(x,y,f)
global l1 l2 l3
f=f*pi/180;
sigma=(x^2+y^2-l3^2-2*l3*(x*cos(f)+y*sin(f)))/2/l1/l2;
q2=atan2(+sqrt(1-sigma^2),sigma);
num1=(y-l3*sin(f))*(l1+l2*cos(q2))-(x-l3*cos(f))*l2*sin(q2);
den=(l1^2+l2^2+2*l1*l2*cos(q2));
num2=(x-l3*cos(f))*(l1+l2*cos(q2))+(y-l3*sin(f))*l2*sin(q2);
q1=atan2(num1/den,num2/den);
q3=f-q1-q2;
%ta kanw apo aktinia se moires
q1=q1*180/pi;
q2=q2*180/pi;
q3=q3*180/pi;
T=[q1 q2 q3]';
kinimatiko(q1,q2,q3)
axis equal
end
where kinimatiko(q1,q2,q3) is another program for the forward kinematics.
When i run the program the problem i take is this ,
Warning: Imaginary part is currently ignored.
Future behavior of ATAN2 with complex inputs may change.
> In anti_kinimatiko at 10"
What does that mean exactly ,what do i have to change to make it work ?
0 commentaires
Réponse acceptée
Jonathan
le 9 Nov 2011
This warning means that one of the inputs to atan2 is imaginary. The two places you use atan2 are extracted below.
q2=atan2(+sqrt(1-sigma^2),sigma);
q1=atan2(num1/den,num2/den);
So, one or more of the arguments to atan2 (namely: +sqrt(1-sigma^2), sigma, num1/den, and num2/den) are imaginary or complex. The most likely candidate is +sqrt(1-sigma^2), since this will be imaginary whenever sigma is greater than 1. Make sure your sigma is properly bounded and try again.
~Jonathan
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Robotics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!