refactor(base_move): improve rotation accuracy and adjust task execution

- Enhance rotation feedback by printing current angle during and after rotation
- Adjust angles and add target distance in task 1 execution
- Modify stop method in BaseMsg class to use milliseconds for duration
This commit is contained in:
havoc420ubuntu 2025-05-15 15:22:26 +00:00
parent 5cfdb94739
commit c493db818a
3 changed files with 11 additions and 8 deletions

View File

@ -483,7 +483,10 @@ def arc_turn_around_hori_line(ctrl, msg, angle_deg=90, left=True, target_distanc
if observe:
print(f"旋转过程结束,当前速度: [{current_v:.3f}, 0, {current_w:.3f}]")
print(f'{math.degrees(ctrl.odo_msg.rpy[2]):.2f}')
ctrl.base_msg.stop()
if observe:
print(f'{math.degrees(ctrl.odo_msg.rpy[2]):.2f}')
# 记录停止前的角度
pre_stop_yaw = ctrl.odo_msg.rpy[2]

View File

@ -13,15 +13,15 @@ def run_task_1(ctrl, msg):
# v2
print('😺 task 1 - 1')
arc_turn_around_hori_line(ctrl, msg, angle_deg=70, left=False, observe=observe)
arc_turn_around_hori_line(ctrl, msg, angle_deg=85, left=False, observe=observe)
print('😺 task 1 - 2')
move_to_hori_line(ctrl, msg, target_distance=1, observe=observe)
return
print('😺 task 1 - 3')
arc_turn_around_hori_line(ctrl, msg, angle_deg=160, left=True, observe=observe)
arc_turn_around_hori_line(ctrl, msg, angle_deg=180, target_distance=0.4, left=True, observe=observe)
return
print('😺 task 1 - 4')
move_to_hori_line(ctrl, msg, observe=observe)

View File

@ -13,13 +13,13 @@ class BaseMsg:
self.ctrl.Send_cmd(self.msg)
self.ctrl.Wait_finish(0, 0)
def stop(self, wait_time=1):
def stop(self, wait_time=200):
self.msg.mode = 11
self.msg.gait_id = 26
self.msg.vel_des = [0, 0, 0]
self.msg.duration = wait_time * 1000
self.msg.duration = wait_time
self.msg.life_count += 1
self.ctrl.Send_cmd(self.msg)
if wait_time:
time.sleep(wait_time)
time.sleep(wait_time / 1000)