Refactor main.py and task functions by commenting out unused code and adjusting movement parameters for improved execution flow. Update task 2 to enhance clarity and maintainability.
This commit is contained in:
		
							parent
							
								
									824e31edde
								
							
						
					
					
						commit
						580ebb39e3
					
				
							
								
								
									
										12
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								main.py
									
									
									
									
									
								
							@ -50,14 +50,14 @@ def main():
 | 
			
		||||
        Ctrl.base_msg.stand_up()
 | 
			
		||||
        Ctrl.base_msg.stop()  # BUG 垃圾指令 for eat
 | 
			
		||||
 | 
			
		||||
        # # time.sleep(100) # TEST,
 | 
			
		||||
        run_task_1(Ctrl, msg, time_sleep=TIME_SLEEP)
 | 
			
		||||
        # time.sleep(100) # TEST,
 | 
			
		||||
        # 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)
 | 
			
		||||
 | 
			
		||||
@ -118,7 +118,7 @@ class AsyncArrowDetector:
 | 
			
		||||
def run_task_2(ctrl, msg, xy_flag=False):
 | 
			
		||||
    # 微调 xy 和角度
 | 
			
		||||
    go_to_xy_v2(ctrl, msg, 0.9, 0.25, speed=0.5, observe=True)
 | 
			
		||||
    turn_degree(ctrl, msg, 0.8, absolute=True)
 | 
			
		||||
    turn_degree_v2(ctrl, msg, 0.8, absolute=True)
 | 
			
		||||
 | 
			
		||||
    print('角度为',ctrl.odo_msg.rpy[2])
 | 
			
		||||
    #获取微调角度
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,7 @@ def run_task_2_5(Ctrl, msg, direction='left'):
 | 
			
		||||
        observe=observe,
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    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'):
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user