From 47cfa56ff0a79e92c03ab4d6a1083828bce6219a Mon Sep 17 00:00:00 2001 From: Havoc <2993167370@qq.com> Date: Tue, 27 May 2025 01:03:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BB=BB=E5=8A=A11=E5=92=8C?= =?UTF-8?q?=E4=BB=BB=E5=8A=A12.5=E7=9A=84=E8=BF=94=E5=9B=9E=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E5=8C=85=E5=90=AB=E5=A4=9A=E4=B8=AA=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=92=8C=E6=97=8B=E8=BD=AC=E6=AD=A5=E9=AA=A4=E4=BB=A5?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BB=BB=E5=8A=A1=E5=9B=9E=E7=A8=8B=E3=80=82?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E6=9C=BA=E5=99=A8=E4=BA=BA=E5=9C=A8?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=B8=AD=E7=9A=84=E5=8A=A8=E4=BD=9C=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=9B=B4=E6=B5=81=E7=95=85?= =?UTF-8?q?=E7=9A=84=E6=89=A7=E8=A1=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task_1/task_1.py | 68 ++++++++++++++++++++++++++++++++++++++++++++ task_2_5/task_2_5.py | 21 ++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/task_1/task_1.py b/task_1/task_1.py index 3761ae3..2eebdbd 100644 --- a/task_1/task_1.py +++ b/task_1/task_1.py @@ -122,3 +122,71 @@ def run_task_1(ctrl, msg): # TODO success("任务1完成", "完成") + + +def run_task_1_back(ctrl, msg): + section('任务1-11: 返回', "移动") + + turn_success, res = arc_turn_around_hori_line( + ctrl=ctrl, + msg=msg, + angle_deg=90, + radius=0.4, + pass_align=True, + observe=observe, + ) + + section('任务1-11: 直线移动', "移动") + move_to_hori_line(ctrl, msg, target_distance=1, observe=observe) + + section('任务1-12: 90度旋转', "旋转") + turn_success, res = arc_turn_around_hori_line( + ctrl=ctrl, + msg=msg, + angle_deg=170, + target_distance=0.6, + min_radius=0.3, + max_radius=0.4, + pass_align=True, + observe=observe, + ) + + section('任务1-13: 直线移动', "移动") + move_distance = 0.35 + go_straight_by_hori_line(ctrl, msg, distance=move_distance, observe=observe) + + section('任务1-14: 模拟装货', "停止") + info('机器人躺下,模拟装货过程', "信息") + start_time = time.time() + ctrl.base_msg.lie_down(wait_time=3000) # TODO 比赛时改成 5s + elapsed = time.time() - start_time + timing("装货过程", elapsed) + + section('任务1-15: 站起来', "移动") + ctrl.base_msg.stand_up() + + section('任务1-16: 返回', "移动") + go_straight(ctrl, msg, distance=-(move_distance + res['radius'] + 0.3), observe=observe) + + section('任务1-17: 90度转弯', "旋转") + turn_success, res = arc_turn_around_hori_line( + ctrl=ctrl, + msg=msg, + angle_deg=90, + radius=0.4, + pass_align=True, + observe=observe, + ) + + section('任务1-18: 直线移动', "移动") + move_to_hori_line(ctrl, msg, target_distance=0.35, observe=observe) + + section('任务1-19: 90度旋转', "旋转") + turn_success, res = arc_turn_around_hori_line( + ctrl=ctrl, + msg=msg, + angle_deg=90, + radius=0.4, + ) + + success("任务1-back完成", "完成") \ No newline at end of file diff --git a/task_2_5/task_2_5.py b/task_2_5/task_2_5.py index 61dc58c..6b0f20c 100644 --- a/task_2_5/task_2_5.py +++ b/task_2_5/task_2_5.py @@ -43,4 +43,25 @@ def run_task_2_5(Ctrl, msg, direction='left'): # observe=observe, # ) +def run_task_2_5_back(Ctrl, msg, direction='left'): + section('任务2.5-back:预备进入任务3', "启动") + + arc_turn_around_hori_line( + Ctrl, + msg, + angle_deg=90 if direction == 'left' else -90, + target_distance=0.3, + detect_func_version=2, + observe=observe, + ) + + 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, + # ) \ No newline at end of file