refactor(task_1): update observe flag and improve code readability
- Set observe flag to True - Rename 'success' variable to 'turn_success' for clarity - Add comments and blank lines for better code structure - Remove unnecessary return statement
This commit is contained in:
parent
44c83bc1d4
commit
0534261b80
@ -17,7 +17,7 @@ from utils.log_helper import LogHelper, get_logger, section, info, debug, warnin
|
||||
# 创建本模块特定的日志记录器
|
||||
logger = get_logger("任务1")
|
||||
|
||||
observe = False
|
||||
observe = True
|
||||
|
||||
def run_task_1(ctrl, msg):
|
||||
section('任务1:寻找横线并绕行', "启动")
|
||||
@ -26,7 +26,7 @@ def run_task_1(ctrl, msg):
|
||||
# v2
|
||||
section('任务1-1:转弯并扫描QR码', "移动")
|
||||
# 在 arc_turn_around_hori_line 中启用 QR 码扫描
|
||||
success, res = arc_turn_around_hori_line(
|
||||
turn_success, res = arc_turn_around_hori_line(
|
||||
ctrl=ctrl,
|
||||
msg=msg,
|
||||
angle_deg=85,
|
||||
@ -47,17 +47,20 @@ def run_task_1(ctrl, msg):
|
||||
|
||||
section('任务1-3:转弯', "旋转")
|
||||
direction = True if res['qr_result'] == 'A-1' else False
|
||||
success, res = arc_turn_around_hori_line(
|
||||
turn_success, res = arc_turn_around_hori_line(
|
||||
ctrl=ctrl,
|
||||
msg=msg,
|
||||
angle_deg=170,
|
||||
target_distance=0.4, # TODO 优化这里的参数
|
||||
left=direction,
|
||||
#
|
||||
pass_align=True,
|
||||
observe=observe,
|
||||
# TODO clear
|
||||
bad_big_angle_corret=True
|
||||
)
|
||||
|
||||
return
|
||||
|
||||
section('任务1-4:直线移动', "移动")
|
||||
move_distance = 0.4
|
||||
@ -86,7 +89,7 @@ def run_task_1(ctrl, msg):
|
||||
turn_degree(ctrl, msg, degree=-90, absolute=True)
|
||||
|
||||
section('任务1-7:90度转弯', "旋转")
|
||||
success, res = arc_turn_around_hori_line(
|
||||
turn_success, res = arc_turn_around_hori_line(
|
||||
ctrl=ctrl,
|
||||
msg=msg,
|
||||
angle_deg=-85,
|
||||
|
Loading…
x
Reference in New Issue
Block a user