Refactor task functions to improve execution flow by commenting out unused code in task 2, adjusting movement parameters in task 2.5, and updating target coordinates in task 3 for enhanced performance.
This commit is contained in:
parent
fe391e1360
commit
4b925b5cef
@ -140,9 +140,8 @@ class AsyncArrowDetector:
|
||||
return self.left_count, self.right_count
|
||||
|
||||
def run_task_2(ctrl, msg, xy_flag=False):
|
||||
go_to_xy(ctrl, msg, 0.8, 5, speed=0.5, observe=True)
|
||||
|
||||
return 'right'
|
||||
# go_to_xy(ctrl, msg, 0.8, 5, speed=0.5, observe=True)
|
||||
# return 'right'
|
||||
# 微调 xy 和角度
|
||||
go_to_xy_v2(ctrl, msg, 0.9, 0.25, speed=0.5, observe=True)
|
||||
turn_degree_v2(ctrl, msg, 0.8, absolute=True)
|
||||
|
@ -26,12 +26,12 @@ def run_task_2_5(Ctrl, msg, direction='left'):
|
||||
target_distance=0.2,
|
||||
detect_func_version=3,
|
||||
pass_align=True,
|
||||
radius=0.6,
|
||||
radius=0.55,
|
||||
observe=observe,
|
||||
no_end_reset=True,
|
||||
)
|
||||
|
||||
go_straight(Ctrl, msg, distance=0.1, speed=0.5, observe=observe)
|
||||
go_straight(Ctrl, msg, distance=0.2, speed=0.5, observe=observe)
|
||||
section('任务2.5-2:第二次旋转', "移动")
|
||||
|
||||
def run_task_2_5_back(Ctrl, msg, direction='left'):
|
||||
|
@ -97,7 +97,7 @@ def pass_up_down(ctrl, msg):
|
||||
|
||||
climb_speed_threshold = 0.05 # 检测到开始爬坡的速度阈值
|
||||
max_iterations = 450 # 最大循环次数,作为安全保障
|
||||
y_target = 7.8 # 目标y坐标,达到此值时停止
|
||||
y_target = 9.3 # 目标y坐标,达到此值时停止
|
||||
|
||||
# 阶段控制
|
||||
climbing_detected = False # 是否检测到正在爬坡
|
||||
@ -142,7 +142,7 @@ def pass_up_down(ctrl, msg):
|
||||
|
||||
section('任务3-2:x = 2', "开始")
|
||||
turn_degree_v2(ctrl, msg, 90, absolute=True)
|
||||
go_lateral(ctrl, msg, distance=0.2, speed=0.5, observe=True)
|
||||
go_lateral(ctrl, msg, distance=0.1, speed=0.5, observe=True)
|
||||
center_on_dual_tracks(ctrl, msg, max_deviation=10.0, observe=False, detect_height=0.3)
|
||||
go_straight(ctrl, msg, distance=0.6, speed=0.5, observe=True)
|
||||
time.sleep(1)
|
||||
@ -205,7 +205,7 @@ def pass_up_down(ctrl, msg):
|
||||
max_iterations = 200 # 最大循环次数,作为安全保障
|
||||
start_height = ctrl.odo_msg.xyz[2] # 记录起始高度
|
||||
start_y = ctrl.odo_msg.xyz[1] # 记录起始y坐标
|
||||
y_target = 10.0 # 目标y坐标,达到此值时停止
|
||||
y_target = 11.6 # 目标y坐标,达到此值时停止
|
||||
|
||||
# 阶段控制
|
||||
descending_detected = False # 是否检测到正在下坡
|
||||
@ -427,7 +427,7 @@ def run_task_3(ctrl, msg, time_sleep=5000):
|
||||
go_until_yellow_area(ctrl, msg, yellow_ratio_threshold=0.15, speed=0.3)
|
||||
|
||||
# 原地站立3秒
|
||||
section("原地站立3秒", "站立")
|
||||
section("原地站立5秒", "站立")
|
||||
msg.mode = 12
|
||||
msg.gait_id = 0
|
||||
msg.duration = 0
|
||||
@ -436,7 +436,7 @@ def run_task_3(ctrl, msg, time_sleep=5000):
|
||||
msg.life_count += 1
|
||||
ctrl.Send_cmd(msg)
|
||||
|
||||
info("开始原地站立3秒", "站立")
|
||||
info("开始原地站立5秒", "站立")
|
||||
time.sleep(time_sleep / 1000)
|
||||
info("完成原地站立", "站立")
|
||||
|
||||
@ -445,7 +445,7 @@ def run_task_3_back(ctrl, msg, time_sleep=5000):
|
||||
go_until_yellow_area(ctrl, msg, yellow_ratio_threshold=0.15, speed=0.3)
|
||||
|
||||
# 原地站立3秒
|
||||
section("原地站立3秒", "站立")
|
||||
section("原地站立5秒", "站立")
|
||||
msg.mode = 12
|
||||
msg.gait_id = 0
|
||||
msg.duration = 0
|
||||
@ -454,7 +454,7 @@ def run_task_3_back(ctrl, msg, time_sleep=5000):
|
||||
msg.life_count += 1
|
||||
ctrl.Send_cmd(msg)
|
||||
|
||||
info("开始原地站立3秒", "站立")
|
||||
info("开始原地站立5秒", "站立")
|
||||
time.sleep(time_sleep / 1000)
|
||||
info("完成原地站立", "站立")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user