coriolis() and Robot.copy().rne() fail for URDF/ETS robots: copied links keep their original parent

Ouverte
#730 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@huxiaoyi-ovo y travaille déjà.

Depuis le 10/10/2026.

  • #732 par @huxiaoyi-ovo — ouverte

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
python
Domaine
robotics

Piste de recherche

Start with Robot.copy() and Robot.__deepcopy__, then Robot.rne where self.links.index(joint.parent) fails, and trace how coriolis reaches nofriction(). Check linked PR #732 first, since it already targets this fix. Done means each copied link's parent and children point to copied links, and copy().rne(q, qd, qdd) matches the original robot's result.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug

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):

import numpy as np
from roboticstoolbox.models.URDF.URDFRobot import URDFRobot

r = URDFRobot("/path/to/two_links_robot.urdf")   # two revolute joints, with <inertial> elements
q, qd = np.array([0.3, -0.5]), np.array([0.1, 0.2])
r.rne(q, qd, np.zeros(2))           # OK
r.copy().rne(q, qd, np.zeros(2))    # ValueError: Link(...) is not in list
r.coriolis(q, qd)                   # ValueError: Link(...) is not in list

Notes

  • #722 lists coriolis -> ValueError under "models with no dynamic parameters". That attribution is wrong: this is the error, and it happens on models that do have dynamics.
  • Same family as #705: state that does not survive copy().
  • 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.

Langage dominant
C++
Étoiles
3.6k
Forks
649
Merge moyen
22 h 49 min
PR mergées (30 j)
146

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de petercorke/robotics-toolbox-python

Toutes les issues de petercorke/robotics-toolbox-python

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.