Pick using Cognex in feature plane

Hi everyone, I’m trying to pick up pieces from a plate using a fixed Cognex camera and a UR robot.

The camera is calibrated using the fiducial grid, and I’ve created a feature plane on the robot that corresponds to the camera’s reference system.

The camera returns the x, y, and z rotation coordinates.

If the parts are oriented like the master image from the camera, there’s no problem, but if the orientation is different, the x-y-rz coordinates aren’t accurate (they differ slightly).

The point coordinates are calculated as follows: point = p[x_camera, y_camera, 0, 0, d2r(rz_camera)]

x_camera and y_camera are in meters.

To move the robot, I use MoveL with the camera feature plane.

Can you give me any advice on how to resolve this coordinate discrepancy?

Thanks

The coordinates by the robot are not rx ry and rz for the last 3 elements in a position. They are a rotation vector. This confused me for a while coming from other robots systems..

The below code is what I happen to use to apply to rotation a cognex camera gives me to a robot position. Mine is all in offset from the taught position, where as it looks like you are doing absolute positions from the camera… but you can just create the rot_rad_vec and use it’s 3 elements directly without doing the pose_add that I am doing

rot_rad_vec = rpy2rotvec([0,0,-d2r(Ang)])

global FoundPose = pose_add(FoundPose,p[0,0,0,rot_rad_vec[0],rot_rad_vec[1],rot_rad_vec[2]]) # add rotation

How do you teach the “zero” rotation on the robot side?

I do it like this:

  1. Cognex side, part at 0°

  2. Gripper on grasping position

  3. The position is saved as a feature as the “origin” position. Relative to the vision plane, X and Y are reset to 0.

  4. In the BeforeStart of the program, the position is made relative to the vision plane.
    pVision0_calib := pose_trans(pose_inv(cognex_calib), pVision0))

  5. x,y and rz are from the Cognex

Thank you both.

I use this calibration plate and use a tool to teach the feature to the robot.

The piece origin and orientation is set like this

than in the program the point is calculated:

def PzPoint(ref_plane, ref_zero, x_coord, y_coord, rz_coord, h_presa, h_piastra_vibr, corr):

local punto = p\[x_coord, y_coord, z_coord, 0, 0, d2r(rz_coord)\]

return punto

end

where ref_plane is the feature plane.

than for the movement