From 8d254c271d36aa55bc97ffb8fb6fabdc86493acd Mon Sep 17 00:00:00 2001 From: 2929ss <1814754095@qq.com> Date: Sat, 30 Jul 2022 12:03:09 +0800 Subject: [PATCH] optimize --- mycobot_ai/ai_mecharm_270/scripts/add_img.py | 7 ++++--- mycobot_ai/ai_mycobot_280/scripts/add_img.py | 8 ++++---- mycobot_ai/ai_mypalletizer_260/scripts/add_img.py | 7 ++++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/mycobot_ai/ai_mecharm_270/scripts/add_img.py b/mycobot_ai/ai_mecharm_270/scripts/add_img.py index 0b9423e..b06b7e7 100755 --- a/mycobot_ai/ai_mecharm_270/scripts/add_img.py +++ b/mycobot_ai/ai_mecharm_270/scripts/add_img.py @@ -49,15 +49,16 @@ def take_photo(): def cut_photo(): - path1 = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mecharm_270/' - path2 = '/home/h/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mecharm_270/' + path1 = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mecharm_270/' # pi + path2 = '/home/h/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mecharm_270/' # m5 if os.path.exists(path1): path = path1 elif os.path.exists(path2): path = path2 else: - print("invalid path!") + print("invalid file path! Please check whether the file path exists or modify it!") + path_red = path+'/res/red' for i, j, k in os.walk(path_red): diff --git a/mycobot_ai/ai_mycobot_280/scripts/add_img.py b/mycobot_ai/ai_mycobot_280/scripts/add_img.py index b8bdb99..a57ec54 100755 --- a/mycobot_ai/ai_mycobot_280/scripts/add_img.py +++ b/mycobot_ai/ai_mycobot_280/scripts/add_img.py @@ -49,16 +49,16 @@ def take_photo(): def cut_photo(): - path1 = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mycobot_280/' - path2 = '/home/h/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mycobot_280/' + path1 = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mycobot_280/' # pi + path2 = '/home/h/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mycobot_280/' # m5 if os.path.exists(path1): path = path1 elif os.path.exists(path2): path = path2 else: - print("invalid path!") - + print("invalid file path! Please check whether the file path exists or modify it!") + path_red = path + '/res/red' for i, j, k in os.walk(path_red): file_len_red = len(k) diff --git a/mycobot_ai/ai_mypalletizer_260/scripts/add_img.py b/mycobot_ai/ai_mypalletizer_260/scripts/add_img.py index a13dc03..27f4e50 100755 --- a/mycobot_ai/ai_mypalletizer_260/scripts/add_img.py +++ b/mycobot_ai/ai_mypalletizer_260/scripts/add_img.py @@ -49,15 +49,16 @@ def take_photo(): def cut_photo(): - path1 = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mypalletizer_260/' - path2 = '/home/h/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mypalletizer_260/' + path1 = '/home/ubuntu/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mypalletizer_260/' # pi + path2 = '/home/h/catkin_ws/src/mycobot_ros/mycobot_ai/ai_mypalletizer_260/' # m5 if os.path.exists(path1): path = path1 elif os.path.exists(path2): path = path2 else: - print("invalid path!") + print("invalid file path! Please check whether the file path exists or modify it!") + path_red = path + '/res/red' for i, j, k in os.walk(path_red):