diff --git a/base_move/move_base_hori_line.py b/base_move/move_base_hori_line.py index 07cbd98..b5617b7 100644 --- a/base_move/move_base_hori_line.py +++ b/base_move/move_base_hori_line.py @@ -166,14 +166,15 @@ def move_to_hori_line(ctrl, msg, target_distance=0.1, observe=False): bool: 是否成功到达目标位置 """ # 首先校准到水平 - aligned = align_to_horizontal_line(ctrl, msg, observe=observe) + aligned = align_to_horizontal_line(ctrl, msg, observe=False) if not aligned: print("无法校准到横向线水平,停止移动") return False # 检测横向线 - edge_point, edge_info = detect_horizontal_track_edge(ctrl.image_processor.get_current_image(), observe=observe) + cv2.imwrite("current_image.jpg", ctrl.image_processor.get_current_image()) + edge_point, edge_info = detect_horizontal_track_edge(ctrl.image_processor.get_current_image(), observe=False) if edge_point is None or edge_info is None: print("无法检测到横向线,停止移动") diff --git a/current_image.jpg b/current_image.jpg new file mode 100644 index 0000000..9606052 Binary files /dev/null and b/current_image.jpg differ diff --git a/task_1/task_1.py b/task_1/task_1.py index 4e74462..803e148 100644 --- a/task_1/task_1.py +++ b/task_1/task_1.py @@ -5,14 +5,15 @@ import os # 添加父目录到路径,以便能够导入utils sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - from base_move.move_base_hori_line import align_to_horizontal_line, move_to_hori_line +observe = True + def run_task_1(ctrl, msg): print('Running task 1...') # v2 - move_to_hori_line(ctrl, msg) + move_to_hori_line(ctrl, msg, observe=observe)