mi-task/task_2_5/task_2_5.py
havoc420ubuntu e9ff362b01 refactor(main, base_move, task_1): update task execution and enhance track detection
- Uncomment run_task_1 in main.py to enable task execution.
- Comment out run_task_test in main.py to prevent test execution.
- Introduce turn_degree_twice function in turn_degree.py for improved rotation control.
- Update task_1.py to utilize turn_degree_twice and adjust movement parameters for better task execution.
- Modify detect_func_version in task_2_5.py to use the latest detection algorithm.
- Add detect_horizontal_track_edge_v3 function in detect_track.py for enhanced edge detection capabilities.
2025-05-26 09:34:32 +00:00

46 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import time
import sys
import os
# 添加父目录到路径以便能够导入utils
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from base_move.turn_degree import turn_degree
from base_move.move_base_hori_line import arc_turn_around_hori_line, align_to_horizontal_line
from utils.log_helper import LogHelper, get_logger, section, info, debug, warning, error, success, timing
observe = True
def run_task_2_5(Ctrl, msg, direction='left'):
section('任务2.5预备进入任务3', "启动")
# TEST
turn_degree(Ctrl, msg, 90, absolute=observe)
section('任务2.5-1第一次旋转', "移动")
turn_success, res = arc_turn_around_hori_line(
Ctrl,
msg,
angle_deg=90 if direction == 'left' else -90,
target_distance=0.3,
detect_func_version=3,
observe=observe,
)
section('任务2.5-2第二次旋转', "移动")
turn_degree(Ctrl, msg, degree=90, absolute=True)
# arc_turn_around_hori_line(
# Ctrl,
# msg,
# angle_deg=70,
# # target_distance=0.5,
# pass_align=True,
# radius=res['radius'],
# detect_func_version=2,
# observe=observe,
# )