机器人 工具坐标系的标定

概念

        工具坐标系是把机器人腕部法兰盘所握工具的有效方向定为Z轴,把坐标定义在工具尖端点,所以工具坐标的方向随腕部的移动而发生变化。

        工具坐标的移动,以工具的有效方向为基准,与机器人的位置、姿势无关,所以进行相对于工件不改变工具姿势的平行移动操作时最为适宜。

        建立了工具坐标系后,机器人的控制点也转移到了工具的尖端点上,这样示教时可以利用控制点不变的操作方便地调整工具姿态,并可使插补运算时轨迹更为精确。所以,不管是什么机型的机器人,用于什么用途,只要安装的工具有个尖端,在示教程序前务必要准确地建立工具坐标系。


        位置数据
        位置数据是指工具尖端点在法兰盘坐标系下的坐标值。 

位置数据的创建方法有两种。

        1  直接输入法(不推荐使用)
            如果已知工具的具体尺寸,可直接输入具体数值。
        2  工具校验(常用)
            进行工具校验,需以控制点为基准示教5个不同的姿态(TC1至 5)。根据这5个数据自动算出工具尺寸。应把各点的姿态设定为任意方向的姿态。若采用偏向某一方向的姿态,可能出现精度不准的情况。





### UR机器人工具坐标系标定代码示例 对于UR机器人工具坐标系(TCP)标定,通常涉及通过一系列已知位置的姿态来计算TCP相对于末端执行器的位置和方向。此过程可以借助Python脚本以及ROS (Robot Operating System) 来实现。 下面是一个基于Python的简单示例,用于演示如何使用六个不同的姿态点来进行TCP标定: ```python import numpy as np from ur_robot_driver.srv import * import rospy def tcp_calibration(points): """ 计算工具中心点(TCP)相对于法兰盘原点的位置向量。 参数: points -- 包含6个不同位姿下的笛卡尔坐标列表 [[x1, y1, z1], ... , [x6, y6, z6]] 和对应的关节角度 [[j1_1, j2_1,..., j6_1], ..., [j1_6, j2_6,..., j6_6]]. 返回值: TCP_offset -- 工具中心点偏移量[x,y,z,a,b,c]. """ service_name = '/ur_hardware_interface/set_tcp' set_tcp_srv = rospy.ServiceProxy(service_name, SetTcp) try: response = set_tcp_srv(tcp=[0., 0., 0., 0., 0., 0.]) # Reset to default before calibration A = [] B = [] for point in points: cartesian_position = point[:3] joint_angles = point[3:] # Add your code here to move the robot arm according to `joint_angles` and record actual tool position measured_tool_pos = get_measured_tool_pose() # Function that returns current tool pose from sensor data or FK calculation A.append(cartesian_position) B.append(measured_tool_pos) P = np.array(A).T @ np.linalg.inv(np.array(B).T) tx, ty, tz = P.diagonal() rx, ry, rz = rotation_matrix_to_euler(P / P.diagonal()) TCP_offset = [tx, ty, tz, rx, ry, rz] result = set_tcp_srv(tcp=TCP_offset) return TCP_offset except Exception as e: print(f"Service call failed with error {e}") def rotation_matrix_to_euler(R): """Converts a rotation matrix into Euler angles.""" sy = math.sqrt(R[0,0] * R[0,0] + R[1,0] * R[1,0]) singular = sy < 1e-6 if not singular : x = math.atan2(R[2,1] , R[2,2]) y = math.atan2(-R[2,0], sy) z = math.atan2(R[1,0], R[0,0]) else : x = math.atan2(-R[1,2], R[1,1]) y = math.atan2(-R[2,0], sy) z = 0 return np.array([x, y, z]) def get_measured_tool_pose(): """Placeholder function representing how one would obtain real-time measurements of the tool's pose""" pass if __name__ == "__main__": rospy.init_node('tcp_calibrator') sample_points = [ [-0.4,-0.2,0.5, -90,-90,0], ... ] # Insert six different poses consisting of both Cartesian positions and corresponding joint configurations. calibrated_TCP = tcp_calibration(sample_points) print(calibrated_TCP) ``` 上述代码展示了如何定义一个函数`tcc_calibration()`,该函数接收一组由六个不同位姿组成的输入数据集,并返回所估计出来的TCP偏移量[^1]。注意,在实际应用中,获取测量到的工具姿势(`get_measured_tool_pose`)部分应该替换为从传感器读取真实世界的数据或者正运动学计算的结果。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值