Skip to content

Official Codebase of 3DCodeVerse

Python

joints_export: the articulation sheet's views are named in conventions, not sliced from the quick set

gaoypenge1e93a024ace
diff --git a/harness/codeverse3d/conventions.py b/harness/codeverse3d/conventions.py
index 31777050..75d0e353 100644
--- a/harness/codeverse3d/conventions.py
+++ b/harness/codeverse3d/conventions.py
@@ -139,6 +139,12 @@ OBJECT_VIEWS_QUICK: tuple[ViewPreset, ...] = tuple(
_OBJECT_VIEW_BY_NAME[n] for n in ("front_right_high", "back_left_high", "front", "top")
)
+#: The articulation sheet's three views per pose (``joints_export.render_poses``) — by
+#: NAME too: it was ``OBJECT_VIEWS_QUICK[:3]``, which a reorder of the quick set changes.
+ARTICULATION_VIEWS: tuple[ViewPreset, ...] = tuple(
+ _OBJECT_VIEW_BY_NAME[n] for n in ("front_right_high", "back_left_high", "front")
+)
+
#: the view a one-camera comparison (the reference silhouette) takes, in preference order;
#: ``*_34`` are pre-D47 stored runs
FRONT_VIEW_NAMES: tuple[str, ...] = ("front", "front_right_high", "front_left_high",
diff --git a/harness/codeverse3d/spatial/joints_export.py b/harness/codeverse3d/spatial/joints_export.py
index 570665ad..7db8c95d 100644
--- a/harness/codeverse3d/spatial/joints_export.py
+++ b/harness/codeverse3d/spatial/joints_export.py
@@ -19,7 +19,7 @@ import numpy as np
import trimesh
from codeverse3d.contracts.artifacts import RenderSet
-from codeverse3d.conventions import OBJECT_VIEWS_QUICK, ViewPreset
+from codeverse3d.conventions import ARTICULATION_VIEWS, ViewPreset
from codeverse3d.spatial._render_common import out_directory
from codeverse3d.spatial.joints_model import Joint, Robot, fk, resolve_q
from codeverse3d.spatial.joints_poses import limit_poses
@@ -105,12 +105,12 @@ def render_poses(
width: int = 512,
height: int = 512,
) -> list[tuple[str, RenderSet]]:
- """Export one GLB per pose, render ``views`` for each (default: 3 quick views)
+ """Export one GLB per pose, render ``views`` for each (default: ``ARTICULATION_VIEWS``)
and write ``out_dir/articulation_sheet.png`` (rest / each joint at lower & upper
by default — the image the judge sees). Returns ``[(pose_name, RenderSet)]``."""
out_dir = out_directory(out_dir)
poses = poses if poses is not None else limit_poses(robot)
- views = tuple(views or OBJECT_VIEWS_QUICK[:3])
+ views = tuple(views or ARTICULATION_VIEWS)
results: list[tuple[str, RenderSet]] = []
tiles: list[tuple[str, Path]] = []
for label, q in poses:
diff --git a/harness/tests/urdf_joints/test_export.py b/harness/tests/urdf_joints/test_export.py
index 31f63d42..a03f2ec9 100644
--- a/harness/tests/urdf_joints/test_export.py
+++ b/harness/tests/urdf_joints/test_export.py
@@ -81,6 +81,8 @@ def test_render_poses_with_fake_renderer_builds_sheet(tmp_path, monkeypatch):
out = render_poses(r, tmp_path / "ren")
assert [label for label, _ in out] == ["rest", "hinge@upper"]
assert len(calls) == 2 and all(c.exists() for c in calls)
+ # the judge's sheet shows these views by name, whatever order the quick set lists
+ assert [v.name for v in out[0][1].views] == ["front_right_high", "back_left_high", "front"]
sheet = tmp_path / "ren" / ARTICULATION_SHEET_NAME
assert sheet.is_file() and Image.open(sheet).size[0] > 32