refactor(base_move): improve horizontal line alignment and task 1 execution

- Simplify the horizontal line alignment process in move_base_hori_line.py
- Update task_1.py to use the improved alignment function for better accuracy
This commit is contained in:
havoc420ubuntu 2025-05-19 06:30:11 +00:00
parent 5d586c2999
commit 28254f23c1
2 changed files with 4 additions and 9 deletions

View File

@ -91,17 +91,12 @@ def align_to_horizontal_line(ctrl, msg, observe=False, max_attempts=3):
info(f"计算旋转角度: {angle_to_rotate:.2f}", "角度")
info(f"当前累积旋转: {accumulated_angle:.2f}", "累积")
<<<<<<< HEAD
# 使用turn_degree函数执行旋转增加精度参数
info(f"旋转角度: {angle_to_rotate:.2f}", "旋转")
turn_success = turn_degree(ctrl, msg, angle_to_rotate, absolute=False, precision=True)
info(f"旋转结果: {turn_success}", "旋转结果")
# 等待稳定
=======
# 执行旋转
turn_success = turn_degree(ctrl, msg, angle_to_rotate, absolute=False, precision=True)
>>>>>>> 6b15e9be908cb3e330a29e326449540f312dec4e
time.sleep(0.3)
# 计算实际旋转角度

View File

@ -24,10 +24,10 @@ def run_task_1(ctrl, msg):
section('任务1寻找横线并绕行', "启动")
info('开始执行任务1...', "启动")
# # TEST better align
# aligned = align_to_horizontal_line(ctrl, msg, observe=observe)
# print(aligned)
# return
# TEST better align
aligned = align_to_horizontal_line(ctrl, msg, observe=observe)
print(aligned)
return
# v2
section('任务1-1转弯并扫描QR码', "移动")