Inverse Kinematics - Algebraic approach - 6 DOF robotic arm, ERROR: Atan2: Inputs must be real.

2 visualizzazioni (ultimi 30 giorni)
Hey guys, read a lot about this error but I guess the root cause of this issue is the calculation itself. And I don't know how to move forward...
I am calculating theta1, theta3 and then theta2: a2=10; a3=8.5; d3=5; d4=5.5;
%
%
%Theta1
theta1=atan2(py,px)-atan2(d3,sqrt(px*px +py*py-d3*d3));
K=(px*px+py*py+pz*pz-a2*a2-a3*a3-d3*d3-d4*d4)/(2*a2);
%
%
%Theta3
theta3=atan2(a3,d4)-atan2(K,-sqrt(a3*a3+d4*d4-K*K));
By using my variables (DH parameters), all positive values in that case, i'm getting the error: Error using atan2: inputs must be real.
This data will lead for a solution for K=995.0281 Changing the inputs to 1, 0.85, 0.5, 0.55 does not make any difference, although: K=1.0063e+04
I am new to the world of MATLAB and assistance is appreciated! Cheers
  4 Commenti

Accedi per commentare.

Risposta accettata

Birdman
Birdman il 11 Dic 2017
Modificato: Birdman il 11 Dic 2017
The problem arises from the statement
sqrt(a3*a3+d4*d4-K*K)
because the argument is negative which is
-6.5598e+06
and which will end up a complex number.
Therefore, you might want to look at that part again. Maybe there is some kind of miscalculation.
If you change theta3 calculation to the following, you get pi/4.
theta3=atan2(a3,d4)-atan2(K,sqrt(abs(a3*a3+d4*d4-K*K)));
  2 Commenti
Uede Max
Uede Max il 11 Dic 2017
Modificato: Uede Max il 11 Dic 2017
Thanks! Formula seems to be alright, though. Too bad, need to re-think the approach.
thank you!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by