当前位置:   article > 正文

(6)六轴机械臂的运动学正、逆解_运动学逆解

运动学逆解

下面在前面的ur5机械臂的DH参数基础是对其正逆解进行求解,为了后面能在MATLAB中利用stl文件进行实际显示,这里以标准DH参数为例进行讲解。(修正DH参数在用plot3d函数是显示失败,不知道是不是这个函数只能显示标准dh参数的机械臂模型,有知道的网友可以在评论里告知一下,谢谢。

一、运动学正解:

机器人正运动学是在已知各连杆相对位置关系(关节角)的情况下,得到末端执行器的位姿。在标准DH参数下相邻坐标系之间的齐次变换矩阵为:

 则,正解代码如下:

  1. function [T06,Pos]=ForwardSolver_MDH(theta)
  2. DH_JXB =[90 0 144 0;
  3. 0 264 0 90;
  4. 0 236 0 0;
  5. -90 0 106 -90;
  6. 90 0 114 0;
  7. 0 0 67 0];
  8. d=DH_JXB(1:6,3);
  9. a=DH_JXB(1:6,2);
  10. DH_JXB(1:6,1)=DH_JXB(1:6,1)/180*pi; %度数转化为弧度
  11. alp=DH_JXB(1:6,1);
  12. offset=[0 90 0 -90 0 0];
  13. theta=(theta+offset)*pi/180;
  14. for i=1:6
  15. T{i}=[ cos(theta(i)), -sin(theta(i))*cos(alp(i)), sin(theta(i))*sin(alp(i)), a(i)*cos(theta(i));
  16. sin(theta(i)), cos(theta(i))*cos(alp(i)),
  17. -cos(theta(i))*sin(alp(i)), a(i)*sin(theta(i));
  18. 0, sin(alp(i)), cos(alp(i)), d(i);
  19. 0, 0, 0, 1
  20. ]
  21. end
  22. disp('Homogeneous transformation matrix T06:')
  23. T06=T{1}*T{2}*T{3}*T{4}*T{5}*T{6}
  24. %% 求末端位置
  25. X=T06(1,4);Y=T06(2,4);Z=T06(3,4);
  26. %% 求末端姿态Rotations about X, Y, Z axes (for a robot gripper)
  27. R=T06;
  28. if abs(abs(R(1,3)) - 1) < eps % when |R13| == 1
  29. % singularity
  30. rpy(1) = 0; % roll is zero
  31. if R(1,3) > 0
  32. rpy(3) = atan2( R(3,2), R(2,2)); % R+Y
  33. else
  34. rpy(3) = -atan2( R(2,1), R(3,1)); % R-Y
  35. end
  36. rpy(2) = asin(R(1,3));
  37. else
  38. rpy(1) = -atan2(R(1,2), R(1,1));
  39. rpy(3) = -atan2(R(2,3), R(3,3));
  40. rpy(2) = atan(R(1,3)*cos(rpy(1))/R(1,1));
  41. end
  42. RPY=rpy*180/pi;
  43. Rall=RPY(1);Pitch=RPY(2);Yaw=RPY(3);
  44. Pos=[X,Y,Z,Rall,Pitch,Yaw];
  45. end

这里对姿态的描述进行说明:在MATLAB中RPY欧拉角是世界坐标系下的XYZ欧拉角;

RPY角的定义如下:

 输入端位姿形式为:(x,y,z,\gamma ,\beta ,\alpha )

MATLAB中对应的RPY旋转矩阵如下:

 这是个旋转矩阵,与齐次矩阵中的旋转矩阵等价,所以根据齐次矩阵中的旋转矩阵便可以得到末端的姿态RPY。

二、运动学逆解:

机器人逆运动学是已知机器人末端执行器的位姿,通过变换矩阵T得到机器人各关节的角度。求解逆运动学有解析法、几何法、迭代法。这里介绍解析法。如果机器人末端三轴的轴线始终交于一点则该机器人必有解析解

1、得到齐次变换矩阵:

利用MATLAB求解其齐次变换矩阵:

  1. syms a1 a2 a3 a4 a5 a6 d1 d2 d3 d4 d5 d6 a1p1 a1p2 a1p3 a1p4 a1p5 a1p6 th1 th2 th3 th4 th5 th6;
  2. a=[0 a2 a3 0 0 0];
  3. d=[d1 0 0 d4 d5 d6];
  4. alp=[90 0 0 -90 90 0]*pi/180;
  5. theta=[th1 th2 th3 th4 th5 th6];
  6. % theta(1)=t1;theta(2)=t2;theta(3)=t3;theta(4)=t4;theta(5)=t5;theta(6)=t6;
  7. T01=[ cos(theta(1)), 0, sin(theta(1)), a(1)*cos(theta(1));
  8. sin(theta(1)), 0, -cos(theta(1)), a(1)*sin(theta(1));
  9. 0, 1, 0, d(1);
  10. 0, 0, 0, 1
  11. ];
  12. T12=[ cos(theta(2)), -sin(theta(2)), 0, a(2)*cos(theta(2));
  13. sin(theta(2)), cos(theta(2)), 0, a(2)*sin(theta(2));
  14. 0, 0, 1, d(2);
  15. 0,
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/900373
推荐阅读
相关标签
  

闽ICP备14008679号