This commit is contained in:
LiangShiyun 2025-06-13 14:00:00 +08:00
parent 5461a09eee
commit e591f09604
128 changed files with 90 additions and 12 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -100,9 +100,6 @@ class DashscopeClient:
with open('LLM/config/trajectory_config/body_part_prompts.txt', 'r') as f:
self.body_part_prompts = f.read().strip()
self.body_part_message = [{'role': 'system', 'content': self.body_part_prompts}]
with open('LLM/config/trajectory_config/reason.txt', 'r') as f:
self.reason_prompts = f.read().strip()
self.reason_message = [{'role': 'system', 'content': self.reason_prompts}]
with open('LLM/config/trajectory_config/shoulder_limit_prompts.txt', 'r') as f:
self.shoulder_limit_prompts = f.read().strip()

Binary file not shown.

View File

@ -1981,11 +1981,10 @@ class TaskBase(smach.State):
self.resources.logger.log_blue("检测到跳过,准备进入跳过流程")
self.resources.robot.is_execute = False
return True
if self.resources.motion_task[12] == True:
if self.resources.choose_task == "shockwave":
self.resources.robot.shockwave.on() # 开启冲击波
self.resources.robot.shockwave.p_set(level = self.resources.press)
self.resources.robot.shockwave.f_set(level = self.resources.frequency)
if self.resources.choose_task == "shockwave":
self.resources.robot.shockwave.on() # 开启冲击波
self.resources.robot.shockwave.p_set(level = self.resources.press)
self.resources.robot.shockwave.f_set(level = self.resources.frequency)
if self.resources.motion_task[5] == "point" or self.resources.motion_task[5] == "point_rub":
use_algorithm = self.resources.use_algorithm
if self.resources.choose_task != "ion" and self.resources.motion_task[5] == "point":

View File

@ -76,6 +76,8 @@ from matplotlib.animation import FuncAnimation
import select
import importlib.util
current_file_path = os.path.abspath(__file__)
MassageRobot_Dobot_Path = os.path.dirname(os.path.dirname(os.path.dirname(current_file_path)))
print(MassageRobot_Dobot_Path)
@ -88,6 +90,75 @@ from VortXDB.client import VTXClient
当你注册多个函数时它们的执行顺序遵循先进后出的顺序LIFOLast In, First Out也就是说最后注册的函数会最先执行
"""
# 定义模块加载的函数
def load_class_from_pyc(pyc_path, class_name, module_name):
"""
动态加载 .pyc 文件并尝试访问其中的类
:param pyc_path: .pyc 文件路径
:param class_name: 需要访问的类名
:param module_name: 模块的名称用于调试和错误信息
:return: 类对象如果加载和访问成功
:raises: 文件未找到或类未定义等异常
"""
# 检查文件是否存在
if not os.path.exists(pyc_path):
raise FileNotFoundError(f"Module file '{pyc_path}' not found.")
try:
# 动态加载模块
spec = importlib.util.spec_from_file_location(module_name, pyc_path)
module = importlib.util.module_from_spec(spec)
sys.modules[module_name] = module
spec.loader.exec_module(module)
# 尝试获取指定的类
class_obj = getattr(module, class_name, None)
if class_obj is None:
raise AttributeError(f"Class '{class_name}' not found in module '{module_name}'.")
return class_obj # 返回类对象
except Exception as e:
raise RuntimeError(f"Failed to load class '{class_name}' from module '{module_name}': {str(e)}")
# 定义 .pyc 文件的路径
shockwave_pyc_path = '/home/jsfb/jsfb_ws/hardware_bin/shockwave.pyc'
thermotherapy_pyc_path = '/home/jsfb/jsfb_ws/hardware_bin/thermotherapy.pyc'
stone_pyc_path = '/home/jsfb/jsfb_ws/hardware_bin/stone.pyc'
ion_pyc_path = '/home/jsfb/jsfb_ws/hardware_bin/ion.pyc'
heat_pyc_path = '/home/jsfb/jsfb_ws/hardware_bin/heat.pyc'
# 使用封装的函数加载各个模块和类
try:
Shockwave = load_class_from_pyc(shockwave_pyc_path, "Shockwave", "shockwave")
print("Shockwave class loaded successfully.")
except Exception as e:
print(f"Error loading Shockwave: {str(e)}")
try:
Thermotherapy = load_class_from_pyc(thermotherapy_pyc_path, "Thermotherapy", "thermotherapy")
print("Thermotherapy class loaded successfully.")
except Exception as e:
print(f"Error loading Thermotherapy: {str(e)}")
try:
Stone = load_class_from_pyc(stone_pyc_path, "Stone", "stone")
print("Stone class loaded successfully.")
except Exception as e:
print(f"Error loading Stone: {str(e)}")
try:
Ion = load_class_from_pyc(ion_pyc_path, "Ion", "ion")
print("Ion class loaded successfully.")
except Exception as e:
print(f"Error loading Ion: {str(e)}")
try:
Heat = load_class_from_pyc(heat_pyc_path, "Heat", "heat")
print("Heat class loaded successfully.")
except Exception as e:
print(f"Error loading Heat: {str(e)}")
def track_function(function_name,log = False):
def before(self, *args, **kwargs):
self.current_function = function_name
@ -1821,12 +1892,16 @@ if __name__ == "__main__":
# pose1 = [0.353467,-0.1349880,0.403604,-180.0000*np.pi/180,-30.0000*np.pi/180,0.0042*np.pi/180]
# pose1 = [0.3736677762541832, 0.11722785977006844, 0.3835904171566223, -3.141592653589793, -0.5235987755982988, 7.330382858376184e-05]
# pose1 = [0.4486,0.1172,0.2536,np.pi,-0.5236,0]
pose1 = [0.44866777605267877, 0.11723335755720732, 0.2536866065889565, 2.7069577869199146, -0.7176783797852828, 0.0]
# pose1 = [0.44866777605267877, 0.11723335755720732, 0.2536866065889565, 2.7069577869199146, -0.7176783797852828, 0.0]
robot.set_position(pose = pose1)
# robot.set_position(pose = pose1)
# print("get_pos:",robot.ge)
print("arm_position1:",robot.arm.get_arm_position())
print("end_position1:",robot.arm.get_end_position())
robot.shockwave = Shockwave()
robot.shockwave.on()
# print("joint1:",robot.arm.getAngel())
# robot.arm.move_joint(q=robot.arm.init_pos)
# # robot.set_position([0.12189544299531646, -0.31364670468715944, 0.00733569473686102, 2.153932270623249, 0.6209756952505509, 0.0])
@ -1850,9 +1925,11 @@ if __name__ == "__main__":
time.sleep(1)
except KeyboardInterrupt:
# robot_thread.join()
robot.shockwave.off()
print("用户中断操作。")
except Exception as e:
# robot_thread.join()
robot.shockwave.off()
print("Exception occurred at line:", e.__traceback__.tb_lineno)
print("发生异常:", e)

View File

@ -176,6 +176,7 @@ class dobot_nova5:
self.filter_matirx = np.zeros((1,7)) # 位姿伺服用
# self.filter_matrix = np.zeros((1,6)) # 角度伺服用
self.dashboard.SpeedFactor(30)
sleep(1)
self.is_standby = False
self.move_joint_jog_range(q=np.zeros(6))
@ -393,7 +394,6 @@ class dobot_nova5:
targetAngle = self.__transform_rad_2_deg(q)
currentAngle = np.array(currentAngle)
targetAngle = np.array(targetAngle)
self.dashboard.SpeedFactor(50)
for i in range(len(targetAngle)):
while np.abs(np.abs(currentAngle[i]) - targetAngle[i]) >threshold[i]:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

View File

@ -376,7 +376,7 @@ class CoordinateTransformer:
# 机械臂末端坐标系到基座坐标系
transformed_normal = R.from_quat(self.quaternion).as_matrix() @ arm_normal
print("transformed_normal:",arm_normal,transformed_normal)
# print("transformed_normal:",arm_normal,transformed_normal)
return {
'label': data['label'],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 395 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Some files were not shown because too many files have changed in this diff Show More