Skip to content

fix: give SceneNode.__init__ a pose= kwarg, not just Shape - #37

Merged
petercorke merged 1 commit into
jhavl:mainfrom
petercorke:fix/scenenode-pose-kwarg
Aug 9, 2026
Merged

fix: give SceneNode.__init__ a pose= kwarg, not just Shape#37
petercorke merged 1 commit into
jhavl:mainfrom
petercorke:fix/scenenode-pose-kwarg

Conversation

@petercorke

Copy link
Copy Markdown
Collaborator

Summary

SceneNode is the true base class for everything in the scene graph, but
the friendly pose: ndarray | SE3 constructor kwarg (with SE3 support)
was only ever implemented on Shape.__init__, one level below it.

  • SceneGroup subclasses SceneNode directly (not Shape), so
    SceneGroup(pose=SE3(...)) raised
    TypeError: SceneNode.__init__() got an unexpected keyword argument 'pose'
    -- only the raw T=ndarray kwarg worked.
  • CollisionShapeGroup happened to accept pose= already, but only as a
    side effect of going through CollisionShape/Shape for unrelated
    reasons (it needs to be a CollisionShape for isinstance checks
    elsewhere), not because pose was deliberately designed to work there.

This moves pose (and its SE3 -> ndarray conversion) down to
SceneNode.__init__ itself, so every scene-graph node -- including groups
-- gets it consistently and for the right reason. Shape.__init__'s own
base/pose deprecation logic is unchanged; it now just forwards its
resolved value up as pose= instead of T=.

  • SceneNode.__init__: T renamed to pose: ndarray | SE3, same
    conversion Shape.__init__ already did, plus a docstring (previously had
    none)
  • SceneNode.__deepcopy__ and Shape.__init__'s super().__init__()
    call updated to the new kwarg name
  • Regression test: SceneGroup(pose=...) with both SE3 and ndarray

Test plan

  • pytest tests/test_Shape.py tests/test_collision.py -- 157 passed
  • Full suite: pytest tests/ -- 160 passed
  • Confirmed SceneGroup(pose=SE3(1,2,3)) no longer raises
  • Confirmed base/pose mutual-exclusivity ValueError on Shape still fires unchanged

SceneNode is the true base class for the scene graph, but pose=
(with SE3 support) was only ever implemented on Shape.__init__, one
level below it. SceneGroup subclasses SceneNode directly and skips
Shape, so SceneGroup(pose=SE3(...)) raised TypeError -- only the raw
T=ndarray kwarg worked. CollisionShapeGroup happened to accept pose=
already, but only as a side effect of going through Shape/CollisionShape
for unrelated reasons.

Move pose (and its SE3->ndarray conversion) down to SceneNode.__init__
itself so every scene-graph node, groups included, gets it consistently.
@petercorke
petercorke merged commit c0670d4 into jhavl:main Aug 9, 2026
15 checks passed
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.

1 participant