Enhance main.py and task functions by removing commented-out code and refining movement logic. Update task 2.5 to utilize a new turning function and adjust iteration parameters in task 3 for improved execution flow and clarity.
This commit is contained in:
parent
580ebb39e3
commit
beb0c1b9f1
10
main.py
10
main.py
@ -51,13 +51,13 @@ def main():
|
||||
Ctrl.base_msg.stop() # BUG 垃圾指令 for eat
|
||||
|
||||
# time.sleep(100) # TEST,
|
||||
# run_task_1(Ctrl, msg, time_sleep=TIME_SLEEP)
|
||||
run_task_1(Ctrl, msg, time_sleep=TIME_SLEEP)
|
||||
|
||||
# arrow_direction = run_task_2(Ctrl, msg, xy_flag=False)
|
||||
arrow_direction = 'right' # TEST
|
||||
arrow_direction = run_task_2(Ctrl, msg, xy_flag=False)
|
||||
# arrow_direction = 'right' # TEST
|
||||
|
||||
# info(f"识别到箭头方向: {arrow_direction}", "info")
|
||||
# run_task_2_5(Ctrl, msg, direction=arrow_direction)
|
||||
info(f"识别到箭头方向: {arrow_direction}", "info")
|
||||
run_task_2_5(Ctrl, msg, direction=arrow_direction)
|
||||
|
||||
if arrow_direction == 'left':
|
||||
run_task_4(Ctrl, msg)
|
||||
|
@ -14,11 +14,10 @@ observe = True
|
||||
|
||||
def run_task_2_5(Ctrl, msg, direction='left'):
|
||||
section('任务2.5:预备进入任务3', "启动")
|
||||
|
||||
go_straight(Ctrl, msg, distance=-0.1, speed=0.5, observe=observe)
|
||||
|
||||
# TEST
|
||||
turn_degree(Ctrl, msg, 90, absolute=observe)
|
||||
turn_degree_v2(Ctrl, msg, 90, absolute=observe)
|
||||
|
||||
section('任务2.5-1:第一次旋转', "移动")
|
||||
|
||||
@ -29,6 +28,7 @@ def run_task_2_5(Ctrl, msg, direction='left'):
|
||||
target_distance=0.2,
|
||||
detect_func_version=3,
|
||||
observe=observe,
|
||||
no_end_reset=True,
|
||||
)
|
||||
|
||||
go_straight(Ctrl, msg, distance=0.2, speed=0.5, observe=observe)
|
||||
|
@ -101,8 +101,8 @@ def pass_up_down(ctrl, msg):
|
||||
stable_threshold = 8 # 连续15次检测z轴不再增加则认为已经停止
|
||||
z_speed_threshold = 0.01 # z轴速度阈值,小于这个值认为已经停止爬升
|
||||
climb_speed_threshold = 0.05 # 检测到开始爬坡的速度阈值
|
||||
max_iterations = 320 # 最大循环次数,作为安全保障
|
||||
min_iterations = 250 # 最小循环次数,作为安全保障
|
||||
max_iterations = 180 # 最大循环次数,作为安全保障
|
||||
min_iterations = 170 # 最小循环次数,作为安全保障
|
||||
|
||||
# 姿态判断参数
|
||||
pitch_threshold = 0.05 # 俯仰角阈值(弧度)
|
||||
|
Loading…
x
Reference in New Issue
Block a user