refactor(base_move): improve stop mechanism and adjust task_1 behavior
- Replace direct stop command with ctrl.base_msg.stop_force() in move_base_hori_line - Enable observation mode in task_1 by setting observe to True - Remove unnecessary return statement in task_1
This commit is contained in:
parent
24f98da1a3
commit
f84271c4d1
@ -454,15 +454,9 @@ def arc_turn_around_hori_line(ctrl, msg, target_distance=0.2, angle_deg=90, left
|
||||
|
||||
time.sleep(0.05)
|
||||
|
||||
# 直接发送停止命令,不使用平滑停止
|
||||
msg.mode = 11
|
||||
msg.gait_id = 26
|
||||
msg.vel_des = [0, 0, 0] # 零速度
|
||||
msg.duration = 200
|
||||
msg.step_height = [0.06, 0.06]
|
||||
msg.life_count += 1
|
||||
ctrl.Send_cmd(msg)
|
||||
|
||||
# Stop
|
||||
ctrl.base_msg.stop_force()
|
||||
|
||||
# 停下来后的最终角度
|
||||
final_yaw = ctrl.odo_msg.rpy[2]
|
||||
final_angle_turned = final_yaw - start_yaw
|
||||
|
@ -7,7 +7,7 @@ import os
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from base_move.move_base_hori_line import move_to_hori_line, arc_turn_around_hori_line
|
||||
|
||||
observe = False
|
||||
observe = True
|
||||
|
||||
def run_task_1(ctrl, msg):
|
||||
print('Running task 1...')
|
||||
@ -15,8 +15,6 @@ def run_task_1(ctrl, msg):
|
||||
# v2
|
||||
arc_turn_around_hori_line(ctrl, msg, angle_deg=90, left=False, observe=observe)
|
||||
|
||||
return True
|
||||
|
||||
move_to_hori_line(ctrl, msg, target_distance=1, observe=observe)
|
||||
|
||||
arc_turn_around_hori_line(ctrl, msg, angle_deg=180, left=True, observe=observe)
|
||||
|
Loading…
x
Reference in New Issue
Block a user