You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
coriolis() and Robot.copy().rne() fail for URDF/ETS robots: copied links keep their original parent #730
robot.coriolis(q, qd) raises ValueError: Link(...) is not in list for every URDF-based Robot I tried: UR5, KinovaGen3, LBR, and a two-link URDF with full inertials. DH robots are unaffected.
coriolis calls nofriction(), which calls copy(). The same error occurs for robot.copy().rne(q, qd, qdd) directly, while rne on the original robot works. Cause: after copy() each link's parent (and the joint's parent) still refers to the original robot's link object, so self.links.index(joint.parent) in Robot.rne (group_of_link_idx.get(...)) fails.
Repro (any URDF with dynamics):
importnumpyasnpfromroboticstoolbox.models.URDF.URDFRobotimportURDFRobotr=URDFRobot("/path/to/two_links_robot.urdf") # two revolute joints, with <inertial> elementsq, qd=np.array([0.3, -0.5]), np.array([0.1, 0.2])
r.rne(q, qd, np.zeros(2)) # OKr.copy().rne(q, qd, np.zeros(2)) # ValueError: Link(...) is not in listr.coriolis(q, qd) # ValueError: Link(...) is not in list
Workaround:C(q, qd) qd = rne(q, qd, 0) - gravload(q) + friction(qd). Checked against coriolis on the DH Puma 560 (max difference 4e-15), and against a Christoffel-symbol calculation from the mass matrix on the URDF robot.
Fix: have Robot.__deepcopy__ remap each link's parent (and children) onto the copied links, and add a regression test that copy() then rne equals the original.
Found while answering Adineh94's question in discussion #158.
Activity
huxiaoyi-ovo commentedon Oct 10, 2026
I'd like to take this issue. I've prepared and validated a fix in my fork and will open a PR shortly.