写不NG流程:添加传送带运行、步进电机移动、线条个数方便后续夹爪的抓取、气动夹爪控制流程

This commit is contained in:
2026-01-09 17:52:52 +08:00
parent 8821b30689
commit a8a35545cc
7 changed files with 410 additions and 43 deletions

View File

@ -112,8 +112,8 @@ class DMMotorController:
:param v_desired: 目标速度rad/s, 范围[-30, 30]
"""
try:
# 归零 + 发送运动指令
self.motor_control.set_zero_position(self.motor)
# 发送运动指令
# self.motor_control.set_zero_position(self.motor)
self.motor_control.control_Pos_Vel(self.motor, p_desired, v_desired)
time.sleep(0.1)
print(f"✅ 位置-速度控制:位置={p_desired}rad | 速度={v_desired}rad/s")
@ -198,6 +198,7 @@ class DMMotorController:
except Exception as e:
print(f"修改电机限位参数失败: {str(e)}")
def __del__(self):
"""析构函数:确保程序退出时失能电机、关闭串口"""
try:
@ -211,7 +212,6 @@ class DMMotorController:
except Exception as e:
print(f" 析构函数执行警告:{str(e)}")
def dm_motor_control():
# 1.创建电机控制器实例
motor_controller = DMMotorController(