New finding, 2026-08-09, while getting the test suite green again after unvendoring spatialgeometry (see the fix/unvendor-spatialgeometry PR) and bumping the effective spatialgeometry API to SG's current main.
tests/test_DHRobot.py::TestDHRobot::test_isspherical fails against SG's main:
ValueError: Cannot set RevoluteDH(...)'s scene_parent to RevoluteDH(...) --
RevoluteDH(...) is already a descendant of RevoluteDH(...), this would
create a cycle in the scene graph
The test builds several DHRobots that reuse the same RevoluteDH link instances in different combinations/orderings:
l0 = rp.RevoluteDH()
l1 = rp.RevoluteDH(alpha=-np.pi / 2)
l2 = rp.RevoluteDH(alpha=np.pi / 2)
l3 = rp.RevoluteDH()
r0 = rp.DHRobot([l0, l1, l2, l3])
r1 = rp.DHRobot([l0, l1])
r2 = rp.DHRobot([l1, l2, l3, l0]) # <-- fails here
Each DHRobot.__init__ sets link.scene_parent = link.parent for every link (BaseRobot._sort_links). SG recently added cycle-detection to scene_parent's setter (a real safety feature -- an undetected cycle in the scene graph previously caused update()'s root-finding walk to spin forever). Because l0/l1/l2/l3 are shared objects, r0's construction already wired l1.scene_parent = l0 (from the [l0,l1,l2,l3] chain); when r2 later tries l0.scene_parent = l3 in a different order, SG correctly notices l0 is already an ancestor of l3 from r0's wiring and refuses, since these are the same link objects, not fresh copies.
Open question, not yet investigated: is this DHRobot pattern (constructing multiple robots from overlapping/reordered sets of shared link objects) supposed to be supported? If so, DHRobot/BaseRobot needs to stop treating scene_parent as if each link belongs to exactly one robot's scene graph (possibly relevant to the Robot/Link kinematic-vs-scene-graph-state decoupling work tracked elsewhere). If not -- i.e. link objects were never meant to be shared across multiple DHRobot instances -- the fix is on the test side (construct fresh link instances per robot) and the test itself is what should change, not the library.
New finding, 2026-08-09, while getting the test suite green again after unvendoring
spatialgeometry(see thefix/unvendor-spatialgeometryPR) and bumping the effectivespatialgeometryAPI to SG's currentmain.tests/test_DHRobot.py::TestDHRobot::test_issphericalfails against SG'smain:The test builds several
DHRobots that reuse the sameRevoluteDHlink instances in different combinations/orderings:Each
DHRobot.__init__setslink.scene_parent = link.parentfor every link (BaseRobot._sort_links). SG recently added cycle-detection toscene_parent's setter (a real safety feature -- an undetected cycle in the scene graph previously causedupdate()'s root-finding walk to spin forever). Becausel0/l1/l2/l3are shared objects,r0's construction already wiredl1.scene_parent = l0(from the[l0,l1,l2,l3]chain); whenr2later triesl0.scene_parent = l3in a different order, SG correctly noticesl0is already an ancestor ofl3fromr0's wiring and refuses, since these are the same link objects, not fresh copies.Open question, not yet investigated: is this DHRobot pattern (constructing multiple robots from overlapping/reordered sets of shared link objects) supposed to be supported? If so,
DHRobot/BaseRobotneeds to stop treatingscene_parentas if each link belongs to exactly one robot's scene graph (possibly relevant to theRobot/Linkkinematic-vs-scene-graph-state decoupling work tracked elsewhere). If not -- i.e. link objects were never meant to be shared across multipleDHRobotinstances -- the fix is on the test side (construct fresh link instances per robot) and the test itself is what should change, not the library.