Skip to content

Commit 27bc80a

Browse files
Jepson2kclaude
andcommitted
collision: fix Windows mesh path + ty unresolved-import on pinokin
- Windows: rewrite package:// mesh refs to a plain POSIX path, not a file:// URI. coal strips the scheme naively, leaving an invalid '/D:/...' (leading slash before the drive letter) so assimp couldn't open the meshes. as_posix() yields '/abs/...' on POSIX and 'D:/abs/...' on Windows — both openable. - Lint: scope a ty unresolved-import override to PAROL6_ROBOT.py; the lint env's pinokin build can predate CollisionChecker (resolves fine at runtime). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e262df2 commit 27bc80a

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

parol6/PAROL6_ROBOT.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@ def _resolved_urdf_for_collision() -> str:
8787
src = Path(_urdf_path)
8888
text = src.read_text()
8989
mesh_root = Path(_mesh_dir) / "meshes"
90-
# `package://parol6/meshes/foo.STL` -> `file:///abs/path/to/foo.STL`.
91-
# Path.as_uri() yields a valid file URI on every platform (Windows drive
92-
# letters / backslashes break a hand-built `file://` + str(path)).
93-
rewritten = text.replace("package://parol6/meshes/", mesh_root.as_uri() + "/")
90+
# `package://parol6/meshes/foo.STL` -> a plain absolute path coal/assimp can
91+
# open. Use a POSIX-style path, NOT a `file://` URI: coal strips the scheme
92+
# naively, which on Windows leaves an invalid `/D:/...` (leading slash before
93+
# the drive letter). `as_posix()` gives `/abs/...` on POSIX and `D:/abs/...`
94+
# on Windows — both openable directly.
95+
rewritten = text.replace("package://parol6/meshes/", mesh_root.as_posix() + "/")
9496
fd, tmp_path = tempfile.mkstemp(prefix="parol6_collision_", suffix=".urdf")
9597
with os.fdopen(fd, "w") as f:
9698
f.write(rewritten)

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ include = [
112112
[tool.ty.overrides.rules]
113113
invalid-type-form = "ignore"
114114

115+
# pinokin is a compiled extension; the lint env's build can predate
116+
# CollisionChecker, so ty can't resolve that symbol (it resolves fine at runtime
117+
# and against a matching pinokin build).
118+
[[tool.ty.overrides]]
119+
include = ["parol6/PAROL6_ROBOT.py"]
120+
[tool.ty.overrides.rules]
121+
unresolved-import = "ignore"
122+
115123
[tool.setuptools]
116124
include-package-data = true
117125

0 commit comments

Comments
 (0)