diff --git a/arm_debug.py b/arm_debug.py index 283efc0..4b77090 100644 --- a/arm_debug.py +++ b/arm_debug.py @@ -18,8 +18,8 @@ ele_point = (-110, -50.94, 75) # px, py = input("请输入像素坐标:").split() # px, py = int(px), int(py) -target = pixel2robot(877, 628) -print(target) +# target = pixel2robot(877, 628) +# print(target) # jetmax.set_position((target[0], target[1], -30), 1) # jetmax.set_position((-75.41654829, -156.86319459, 70), 1) @@ -27,3 +27,14 @@ jetmax.set_position(ele_point, 1) time.sleep(1) print(jetmax.position) + +def move_to_pixel_position(x, y): + target = pixel2robot(x, y) + print(target) + jetmax.set_position((target[0], target[1], -30), 1) + +if __name__ == "__main__": + pix_pos = input("分别输入 pixspy 上测得的横坐标和纵坐标,用空格分开:") + print(pix_pos) + x, y = pix_pos.split() + move_to_pixel_position(int(x), int(y)) \ No newline at end of file diff --git a/camera_params.npz b/camera_params.npz new file mode 100644 index 0000000..75c81dc Binary files /dev/null and b/camera_params.npz differ diff --git a/utils/location_calib.py b/utils/location_calib.py index cd77e48..5674010 100644 --- a/utils/location_calib.py +++ b/utils/location_calib.py @@ -22,7 +22,7 @@ obj_points = [] img_points = [] # 读取标定板图像 -images = ["1723983285.6120198.jpg"] # 替换为实际的图像文件 +images = ["1724898532.521401.jpg"] # 替换为实际的图像文件 for fname in images: img = cv2.imread(fname) diff --git a/utils/pixel_convert.py b/utils/pixel_convert.py index c55278d..a30f77f 100644 --- a/utils/pixel_convert.py +++ b/utils/pixel_convert.py @@ -54,7 +54,7 @@ def pixel2robot(p_x, p_y, Zc=380): [0, -1, 0], [0, 0, 0]]) - taT = np.array([-1.5, -216, -30]) + taT = np.array([-15.5, -187, -30]) # print(np.dot(taR, base_coords)) base_coords = np.dot(taR, base_coords) + taT # base_coords = base_coords + taT @@ -79,11 +79,11 @@ def pixel2robot(p_x, p_y, Zc=380): # print(covert([993,10],260)) # print(covert([554,559],260)) -# 604, 109 [-115, -150.94, -25] +# 485,300 [-135, -135.94, -30] if __name__ == '__main__': # print(pixel2robot(468, 254)) - print(pixel2robot(469, 254)) + print(pixel2robot(485, 300)) # print(pixel2robot(956, 448))