在使用roboticstoolbox-python计算关节扭矩时

import roboticstoolbox as rtb
import numpy as np
robot = rtb.models.UR10()
q = np.array([0, -np.pi/4, np.pi/4, 0, np.pi/4, 0])
qd = np.array([0, 0, 0, 0, 0, 0])
qdd = np.array([0, 0, 0, 0, 0, 0])
robot.gravity = [0, 0, -9.81]
try:
    torques = robot.rne(q, qd, qdd)
    print("Calculated joint torques:", torques)
except Exception as e:
    print("Error while calculating torques:", e)

对于URDF定义的机械臂可能会遇到下面报错:

list indices must be integers or slices, not NoneType

这是因为当前官方版本的rne函数存在bug,固定关节的机器人会遇到次bug。

但是此bug已经有人修复,官方尚未合并,请移步官方仓库Pull requests查看:Fixing RNE for URDFs robots with fixed joints #408

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐