Inverse Kinematics - Algebraic approach - 6 DOF robotic arm, ERROR: Atan2: Inputs must be real.
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Birdman
2017-12-11
编辑:Birdman
2017-12-11
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Robotics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!