from pyrep import PyRep
from pyrep.robots.arms.ur5 import UR5
from pyrep.objects.dummy import Dummy
# 启动 CoppeliaSim 环境
pr = PyRep()
# 加载场景。这里假设你的场景文件名为 'ur5_scene.ttt'
pr.launch('/home/yong/disi/Gym_Robot_Path_Following-master/path_following/envs/simulation/pass1.ttt', headless=False)
pr.start()
# 创建 UR5 机器人的实例
ur5 = UR5()
# 假设我们想要获取末端执行器的雅可比矩阵
# 首先,我们需要获取末端执行器的句柄
tip = ur5.get_tip()
# 获取雅可比矩阵
# linear: 是否包含线性部分, angular: 是否包含角部分
jacobian = ur5.get_jacobian()
for j in ur5.joints:
j.get_handle()
print("雅可比矩阵: \n", jacobian)
# 关闭 PyRep 环境
pr.stop()
pr.shutdown()
运行时候出现了sim.simCheckIkGroup()出现了 ‘The call failed on the V-REP side. Return value: %d’ % ret)
RuntimeError: The call failed on the V-REP side. Return value: -1
QObject::~QObject: Timers cannot be stopped from another thread
经过研究发现是原来的.ttt文件没有设置好ik链,勾选Explicit handing 后运行成功,但是还未验求得的雅可比矩阵证是够正确。