参照下面的果极网的帖子,运行捡硬币程序。
但是不知怎么回事,机械臂的运动和帖子上的"捡硬币"完全不同。
机械臂只是前后来回动,过了很长时间气泵才响。
感觉设置的硬币的坐标,完全没起到作用。
http://m.jiguo.com/mb/article/article/27171.html?from=timeline&isappinstalled=0
Magician 捡硬币程序无法正常运行
dennis
#1
dennis
#2
python的程序如下:
pos=[[250,-65,-35],[250,65,-35],[250,65,-35],[250,65,-35],[250,65,-35],[250,65,-35]]#硬币的坐标
center=[250,0,-35]#放硬币点的坐标[x,y,z]
hight=0;
dType.SetPTPCommonParamsEx(api,20,50,1)#速度设置
print(" set speed ")
dType.SetPTPJumpParamsEx(api,30,100,1)#门高度
print(" set JumpParams ")
dType.SetEndEffectorGripperEx(api, 1, 0)#张开
print(" gripper open ")
dType.SetEndEffectorGripperEx(api, 0, 0)#关
print(" griper close ")
dType.SetPTPCmdEx(api, 0,center[0], center[1], center[2], 0, 1)#门移到中心点
print("move to center")
index = 0
for p in pos:
hight=hight+1.7#1.7为每个硬币的厚度,逐个往上移
index = index+1
dType.SetPTPCmdEx(api, 0, p[0], (p[1]), (p[2]), 0, 1)#移到要拿的硬币处
print(" move to the coin " + str(index))
dType.SetWAITCmdEx(api, 0.1, 1)#等待
print(" wait a sencond ")
dType.SetEndEffectorGripperEx(api, 1, 1)#抓住
print(" catch the coin " + str(index))
dType.SetWAITCmdEx(api, 0.5, 1)#等待
dType.SetPTPCmdEx(api, 0, center[0], center[1], (center[2]+hight), 0, 1)#移动到中心点
print(" move to the center ")
dType.SetWAITCmdEx(api, 0.1, 1)#等待
dType.SetEndEffectorGripperEx(api, 1, 0)#张开
print(" open the gripper ")
dType.SetWAITCmdEx(api, 1, 1)#等待
dType.SetEndEffectorGripperEx(api, 0, 0)#关气泵
print(" close th pump ")
dennis
#3
程序很简单,可是执行的结果却让人不可思议,无法理解。
刚开始的时候,小臂不停的来回前后移动, 过了好半天才执行到第四行"set speed", 之后小臂又像是迷路了一样,前后来回移动。
过了三四分钟,手抓终于抓到了一个硬币,可以之后小臂又像是迷路了一样,前后来回移动。 根本不把硬币放下来。