最近在做的项目有用到手眼标定,是关于两个康耐视工业相机和爱普生SCARA机器人之间的手眼标定,相机是固定安装,属于Eye-to-hand固定方式。考虑到halcon中用于标定的算子和实例都比较丰富,并且halcon作为一款商用的视觉与图像处理软件,其可靠性、精度等都是opencv所不能比的。此次所用到的标定实例是calibrate_hand_eye_scara_stationary_cam,在研究这个实例的过程中发现,整个手眼标定的过程大致可以分为两个大的步骤,首先是粗略求解,然后是精确求解。
开始标定之前,需要输入的是标定板的描述文件,后缀名是.cpd的文件,这个文件的相关信息在之前的博客中有详细的描述。
另外,需要获取一组用于标定的图像,另外就是相对应的机械臂tool相对于base的描述,不过需要注意的是这个描述有7个参数,三个矩阵的平移参数t,三个矩阵的旋转参数r,另一个是一个f参数,这个暂时不知道是什么参数,可以看到下面这个记事本,此时的f参数是0。
之后读取这些标定的图片和机器人姿态并进行手眼标定,获得了一个BaseInCamPosePre矩阵,注意这个矩阵最后还带了个Pre,说明接下来还会有一个机器人基坐标系在相机坐标系下的表达BaseInCamPose,这个是校正之后的。
那问题就来了,在标定的实例中,有这么一段:
* 3. Fix the pose ambiguity
*
* When calibrating a SCARA robot, it is impossible to determine
* all pose parameters unambiguously. In case of a stationary
* camera, the Z translation of ObjInToolPose cannot be determined.
* Therefore, it is necessary to fix the unknown translation in
* Z by moving the robot to a pose of known height in the camera
* coordinate system. For this, the calibration plate is (detached from
* the robot and) placed at an arbitrary position such that it can be
* observed by the camera. The pose of the calibration plate must
* then be determined in the camera coordinate system
* (-> ObjInCamPoseRef). Afterwards, the tool of the robot is manually
* moved to the origin of the calibration plate (-> ToolInBasePoseRef).
* The two poses can be used to fix the Z ambiguity by using the
* procedure fix_scara_ambiguity_stationary_cam.
大致的意思是说前面的操作对于矩阵ObjInToolPose中平移量Z无法确定,所以需要进行确定,并给出了操作的步骤:首先是将标定板从机械臂上取下来,放在相机能够看到的地方,当然,机械臂也应该要够得到,然后,相机拍照,获得标定板在相机坐标系下的表达,并将机械臂移动至标定板的原点,读取此时的tool坐标系,利用这两个坐标系的值作为输入,利用算子fix_scara_ambiguity_stationary_cam计算出一个ZCorrection偏差,该偏差在算子set_origin_pose中会对BaseInCamPosePre进行校正,校正的是Z方向的偏置量,然后获得最终的BaseInCamPose。
然后,Why?为哈要进行这一步?
。
。
。looking for an answer
。
。
最后,在算子set_origin_pose (Operator)的帮助文档中找到了这么一段话:
A typical application of this operator when defining a world coordinate system by placing the standard calibration plate on the plane of measurements. In this case, the external camera parameters returned by camera_calibration correspond to a coordinate system that lies above the measurement plane, because the coordinate system of the calibration plate is located on its surface and the plate has a certain thickness. To correct the pose, call set_origin_pose with the translation vector (0,0,D), where D is the thickness of the calibration plate.
注意这句话:the plate has a certain thickness,校正的原因是标定板有一定的厚度!获取到厚度D后,利用算子set_origin_pose将D考虑进去,得到最后校正的机器人基坐标系在相机坐标系下的表达。
————————————————
版权声明:本文为CSDN博主「孙姬被刘备家暴」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/opencv_learner/java/article/details/82108236

