diff --git a/mycobot_ai/myCobot_280/scripts/add_img.py b/mycobot_ai/myCobot_280/scripts/add_img.py index 4d38ec6..e9b2fca 100755 --- a/mycobot_ai/myCobot_280/scripts/add_img.py +++ b/mycobot_ai/myCobot_280/scripts/add_img.py @@ -49,19 +49,19 @@ def take_photo(): def cut_photo(): - path_red = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/res/red' + path_red = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/myCobot_280/res/red' for i, j, k in os.walk(path_red): file_len_red = len(k) - path_gray = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/res/gray' + path_gray = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/myCobot_280/res/gray' for i, j, k in os.walk(path_gray): file_len_gray = len(k) - path_green = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/res/green' + path_green = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/myCobot_280/res/green' for i, j, k in os.walk(path_green): file_len_green = len(k) - path_blue = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/res/blue' + path_blue = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/myCobot_280/res/blue' for i, j, k in os.walk(path_blue): file_len_blue = len(k) print("请截取要识别的部分") @@ -95,19 +95,19 @@ def cut_photo(): cv2.imshow('crop', crop) # 选择红桶文件夹 if kw == 'red': - cv2.imwrite('/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/res/red/goal{}.jpeg'.format(str(file_len_red + 1)),crop) + cv2.imwrite('/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/myCobot_280/res/red/goal{}.jpeg'.format(str(file_len_red + 1)),crop) print('Saved') # 选择灰桶文件夹 elif kw == 'gray': - cv2.imwrite('/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/res/gray/goal{}.jpeg'.format(str(file_len_gray+1)),crop) + cv2.imwrite('/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/myCobot_280/res/gray/goal{}.jpeg'.format(str(file_len_gray+1)),crop) print('Saved') # 选择绿桶文件夹 elif kw == 'green': - cv2.imwrite('/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/res/green/goal{}.jpeg'.format(str(file_len_green+1)),crop) + cv2.imwrite('/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/myCobot_280/res/green/goal{}.jpeg'.format(str(file_len_green+1)),crop) print('Saved') # 选择蓝桶文件夹 elif kw == 'blue': - cv2.imwrite('/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/res/blue/goal{}.jpeg'.format(str(file_len_blue+1)),crop) + cv2.imwrite('/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/myCobot_280/res/blue/goal{}.jpeg'.format(str(file_len_blue+1)),crop) print('Saved') # 退出 diff --git a/mycobot_ai/myCobot_280/scripts/detect_obj_color.py b/mycobot_ai/myCobot_280/scripts/detect_obj_color.py index 26032a4..6956552 100755 --- a/mycobot_ai/myCobot_280/scripts/detect_obj_color.py +++ b/mycobot_ai/myCobot_280/scripts/detect_obj_color.py @@ -138,7 +138,7 @@ class Object_detect(Movement): # Grasping motion def move(self, x, y, color): # send Angle to move mycobot - print color + print (color) self.pub_angles(self.move_angles[0], 20) time.sleep(1.5) self.pub_angles(self.move_angles[1], 20) diff --git a/mycobot_ai/myCobot_280/scripts/detect_obj_img_folder_opt.py b/mycobot_ai/myCobot_280/scripts/detect_obj_img_folder_opt.py index 1ed9909..cc32439 100644 --- a/mycobot_ai/myCobot_280/scripts/detect_obj_img_folder_opt.py +++ b/mycobot_ai/myCobot_280/scripts/detect_obj_img_folder_opt.py @@ -406,7 +406,7 @@ class Object_detect(Movement): # The path to save the image folder def parse_folder(folder): restore = [] - path = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/' + folder + path = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/myCobot_280' + folder for i, j, k in os.walk(path): for l in k: restore.append(cv2.imread(folder + '/{}'.format(l))) @@ -594,7 +594,7 @@ def run(): detect.sum_y1 += y1 detect.sum_y2 += y2 nparams += 1 - print "ok" + print ("ok") continue elif nparams == 10: nparams += 1