Repository navigation
Add InteractiveScene camera debug helpers (S5) - #180
Merged
Merged
Conversation
Two thin wrappers over Genesis 1.0's
``scene.draw_debug_frustum(camera, color=...)`` and
``scene.draw_debug_trajectory(poss, radius, color)`` for inspecting
attached cameras at play time:
- ``draw_camera_frustums(camera_names=None, color=...)`` resolves names
against the scene's ``CameraSensor`` set and forwards each handle to
``draw_debug_frustum``. Returns the number drawn so callers can
detect mis-named selections without poking the viewer. A name that
resolves to a non-camera sensor raises ``TypeError``; an unknown
name raises ``KeyError``.
- ``draw_camera_trajectory(positions, radius, color)`` is a verbatim
pass-through to ``draw_debug_trajectory`` — the caller owns the
positions buffer so no history sits on the scene side.
Both helpers raise ``RuntimeError`` if called before ``build()`` since
Genesis allocates the camera handles in ``CameraSensor.pre_build_genesis``.
Added a public ``gs_camera`` property on ``CameraSensor`` so the scene
helper reads the underlying handle through the same surface external
debug code uses, rather than reaching into ``_cam``.
Tests use a synthetic ``_FakeGsScene`` that records every debug-draw
call plus a ``_FakeCameraSensor`` that exposes ``gs_camera``; a
monkeypatch routes ``isinstance(s, CameraSensor)`` through the fake
class so no real Genesis env is needed.
Bilingual ``Camera debug helpers`` section added to
``docs/concepts/scene.{en,zh}.md``.
This ships **S5.1** of the Genesis 1.0 migration; the remaining S5
sub-tasks (full xacro support on ``ArticulationCfg``, ImGui slider
bridge) are deliberately carved as post-migration polish — neither is
on the critical path for the ``dev/bump-genesis-1.0 → main`` promotion.
KraHsu
added a commit
that referenced
this pull request
Jun 5, 2026
Add InteractiveScene camera debug helpers (S5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase S5 of the Genesis 1.0 migration (ADR-0001). Ships the camera
debug helpers — the slot in the S5 scope with a clean v1.0 implementation —
and explicitly carves the other two sub-tasks (full xacro support on
ArticulationCfg, ImGui slider bridge) as post-migration polish.Neither is on the critical path for the
dev/bump-genesis-1.0 → mainpromotion.
Changes
src/genelab/scene/interactive_scene.py— two thin wrappers overGenesis 1.0's
scene.draw_debug_frustum/scene.draw_debug_trajectory:draw_camera_frustums(camera_names=None, color=...)resolvesnames against the scene's
CameraSensorset; returns the numberdrawn so callers can detect mis-named selections.
draw_camera_trajectory(positions, radius, color)is a verbatimpass-through.
Both raise
RuntimeErrorif called pre-build().src/genelab/sensor/camera.py— added a publicgs_cameraproperty so external debug code reaches the Genesis handle through
the same surface instead of
_cam.tests/test_scene_camera_debug.py— 7 new tests via a_FakeGsScenethat records every debug-draw call; a monkeypatchroutes
isinstance(s, CameraSensor)through fakes so no realGenesis env is needed.
docs/concepts/scene.{en,zh}.md— newCamera debug helperssection.
CHANGELOG.md—### Addedentry.v1.0 inspection notes (other S5 sub-tasks)
Articulationto dispatch on.xacro.xacro/.urdf.xacrofiles when loaded viags.morphs.URDF(the parser is invoked atURDFmorph build time). GeneLab'sArticulationis still MJCF-only — adding URDF/xacro is a real surface change toArticulationCfg(parallelurdf_pathfield + dispatch inspawn()+ asset_zoo updates).gs.morphs.URDF(file="...xacro", xacro_args={...})directly; promoting it toArticulationCfgis a follow-up after the migration lands onmain..xacrorobot underasset_zooArticulationCfgURDF support landing first.draw_camera_frustums()+draw_camera_trajectory()scene.draw_debug_frustum(camera, color)andscene.draw_debug_trajectory(poss, radius, color).--debug-camerasCLI flagInteractiveSceneCfg.debug_camerasflag and a one-line call from the step hook.bridges/dearpygui.pyalready provides a working twist-bridge (over DearPyGui's own loop), so the ImGui-native equivalent is an additive, not a blocker.SimulationCfg.viewer_imguiflag already plumbs Genesis's ImGui overlay; the slider bridge is a separate (display-required) feature.Test plan
ruff checkruff format --checkpyright— 0 errors, 0 warningspytest— 605 passed (+7 scene-debug), 0 failedmkdocs build --strictRisks
build(). Play-time hooks (e.g. a customEnvHookor aRecorderBridgeextension) need to register after the env'sbuild phase — same constraint every sensor wrapper already obeys.
helpers walk
scene._sensors. A scene with multiple camerasattached to the same link works fine; mistyping the name surfaces
with a
KeyErrorlisting the available sensor names.Notes
post-migration polish. The integration branch is then ready for the
promotion PR
dev/bump-genesis-1.0 → main. At ~22 commitsahead of
main, the diff is reviewable in one pass.parallel housekeeping; carving it the same way unless you want it
before promotion.