mi-task/utils/base_msg.py
havoc420ubuntu c493db818a 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
2025-05-15 15:22:26 +00:00

25 lines
634 B
Python

import time
class BaseMsg:
def __init__(self, ctrl, msg):
self.ctrl = ctrl
self.msg = msg
def stop_force(self):
self.msg.mode = 0
self.msg.gait_id = 0
self.msg.duration = 0
self.msg.life_count += 1
self.ctrl.Send_cmd(self.msg)
self.ctrl.Wait_finish(0, 0)
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
self.msg.life_count += 1
self.ctrl.Send_cmd(self.msg)
if wait_time:
time.sleep(wait_time / 1000)