This commit is contained in:
Ziwei.He 2025-05-28 10:09:15 +08:00
parent b96c979023
commit 8000d3f14e
5 changed files with 9 additions and 4 deletions

View File

@ -336,7 +336,7 @@ class MassageRobot:
# 线程 # 线程
self.exit_event.clear() self.exit_event.clear()
self.arm_measure_thread = threading.Thread(target=self.arm_measure_loop) self.arm_measure_thread = threading.Thread(target=self.arm_measure_loop)
self.arm_control_thread = threading.Thread(target=self.arm_command_loop_traj) self.arm_control_thread = threading.Thread(target=self.arm_command_loop)
# 线程启动 # 线程启动
self.arm_measure_thread.start() ## 测量线程 self.arm_measure_thread.start() ## 测量线程
position,quat_rot = self.arm.get_arm_position() position,quat_rot = self.arm.get_arm_position()
@ -496,11 +496,12 @@ if __name__ == "__main__":
try: try:
robot_thread = threading.Thread(target=robot.start) robot_thread = threading.Thread(target=robot.start)
robot_thread.start() robot_thread.start()
except KeyboardInterrupt: except KeyboardInterrupt:
print("用户中断操作。") print("用户中断操作。")
except Exception as e: except Exception as e:
print("Exception occurred at line:", e.__traceback__.tb_lineno) print("Exception occurred at line:", e.__traceback__.tb_lineno)
print("发生异常:", e) print("发生异常:", e)
robot_thread.join() # 等待机械臂线程结束
# robot.arm.disableRobot() # robot.arm.disableRobot()

View File

@ -8,7 +8,9 @@ mass_rot: [0.11, 0.11, 0.11]
# P # P
# stiff_tran: [300, 300, 300] # stiff_tran: [300, 300, 300]
# stiff_rot: [7, 7, 7] # stiff_rot: [7, 7, 7]
stiff_tran: [270, 270, 270] # stiff_tran: [270, 270, 270]
# stiff_rot: [11, 11, 11]
stiff_tran: [0, 0, 0]
stiff_rot: [11, 11, 11] stiff_rot: [11, 11, 11]
# stiff_tran: [100, 100, 100] # stiff_tran: [100, 100, 100]
# stiff_rot: [1, 1, 1] # stiff_rot: [1, 1, 1]

View File

@ -1,9 +1,11 @@
import struct import struct
import serial import serial
import serial.tools.list_ports
import numpy as np import numpy as np
import atexit import atexit
import threading import threading
import time import time
import yaml
import subprocess import subprocess
import psutil import psutil