当前位置:   article > 正文

关于珞石机器人二次开发SDK的posture函数的算法RX RY RZ纠正 C#

关于珞石机器人二次开发SDK的posture函数的算法RX RY RZ纠正 C#

在珞石SDK二次开发的函数钟,获取当前机器人位姿的函数posture函数在输出时会发现数据不正确,与示教器数据不一致。

其中第一个数据正确 第二三各数据为相反 第四五六各数据为弧度制

转换方法为(弧度/PI)*180度

然后发现第四个数据还要加上180度

第五六各数据要取反,,所以设计了以下代码

  1. void(){
  2. ErrorCode ec;
  3. Lamp1.IsHighlight = robot.getDO(1, 1, out ec);
  4. Lamp2.IsHighlight = robot.getDO(1, 11, out ec);
  5. Lamp3.IsHighlight = robot.getDO(1, 12, out ec);
  6. Lamp4.IsHighlight = robot.getDO(1, 13, out ec);
  7. Lamp5.IsHighlight = robot.getDO(1, 14, out ec);
  8. Lamp6.IsHighlight = robot.getDO(1, 15, out ec);
  9. Lamp7.IsHighlight = robot.getDO(1, 16, out ec);
  10. //创建新数组保存数据
  11. double[] aa=new double[6];
  12. aa[0] = robot.posture(CoordinateType.endInRef, out ec)[0]*1000;//TX
  13. aa[1] = -robot.posture(CoordinateType.endInRef, out ec)[1] * 1000;//TY
  14. aa[2] = -robot.posture(CoordinateType.endInRef, out ec)[2] * 1000;//TZ
  15. aa[3] = robot.posture(CoordinateType.endInRef, out ec)[3];//RX
  16. aa[4] = robot.posture(CoordinateType.endInRef, out ec)[4];//RY
  17. aa[5] = robot.posture(CoordinateType.endInRef, out ec)[5];//RZ
  18. double pi = 3.14159265354;
  19. double rad = 180;
  20. //二次转换
  21. aa[3]= 180+(aa[3]*rad)/pi;
  22. aa[4]= -(aa[4]*rad)/pi;
  23. aa[5]= -(aa[5]*rad)/pi;
  24. label1.Text = "当前位置:"+aa[0].ToString("0.000")+','+aa[1].ToString("0.000") + ',' + aa[2].ToString("0.000") + ',' + aa[3].ToString("0.000") + ',' + aa[4].ToString("0.000") + ',' + aa[5].ToString("0.000");
  25. label2.Text = "坐标系:" + String.Join(",",robot.baseFrame(out ec));
  26. label3.Text = "关节位置:" + String.Join(",",robot.jointPos(out ec));
  27. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/酷酷是懒虫/article/detail/879159
推荐阅读
相关标签
  

闽ICP备14008679号