Skip to content

fix: remove vendored spatialgeometry, restore real dependency - #583

Merged
petercorke merged 4 commits into
mainfrom
fix/unvendor-spatialgeometry
Aug 9, 2026
Merged

petercorke merged 4 commits into
mainfrom
fix/unvendor-spatialgeometry

Conversation

@petercorke

@petercorke petercorke commented Aug 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

The 1b522e65 vendoring ("bundle spatialgeometry as pure-Python") was a
temporary workaround for depending on an unreleased git branch. It's now
stale relative to both the current PyPI release and SG's own in-progress
main, and Link.py's SceneGroup(scene_children=...) call broke against
SG main's rename to a positional initlist/**kwargs signature -- this
only surfaced in dev environments with SG's sibling checkout
editable-installed, since a real pip install roboticstoolbox-python always
got the frozen vendored snapshot instead.

Removes src/spatialgeometry/ and restores spatialgeometry as a normal
pyproject.toml dependency, pinned to a specific commit on SG's unreleased
main (1.4 draft) since that's the API this code now targets -- switch to a
normal >=1.4.0 constraint once spatialgeometry actually cuts that
release.

Also fixes tests/test_collision.py's mesh dict tests, which used
nonexistent placeholder filenames ("robot.stl", "test.stl") -- SG main
added a real os.path.isfile() check in Mesh.__init__ that these never
exercised before.

Also fixes (found via CI after the initial push)

Follow-up (filed separately, not blocking this PR)

Test plan

  • rtb.models.Panda() (and other URDF robots) construct again
  • Full local suite: 724 passed, 9 skipped, 0 failed

The 1b522e6 vendoring ("bundle spatialgeometry as pure-Python") was a
temporary workaround for depending on an unreleased git branch. It's
now stale relative to both the current PyPI release and SG's own
in-progress main, and Link.py's SceneGroup(scene_children=...) call
broke against SG main's rename to a positional initlist/**kwargs
signature -- this only surfaced in dev environments with SG's sibling
checkout editable-installed, since a real `pip install
roboticstoolbox-python` never saw the divergence (it always got the
frozen vendored snapshot).

Removes src/spatialgeometry/ and restores spatialgeometry as a normal
dependency, pinned to a specific commit on SG's unreleased main (1.4
draft) since that's the API this code now targets -- switch to a
normal ">=1.4.0" constraint once spatialgeometry actually cuts that
release.

Also fixes tests/test_collision.py's mesh dict tests, which used
nonexistent placeholder filenames ("robot.stl", "test.stl") -- SG main
added a real os.path.isfile() check in Mesh.__init__ that these never
exercised before.
rtbtool.py deliberately wildcard-imports from spatialmath/
spatialgeometry/roboticstoolbox to populate the interactive shell's
namespace. SG's unreleased main added a new Path shape class,
exported via __all__, which shadowed the earlier `from pathlib import
Path` for the rest of the module -- the script's own internal
filesystem-path handling (examples_path(), main()'s script-loading)
started resolving to spatialgeometry.Path instead, crashing with
"could not convert string to float" the moment a real path string hit
it.

Switches to `import pathlib` + fully-qualified pathlib.Path(...) at
the two internal call sites, leaving the wildcard imports (and the
bare `Path` available to someone typing at the rtbtool prompt) alone.

Fixes #582. A naming discussion on spatialgeometry's side (Path isn't
released yet, so renaming it there is still on the table -- matplotlib
hit the same collision and never exported a bare Path either) is
deferred to a separate session.
r2 = DHRobot([l1, l2, l3, l0]) reused link instances that r0/r1 had
already wired with the opposite parent/child relationship (l0 root,
l1 its child) -- SG's new scene-graph cycle detection correctly
rejects this as a genuine conflict (a link's scene_parent is
single-valued, so the same instance can't simultaneously be "l0 is
r0's root" and "l0 is r2's last child").

isspherical() is purely DH-parameter-based (DHRobot.py), so fresh
link instances with the same parameter values are equivalent for
this test -- r0/r1 can still share (same relative order, no
conflict), only r2 needs its own set.

Fixes #581.
Link-sharing across robots should be fine -- links are meant to be
stateless (desiderata.md). It only breaks today because Link/BaseLink
inherits SceneNode, bolting single-valued scene-graph state onto what
should be a pure kinematic-model object. Corrects the previous
commit's framing, which read as if reusing link instances across
robots was itself the problem.
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (0bb9645) to head (6994fad).

Files with missing lines Patch % Lines
src/roboticstoolbox/bin/rtbtool.py 0.00% 3 Missing ⚠️
src/roboticstoolbox/robot/Link.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #583   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        142     142           
  Lines      13788   13788           
=====================================
  Misses     13788   13788           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@petercorke
petercorke merged commit 621480d into main Aug 9, 2026
19 checks passed
@petercorke
petercorke deleted the fix/unvendor-spatialgeometry branch October 22, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtbtool.py: spatialmath wildcard import shadows pathlib.Path

1 participant