如何利用视觉施教机械手工具坐标
1.未建立标定之前做工具坐标(假设是下方影像)
a.利用工具向导
1.移动机械手使工具呈现在视野中,让视觉对工具末端做简单处理(例如工具末端是圆则抓取圆
心并捕获对应像素)。
2.按照工具向导在 tool 0 下旋转任意度数,只通过移动 xy 使根据末端像素与之前重合即可制作出
工作坐标。
b.不利用工具向导
1.移动机械手使工具呈现在视野中,让视觉对工具末端做简单处理(例如工具末端是圆则抓取圆
心并捕获对应像素),将该点在 tool 0 下施教为 p1。
2. 在 tool 0 下旋转任意度数,只通过移动 xy 使根据末端像素与之前重合, 将该点在 tool 0 下施教为
p2.
3.运行以下程序即可获取对应工具坐标
'Tool_Num 为设定工具坐标时的工具编号。
'Point1_Number 为第一个 TOOL 0 坐标下保存的第一个点的点编号
'Point2_Number 为第二个 TOOL 0 坐标下保存的第二个点的点编号
Function CalcToolCoordTwoPoint(Tool_Num As Integer, Point1_Number As Integer, Point2_Number As
Integer)
Real Line1, theta, Line2, line3, Coor_X, Coor_Y, xTool, yTool, rTool
Line1 = Dist(P(Point1_Number), P(Point2_Number)) / 2
theta = (CU(P(Point1_Number)) - CU(P(Point2_Number))) / 2
Line2 = Line1 / Sin(DegToRad(theta))
Line1 = CX(P(Point1_Number)) - CX(P(Point2_Number))
line3 = CY(P(Point1_Number)) - CY(P(Point2_Number))
theta = Atan2(Line1, line3) - DegToRad(90 - theta)
xTool = Cos(theta) * Line2
yTool = Sin(theta) * Line2
theta = Atan2(xTool, yTool)
theta = theta - DegToRad(CU(P(Point1_Number)))
rTool = Sqr(xTool * xTool + yTool * yTool)
xTool = Cos(theta) * rTool
yTool = Sin(theta) * rTool
TLSet Tool_Num, XY(xTool, yTool, 0, 0)
Fend
建立标定之后做工具坐标(假设是下方影像)
1. 移动机械手使工具呈现在视野中,相机直接捕获工具末端机械手坐标(或者像素坐标)记
为 p360,当前拍照点位记录为 photo2
运行以下程序即可直接获取工具坐标
Function tool_set1
Real xTool, yTool, rTool, theta, Coor_X, Coor_Y
Real uCamera
VxCalLoad "CCD_Calib.caa"
Tool 0
P300 = XY(x1, y1, 0, 0)
Print "转换前的视觉坐标为:", P300
P360 = VxTrans(0, P300)
Print "转换后的机器人坐标为:", P360
SavePoints "robot1.pts"
Tool 0
xTool = CX(P360) - CX(photo_2)
'photo2 是 tool 0 下机械手拍照点的坐标
yTool = CY(P360) - CY(photo_2)
theta = Atan2(xTool, yTool)
theta = theta - DegToRad(CU(photo_2))
rTool = Sqr(xTool * xTool + yTool * yTool)
xTool = Cos(theta) * rTool
yTool = Sin(theta) * rTool
TLSet 1, XY(xTool, yTool, 0, 0)
Fend
使用 pv/cv 建立工具坐标
技术文档-视觉校准时正确建立工具坐标 20170615 张野.pptx