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!