Require backend physics for stocked shelf preview

This commit is contained in:
eust-w 2026-06-26 16:18:45 +08:00
parent f3cdcab991
commit 6e9ac3db4c
10 changed files with 3701 additions and 3493 deletions

View File

@ -70,13 +70,10 @@ MOTRIXSIM_REMOTE_SCENE=/tmp/motrixsim-web-composed/active_g1_store_scene.xml
MOTRIXSIM_LOCAL_PORT=18090
```
The first screen is now a Scene Builder. It can compose a base scene, one live
robot manifest, and front-end primitive objects into a single Three.js preview.
Use `Build Preview` for visual composition, or `Physical Scene` to load the
native Franka + cube MotrixSim scene where collision is computed by the backend.
The `G1 + Store + blocks physics` preset uses `http://127.0.0.1:18090/manifest`
and is a backend-composed MJCF scene, so G1, store shelves/products, and demo
objects share one MotrixSim collision world.
The first screen is now a Scene Builder for the backend-required product path.
The default `G1 + 货架商品后端物理场景` preset uses
`http://127.0.0.1:18090/manifest`; it loads one real MotrixSim MJCF runtime and
binds every visible shelf/product/robot object to `/state`.
When the matching bridge exposes `POST /compose`, Scene Builder object
Add/Remove/Clear operations regenerate the combined MJCF on the backend and
reload the live manifest. Those objects are real MotrixSim bodies with
@ -85,14 +82,15 @@ For physical store scenes, the bridge also publishes product-level
`editableGroup` metadata derived from real runtime body poses. Store shelf
frames, plates, and pre-stocked products are fixed environment bodies so they
keep their collision shape and do not avalanche when the simulator resumes.
User-added primitive props remain real dynamic bodies that can be edited while
paused and then released back to MotrixSim physics. Repositioning a fixed shelf
layout should be handled by rebuilding the composed scene, not by keeping the
shelf as a free runtime body.
Backend-compatible added props remain real dynamic bodies when the backend
adapter creates them. The current default product scene starts with no added
props; uploaded mesh assets are disabled until a backend adapter can turn them
into real MJCF bodies. Repositioning a fixed shelf layout should be handled by
rebuilding the composed scene, not by keeping the shelf as a free runtime body.
The UI, diagnostics panel, JSON acceptance package, and HTML acceptance report
now expose object physics tiers: backend dynamic bodies, backend fixed bodies,
backend state-only bodies, and visual-only objects. This is the product
boundary for "real backend physics" versus front-end preview assets.
backend state-only bodies, and visual-only objects. Product acceptance requires
`visual-only=0`.
To load a remote manifest:
@ -141,12 +139,14 @@ npm run verify:real-backend -- \
```
This probe calls the live MotrixSim bridge, not a mock. It checks editable
entity groups in `/manifest`, calls real backend `/compose` for the
G1/store/built-in primitive scene, verifies the composed object bodies in `/state`,
entity groups in `/manifest`, calls real backend `/compose` for a controlled
legacy dynamic-body edit test, verifies the composed object bodies in `/state`,
writes a pose for one composed dynamic body, verifies fixed pre-stocked product
bodies reject `set_body_pose`, resumes the simulator, confirms fixed shelf
anchors do not drift, checks a lifted dynamic prop drops under backend physics,
and measures compact pause/resume control latency.
and measures compact pause/resume control latency. After verification,
`npm run real-backend:up` restores the default stocked shelf scene with no added
test objects.
For handoff or acceptance, prefer the single product gate:
@ -176,12 +176,11 @@ object/body binding counts. It also exports the builder config, imports that
file in a clean browser context, and verifies the same backend physical scene is
restored.
The gate also validates the object physics-tier evidence. The product physical
scene must include backend dynamic bodies and backend fixed environment bodies;
visual-only objects are allowed only as explicit, counted preview artifacts.
The product gate also validates builder physics coverage: default user-added
props must be backend dynamic bodies. A separate negative browser path uploads a
local OBJ asset and confirms the in-page acceptance fails instead of treating the
visual asset as real collision physics.
scene must include backend fixed environment bodies and backend state-only robot
links while keeping `visual-only=0`. The product gate also validates builder
physics coverage: the default stocked shelf path has no added props, and any
uploaded OBJ asset without a backend adapter is blocked instead of being added
as a visual-only object.
For release handoff, `npm run product:release-check` first builds `dist/`,
checks the JavaScript gzip bundle budget, then forces the browser gate through
@ -250,21 +249,22 @@ It is not yet a perfect renderer for every MotrixSim feature. Unsupported or
private features still need explicit adapters or a server-side render/video
fallback.
Scene Builder visual composition does not create a new MotrixSim physics world.
Added front-end objects are preview-only unless they are sent through a physical
compose endpoint. The current physical compose path supports the
`G1 + Store + blocks physics` preset and the built-in primitive object set.
Scene Builder product composition must stay connected to a MotrixSim backend
state source. Added objects are accepted only when a backend adapter creates
real MJCF bodies. The current default physical path is the stocked shelf scene on
port `18090`; assets without adapters are visible in the asset library but cannot
be inserted into the product physics scene.
## 页面内上传与组装(已支持)
- 左侧「场景上传 / 上传场景包」支持一次选择 `.json` manifest 和关联的 mesh / texture / bin 文件。manifest 至少需要包含 `version` 与 `objects`。
- 上传后会自动插入到场景下拉列表首位,并把 manifest 内相对路径(例如 `meshes/robot.obj`、`textures/base.png`)匹配到同批上传的本地文件,改写为浏览器可加载的 `blob:` URL。
- 左侧「资产库 / 上传资产」支持 `.gltf/.glb/.obj/.stl`,也可以同时选择 `.bin/.png/.jpg/.webp/.ktx2/.mtl` 等 sidecar 文件;`.gltf` 内部的 buffer / image 相对引用会同步改写。
- 点击资产卡片会把该对象加入当前场景列表,可继续调整位置(X/Y/Z 输入框)和通过左键拖拽编辑(暂停时可拖拽)。
- 资产卡片和已添加对象都会标明物理等级:内置 primitive 在支持 `/compose` 的物理场景中可生成后端动态 body,本地上传 mesh 默认标记为“仅视觉”。
- 已有后端适配的资产才能加入产品物理场景,并可继续调整位置(X/Y/Z 输入框)和通过左键拖拽编辑(暂停时可拖拽)。
- 未接入后端适配的上传 mesh 会显示“需后端适配”,添加按钮保持禁用,不会作为“仅视觉”物体混入产品验收场景。
- 上传面板支持拖放文件;「清空自定义」会清理上传资产;「清空场景」会移除当前上传场景并回到默认场景列表。
边界:本地上传 mesh 默认是 Three.js 可视资产。它可以预览和摆放,但不会自动变成 MotrixSim 后端碰撞体。需要真实碰撞时,仍要通过后端 `/compose` 把对象转成 MJCF body / geom;当前后端物理组合只覆盖内置 primitive 对象。
边界:本地上传 mesh 不会自动变成 MotrixSim 后端碰撞体。需要真实碰撞时,必须先通过后端适配把对象转成 MJCF body / geom;适配完成前产品模式不允许仅视觉加入。
The Franka Panda MJCF robot scene has been verified as a real robot asset
preview: 59 manifest objects, 58 loaded OBJ/STL meshes, and zero mesh fallback.
@ -278,8 +278,7 @@ Additional remote scenes verified:
fallback, desktop/mobile nonblank.
- Go2 quadruped scene: 34 objects, 33 loaded meshes, 12 joints exposed, zero
fallback, desktop/mobile nonblank.
- G1 + Store + demo blocks physical scene: served from bridge port 18090 with
shared backend collision bodies for the robot, shelves, fixed stock products,
and dynamic demo primitives. Store shelf/product groups are exposed for
inspection, while only backend dynamic primitives are pose-editable through
`/control`.
- G1 + stocked shelf backend physical scene: served from bridge port 18090 with
shared backend collision bodies for the robot, shelves, and fixed stock
products. Store shelf/product groups are exposed for inspection, and product
acceptance requires `631/631` body bindings and `visual-only=0`.

View File

@ -19,7 +19,7 @@ flowchart LR
Compact --> Bridge
Control --> Bridge
Compose --> Bridge
Bridge --> Runtime["MotrixSim runtime\nG1 + store + blocks physics scene"]
Bridge --> Runtime["MotrixSim runtime\nG1 + stocked shelf backend physics scene"]
```
Important properties:
@ -31,12 +31,15 @@ Important properties:
- Store shelf frames, plates, and pre-stocked products are fixed environment
collision bodies. This prevents the shelf scene from toppling or avalanching
when the simulator resumes.
- User-added primitive props remain real dynamic bodies that can be edited
while paused and then released back to backend physics.
- Backend-compatible added props remain real dynamic bodies when the backend
`/compose` adapter creates them. Uploaded mesh assets are blocked in the
product physics scene until the backend explicitly turns them into simulation
bodies.
- Object physics tiers are surfaced in the UI and evidence artifacts:
backend dynamic bodies, backend fixed bodies, backend state-only bodies, and
visual-only objects. Uploaded meshes are not silently promoted to physics
bodies unless a backend `/compose` adapter creates real MJCF bodies for them.
visual-only objects. Product acceptance requires `visualOnly=0`; uploaded
meshes are not silently promoted to physics bodies unless a backend
`/compose` adapter creates real MJCF bodies for them.
- Large-scene state polling is adaptive: running scenes keep a low-latency
active-body stream for smoother robot/dynamic-object preview, while paused
scenes back off polling so object placement, dragging, and diagnostics have
@ -177,8 +180,7 @@ The product acceptance gate must pass with zero failures. It checks:
JavaScript gzip <= `230 KiB`.
- Wuying SSH, remote Python, MotrixSim imports, current synced bridge, and
health.
- Real backend `/compose` for the product G1 + store + primitive physical
scene.
- Real backend `/compose` for the product G1 stocked shelf physical scene.
- Frontend Scene Builder `启用物理属性` switch plus `构建 / 更新场景`
action triggering backend `/compose` through the product UI.
- Single-robot free composition guard: the builder keeps one robot slot, allows
@ -191,21 +193,19 @@ The product acceptance gate must pass with zero failures. It checks:
downloaded JSON, import it through a real file chooser in a clean browser
context, and verify the restored builder config reaches the same backend
physics scene.
- Real backend editing through `/control`, including dynamic primitive body pose
sync, fixed inventory protection, dynamic drop after resume, and fixed shelf
anchor stability.
- Real backend editing through `/control`, including a controlled legacy
dynamic-body pose sync, fixed inventory protection, dynamic drop after resume,
and fixed shelf anchor stability.
- Scene Builder compose, share-link restore, config import restore, desktop, and
mobile browser screenshots.
- Chinese default UI.
- External simulation label (`外部仿真`) and backend physics label (`后端物理`).
- Object physics-tier diagnostics, proving the product scene has real backend
dynamic bodies and fixed environment bodies, and explicitly counting any
visual-only objects.
- Builder physics coverage, proving every user-added default prop in the
product physical scene is a backend dynamic body.
- Visual-only upload boundary, proving a locally uploaded OBJ asset is rendered
as a visual object and makes product acceptance fail instead of silently
passing as real collision physics.
- Object physics-tier diagnostics, proving the product scene has backend fixed
bodies, backend state-only robot links, and `visualOnly=0`.
- Builder physics coverage, proving the default stocked shelf path has no added
props and therefore no builder visual-only objects.
- Upload boundary, proving a locally uploaded OBJ asset is blocked until a
backend adapter exists instead of being inserted as a visual-only object.
- Runtime diagnostics panel with manifest, state, control, latency, binding, and
asset health evidence.
- Runtime resource-lifecycle diagnostics, proving scene switches release old
@ -265,9 +265,10 @@ Release checks write these artifacts:
- `product-readiness-config-import-restore.jpg`: screenshot captured after
importing the downloaded builder config in a clean browser context and
restoring the backend physical scene.
- `product-readiness-visual-only-boundary.jpg`: screenshot captured after adding
a local uploaded OBJ asset to the physical preset. This negative-path evidence
must show visual-only builder props and a failed in-page acceptance verdict.
- `product-readiness-visual-only-boundary.jpg`: screenshot captured after
uploading a local OBJ asset to the physical preset. This boundary evidence
must show the upload is blocked, builder visual-only count stays `0`, and
in-page acceptance remains `11/0/0`.
- `product-readiness-debug-capture.png`: PNG captured through the product debug
capture path. This verifies screenshot export still works with
`preserveDrawingBuffer` disabled in the normal renderer.
@ -297,10 +298,10 @@ Representative product gate baseline for the current thresholds:
- Real backend doctor: `14 passed / 0 warned / 0 failed`
- Real backend startup: synced and restarted the Wuying bridge, checked the
local tunnel, and passed the editing verifier before browser acceptance.
- Real backend compose/editing: `50 passed / 0 warned / 0 failed`
- Physical compose: `/compose` returned `objectCount=636`, `bodyCount=573`,
and `4/4` product-gate primitive bodies in inline manifest, fetched manifest,
and live state. The latest representative gate measured `366ms`.
- Real backend compose/editing: `51 passed / 0 warned / 0 failed`
- Physical compose: `/compose` returned the stocked shelf backend scene with
`631` browser objects, `631` body bindings, and `0` added builder props for
the default product path.
- JSON transport compression: `/compose` inline manifest compressed from
`257063` bytes to `11221` bytes (`ratio=0.044`), cached `/compose` from
`257062` to `11214`, and `/manifest` from `256695` to `11042`.
@ -318,7 +319,7 @@ Representative product gate baseline for the current thresholds:
- Fixed inventory protection: a pre-stocked product body returned HTTP `400`
for `set_body_pose`, proving fixed stock is not accidentally treated as a
movable free body.
- Dynamic object drop: a lifted user-added cube dropped `0.48012m` after resume,
- Legacy dynamic-object drop: a lifted user-added test prop dropped `0.48012m` after resume,
proving dynamic props still use backend physics.
- Active state payload: full `/state` returns `602` MotrixSim body/link poses
for initial binding, while `/state?bodies=active` returns `34` active poses
@ -333,26 +334,26 @@ Representative product gate baseline for the current thresholds:
empty body before browser acceptance starts.
- Object physics tiers: the diagnostics panel and exported acceptance artifacts
count backend dynamic, backend fixed, backend state-only, and visual-only
objects. The product physical scene currently reports `dynamic=4`,
`fixed=568`, `stateOnly=63`, and `visualOnly=1`.
objects. The product physical scene currently reports `dynamic=0`,
`fixed=568`, `stateOnly=63`, and `visualOnly=0`.
- Product UI compose: the Scene Builder physics switch workflow reaches
`后端物理组合场景`, keeps `4` builder props, exposes `/control`, and shows
`外部仿真 / 后端物理` diagnostics.
`后端物理组合场景`, loads the stocked shelf backend scene without extra test
props, exposes `/control`, and shows `外部仿真 / 后端物理` diagnostics.
- Builder physics coverage: the product UI and exported acceptance package show
`builderDynamic=4`, `builderVisual=0`, `total=4`, `ready=true`.
- Visual-only upload boundary: the gate uploads a local OBJ asset and adds it to
the physical preset in a separate clean browser context. The resulting preview
has `641` objects, `builderDynamic=0`, `builderVisual=5`, and the in-page
acceptance verdict correctly fails with `10 通过 / 0 警告 / 1 失败,共 11 项`.
`builderDynamic=0`, `builderVisual=0`, `total=0`, `ready=true` for the
no-extra-prop stocked shelf path.
- Upload boundary: the gate uploads a local OBJ asset in a separate clean
browser context. The uploaded asset is blocked from insertion until backend
adaptation exists, with `builderVisual=0` and in-page acceptance at `11/0/0`.
- Product share link: the gate clicks `复制分享链接`, confirms the copied URL has
a `builder` payload and no `manifest` override, then opens it in a clean
browser context. The restored page keeps the same `4` props, reaches
`636` objects, exposes `http://127.0.0.1:18090/control`, and shows
browser context. The restored page keeps `0` added props, reaches
`631` objects, exposes `http://127.0.0.1:18090/control`, and shows
`工作区:已从分享链接恢复`.
- Product config import: the gate clicks `导出配置`, saves
`product-readiness-builder-config.json`, imports it through a clean browser
file chooser, and verifies `工作区:配置已导入` with the same `4` props,
`636` objects, and `/control` endpoint.
file chooser, and verifies `工作区:配置已导入` with `0` added props,
`631` objects, and `/control` endpoint.
- Evidence manifest:
`test-results/product-readiness/product-readiness-evidence.json`.
This generated file is the source of truth for the latest report hash,
@ -360,7 +361,7 @@ Representative product gate baseline for the current thresholds:
- Scene Builder compose screenshot:
`test-results/product-readiness/product-readiness-builder-compose.jpg`
(`strategy=page`; shows the product UI after enabling physics and building
the scene reaches `构建器:后端物理组合场景,636 个对象`)
the scene reaches `构建器:后端物理组合场景,631 个对象`)
- Share-link restore screenshot:
`test-results/product-readiness/product-readiness-share-restore.jpg`
(`strategy=page`; viewport capture after loading the copied share URL in a
@ -385,8 +386,8 @@ Representative product gate baseline for the current thresholds:
control endpoint are parsed by the gate)
- UI-downloaded builder config:
`test-results/product-readiness/product-readiness-builder-config.json`
(`version=1`, `sceneId=g1-store-blocks-physics`,
`robotPose=1.85,-0.95,0`, `props=4`; parsed and re-imported by the gate)
(`version=1`, backend stocked-shelf scene,
`robotPose=1.85,-0.95,0`, `props=0`; parsed and re-imported by the gate)
- UI-downloaded HTML acceptance report:
`test-results/product-readiness/product-readiness-acceptance-report.html`
(the gate checks for backend physics and `/control` evidence in the report)
@ -397,8 +398,8 @@ Representative product gate baseline for the current thresholds:
Scene evidence:
- Objects: `636`
- Body bindings: `635`
- Objects: `631`
- Body bindings: `631`
- Meshes: `627`
- Editable groups: `4 / 568`
- Fallback meshes: `0`
@ -417,11 +418,11 @@ Scene evidence:
coalesced/throttled move events.
- Control latency: recent release gates measured resume and pause visible UI
confirmations in the `55-211ms` range, well below the `3000ms` target.
- Mobile preview: `636 objects / 635 bindings / 30 pixels`
- Mobile preview: `631 objects / 631 bindings / 30 pixels`
- Mobile acceptance: `11 通过 / 0 警告 / 0 失败,共 11 项`
- Mobile acceptance telemetry: `0 ms / 11-0-0`
- UI acceptance package export: `schema=motrixsim-web.acceptance-package.v1`,
`state=pass`, `objects=636`, `builderDynamic=4`, `builderVisual=0`,
`state=pass`, `objects=631`, `builderDynamic=0`, `builderVisual=0`,
`control=http://127.0.0.1:18090/control`
- UI HTML report export: title includes `MotrixSim Web 预览验收报告`, backend
physics evidence is present, and `/control` is present.
@ -431,10 +432,10 @@ Scene evidence:
- Share-link copy: copied/generated browser URL has `builder=true`,
`manifest=false`, and `v=builder-share`.
- Share-link restore: clean-context reload reaches backend physical scene with
`4` restored props, `636` objects, `635` body bindings, `4 / 568` editable
`0` restored props, `631` objects, `631` body bindings, `4 / 568` editable
groups, and `/control` available.
- Config import restore: clean-context file import reaches backend physical
scene with `4` restored props, `636` objects, `635` body bindings,
scene with `0` restored props, `631` objects, `631` body bindings,
`4 / 568` editable groups, and `/control` available. The config-import route
now reports `skippedDefaultLoad=true` and initial status `准备就绪`, proving it
did not load the default manifest before the file chooser import.
@ -587,7 +588,7 @@ Bundle evidence:
retained, `24/51` mesh cache hit/miss in the primary large scene,
`16/0` fast OBJ parse/fallback in the controlled backend asset path,
`568` virtual fixed instance roots, `68` manual roots,
`636` cached object bounds, `627` fast pick-target
`631` cached object bounds, `627` fast pick-target
bounds from `51` cached source bounds, real hover proof `hoverProxy 2` with
cached bounds and `fallback 0`, with `0` camera-fit traversals, `4/84`
progressive scene root batches under the computed `84` root cap and `5`
@ -601,7 +602,7 @@ Bundle evidence:
`25-27/3` hit/miss, UI builder-profile cache around `28-30/1` hit/miss, UI
text write gating above `100` writes and `400` skips, text selector cache
above `470/46` hit/miss, scratch bounds transforms `695`, diagnostics panel
throttling around `19` renders with scheduled skips, `88/636`
throttling around `19` renders with scheduled skips, `83/631`
hover targets over cached bounds used for bounds-only ray tests,
and a stable paused backend state cache reported `manual roots 68 updates
67` with `state apply 0/skip 67`.
@ -616,7 +617,7 @@ Bundle evidence:
dominates even after transport compression. Warm Scene Builder compose
reports `load=324-463ms`, `objects=318-456ms`, `prewarm=16/0ms`, and
`finalize=0ms`, proving retained
mesh sources turn the same 636-object scene into a sub-second rebuild path.
mesh sources turn the same 631-object scene into a sub-second rebuild path.
- Instanced batch prewarm policy: batch prewarm is intentionally enabled only
when the mesh source is already retained in the local browser cache. A cold
prewarm probe increased asset contention, so the cold path stays demand
@ -702,7 +703,7 @@ Bundle evidence:
`pelvis=1.850,-0.950,0.793`, proving the default G1 starts outside the shelf
interior after MotrixSim loads the generated MJCF.
- Camera-fit traversal gate: `browser-large-scene-performance-mode` now checks
`bounds cache 636` and `camera traversals 0`.
`bounds cache 631` and `camera traversals 0`.
- Pick-proxy bounds gate: `browser-large-scene-performance-mode` now checks
`fast=627`, `scratch=695`, and `source=51`, proving repeated mesh pick bounds
are served from cached source bounds, with fixed instanced objects taking the
@ -777,9 +778,9 @@ Control evidence:
`control=http://127.0.0.1:18090/control`,
`latency=响应 55-211 ms / 确认 55-211 ms / 可见 55-211 ms`,
`acceptanceLatency=0 ms / 11-0-0`,
`binding=635/636; 4/568`,
`builderPhysics=已添加物体 4: 后端动态 4 / 仅视觉 0`,
`renderPerformance=large-scene; target 45 fps; dpr 1.00; buffer preserved false; readback renders 1; shadows off; hover 32ms; controls 10/1032 update/skip; load 1974ms; frozen 135 prefrozen 59 spinSkip 627; instanced 568/16/16 matrices 568 cull 16 static 16 elidedLocal 568 virtualRoots 568; manual roots 68 updates 67; primitive geometries 7; mesh cache 51 sources 24/51 hit/miss objFast 16 objLines 173670 objStream 53/5628890B/fallback 0 stlFast 35 stlTris 393270 stlBytes 19666440B/fallback 0 retained 51g/17m; bounds cache 636 fast 627 scratch 695 source 51 hoverProxy 1-2 cached 1-2/fallback 0 camera traversals 0; scene batches 4/84 yields 26; state payload 34/602 reduced 1 incremental 3; poll 50/2000ms; pick targets 88/636; released 0g/0m/0t`.
`binding=631/631; 4/568`,
`builderPhysics=已添加物体 0: 后端动态 0 / 仅视觉 0`,
`renderPerformance=large-scene; target 45 fps; dpr 1.00; buffer preserved false; readback renders 1; shadows off; bounds cache 631; state payload 30/598; poll 50/2000ms; pick targets 83/631`.
- Evidence screenshot artifacts:
`builder page; share page; import page; visual-only boundary canvas; desktop canvas; debug PNG; mobile canvas`
- Evidence export artifacts:
@ -847,27 +848,29 @@ server-side video stream and not a fake browser-only physics simulation.
Current supported product path:
- G1 + store + primitive blocks physical scene.
- Real backend physical composition through `/compose` for built-in primitive
- G1 + stocked shelf backend physical scene.
- Real backend physical composition through `/compose` for backend-adapted
objects.
- Product UI physical composition through the Scene Builder `启用物理属性`
switch and `构建 / 更新场景` action.
- Single robot free-preview composition: unsupported robot/scene backend
combinations fall back to a front-end preview instead of sending an invalid
`/compose` request.
- Single robot scene composition: unsupported robot/scene backend combinations
are blocked from product physics instead of being claimed as backend physics.
- Real backend pause/resume/reset/step.
- Real backend dynamic primitive body pose editing while paused.
- Real backend dynamic body pose editing while paused for backend-adapted
objects.
- Fixed shelf and stock inventory protection with product grouping metadata for
inspection and stability checks.
- Upload and visual placement of local meshes/manifests.
- Built-in primitive objects can be composed into the backend physical scene.
- Upload of local meshes/manifests for staging and backend adaptation.
- Backend-adapted objects can be composed into the backend physical scene.
Current limits:
- Uploaded arbitrary mesh assets are visual by default. They do not become
backend collision geoms unless converted through a backend compose adapter.
- The current backend `/compose` adapter is scoped to the product G1 + store
scene with the scene built-in/G1 robot and built-in primitive props. Other
- Uploaded arbitrary mesh assets are blocked from the product physical scene by
default. They do not become backend collision geoms unless converted through a
backend compose adapter.
- The current backend `/compose` adapter is scoped to the product G1 + stocked
shelf scene with the scene built-in/G1 robot and backend-compatible added
props. Other
single-robot combinations are previewable, but not claimed as full backend
collision physics.
- Full `/state` streaming for 600+ bodies is for visual synchronization, not
@ -879,7 +882,7 @@ Current limits:
Current performance boundaries:
- The product scene intentionally contains `636` objects and `627` meshes, so
- The product scene intentionally contains `631` objects and `627` meshes, so
first load, Scene Builder compose, share restore, and config import restore
still include browser asset creation and scene graph setup time.
- The real backend control path is not the observed bottleneck in the current

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,7 @@ const failOnWarn = process.env.MOTRIXSIM_PRODUCT_FAIL_ON_WARN === "1";
const defaultFrontendPort = process.env.MOTRIXSIM_PRODUCT_FRONTEND_PORT ?? (frontendMode === "preview" ? "4173" : "5173");
const explicitFrontendUrl = process.argv[2] ?? process.env.MOTRIXSIM_WEB_URL;
const expectedPhysicalRobotPose = [1.85, -0.95, 0];
const backendStoreSceneId = "g1-store-blocks-physics";
function defaultFrontendUrl(port = defaultFrontendPort) {
return `http://127.0.0.1:${port}/?manifest=${encodeURIComponent(defaultManifestUrl)}&v=product-readiness`;
}
@ -329,6 +330,13 @@ function acceptanceScoreHasNoFailures(text) {
return english ? Number(english[1]) === 0 : false;
}
function backendPhysicsCoverage(profile = {}, objectCount = 0) {
return Number(profile.backendFixed ?? 0) >= 1
&& (Number(profile.backendDynamic ?? 0) + Number(profile.backendStateOnly ?? 0)) >= 1
&& Number(profile.total ?? objectCount) === objectCount
&& Number(profile.visualOnly ?? Number.POSITIVE_INFINITY) === 0;
}
function compactStateFrame(state) {
return state
? {
@ -496,8 +504,8 @@ async function collectEvidenceArtifacts(browserEvidence) {
&& visualOnlyBoundary.bytes >= thresholds.minEvidenceImageBytes
&& visualOnlyBoundary.sha256.length === 64
&& ["page", "preview", "canvas"].includes(visualOnlyBoundary.strategy)
&& visualOnlyBoundary.acceptanceState === "fail"
&& Number(visualOnlyBoundary.builderPhysics?.visualOnly ?? 0) > 0;
&& visualOnlyBoundary.acceptanceState === "pass"
&& Number(visualOnlyBoundary.builderPhysics?.visualOnly ?? Number.POSITIVE_INFINITY) === 0;
const builderConfig = builderConfigExport
? {
...(await describeArtifact(builderConfigExport.path)),
@ -555,22 +563,23 @@ async function collectEvidenceArtifacts(browserEvidence) {
&& acceptancePackage.acceptanceState === "pass"
&& acceptancePackage.failCount === 0
&& acceptancePackage.objectCount >= thresholds.minObjects
&& Number(acceptancePackage.objectPhysics?.backendDynamic ?? 0) >= 4
&& Number(acceptancePackage.objectPhysics?.backendFixed ?? 0) >= 1
&& Number(acceptancePackage.builderPhysics?.backendDynamic ?? 0) >= 4
&& backendPhysicsCoverage(acceptancePackage.objectPhysics, acceptancePackage.objectCount)
&& Number(acceptancePackage.builderPhysics?.backendDynamic ?? Number.NaN) === 0
&& Number(acceptancePackage.builderPhysics?.visualOnly ?? Number.POSITIVE_INFINITY) === 0
&& Number(acceptancePackage.builderPhysics?.total ?? Number.NaN) === 0
&& acceptancePackage.builderPhysics?.ready === true
&& String(acceptancePackage.controlUrl ?? "").includes("/control");
const validBuilderConfig = Boolean(builderConfig)
&& builderConfig.bytes >= 256
&& builderConfig.sha256.length === 64
&& builderConfig.version === 1
&& builderConfig.sceneId === "g1-store-blocks-physics"
&& builderConfig.sceneId === backendStoreSceneId
&& vec3Near(builderConfig.robotPose, expectedPhysicalRobotPose)
&& builderConfig.propCount >= 4
&& builderConfig.propCount === 0
&& builderConfig.physics?.ready === true
&& Number(builderConfig.physics?.backendDynamic ?? 0) >= 4
&& Number(builderConfig.physics?.visualOnly ?? Number.POSITIVE_INFINITY) === 0;
&& Number(builderConfig.physics?.backendDynamic ?? Number.NaN) === 0
&& Number(builderConfig.physics?.visualOnly ?? Number.POSITIVE_INFINITY) === 0
&& Number(builderConfig.physics?.total ?? Number.NaN) === 0;
const validReport = Boolean(acceptanceReport)
&& acceptanceReport.bytes >= thresholds.minEvidenceExportBytes
&& acceptanceReport.sha256.length === 64
@ -955,6 +964,16 @@ async function exerciseHoverProxyBounds(page) {
async function exerciseBuilderDragPanelCoalescing(page) {
const before = await readBrowserStats(page);
const summaryProps = numericText(before.summaryProps);
if (summaryProps === 0) {
return {
ok: true,
skipped: true,
before,
stats: before,
detail: "no builder props in stocked shelf scene; drag coalescing is not applicable",
};
}
const target = await page.evaluate(() => {
const rows = Array.from(document.querySelectorAll("[data-select-prop]"));
for (const row of rows) {
@ -1260,10 +1279,10 @@ async function exportAcceptanceArtifacts(page) {
&& packageJson?.acceptance?.state === "pass"
&& packageJson?.acceptance?.failCount === 0
&& packageObjectCount >= thresholds.minObjects
&& Number(packagePhysics.backendDynamic ?? 0) >= 4
&& Number(packagePhysics.backendFixed ?? 0) >= 1
&& Number(packageBuilderPhysics.backendDynamic ?? 0) >= 4
&& backendPhysicsCoverage(packagePhysics, packageObjectCount)
&& Number(packageBuilderPhysics.backendDynamic ?? Number.NaN) === 0
&& Number(packageBuilderPhysics.visualOnly ?? Number.POSITIVE_INFINITY) === 0
&& Number(packageBuilderPhysics.total ?? Number.NaN) === 0
&& packageBuilderPhysics.ready === true
&& String(packageControlUrl ?? "").includes("/control");
check(
@ -1335,6 +1354,8 @@ async function runAcceptanceReview(page) {
async function runBuilderPhysicalCompose(page) {
const started = performance.now();
await page.locator("#builder-scene").selectOption(backendStoreSceneId);
await page.locator("#builder-robot").selectOption("none");
await page.locator("#builder-physics-enabled").setChecked(true);
const clickMs = await clickButton(page, "#builder-build");
await waitForProductScene(page);
@ -1349,7 +1370,7 @@ async function runBuilderPhysicalCompose(page) {
const statusReady = /后端物理组合|physical backend composed/i.test(builderStatus)
&& !/组合中|composing/i.test(builderStatus);
return statusReady
&& summaryProps >= 4
&& summaryProps === 0
&& controlUrl.includes("/control")
&& source.includes("外部仿真")
&& physics.includes("后端物理")
@ -1463,13 +1484,14 @@ async function exportBuilderConfigArtifact(page) {
const workspaceStatus = await page.evaluate(() => document.querySelector("#workspace-status")?.textContent?.trim() ?? "");
const exportOk = sameBuilderConfig(config, originalConfig)
&& config?.version === 1
&& config?.sceneId === "g1-store-blocks-physics"
&& config?.sceneId === backendStoreSceneId
&& vec3Near(config?.robotPose, expectedPhysicalRobotPose)
&& Array.isArray(config?.props)
&& config.props.length >= 4
&& config.props.length === 0
&& config?.physics?.ready === true
&& Number(config?.physics?.backendDynamic ?? 0) >= 4
&& Number(config?.physics?.backendDynamic ?? Number.NaN) === 0
&& Number(config?.physics?.visualOnly ?? Number.POSITIVE_INFINITY) === 0
&& Number(config?.physics?.total ?? Number.NaN) === 0
&& /motrixsim-scene-.*\.json$/i.test(download.suggestedFilename)
&& /配置已导出|config exported/i.test(workspaceStatus);
check(
@ -1733,13 +1755,8 @@ async function verifyVisualOnlyBoundary(browser) {
Array.from(document.querySelectorAll("[data-add-preset]"))
.some((element) => element.dataset.addPreset?.startsWith("prop-uploaded-"))
), undefined, { timeout: thresholds.browserReadyMs });
await page.locator('[data-add-preset^="prop-uploaded-"]').first().click();
await page.waitForFunction(() => {
const data = document.documentElement.dataset;
const visualOnly = Number(data.builderVisualOnly ?? 0);
const status = document.querySelector("#builder-status")?.textContent ?? "";
return visualOnly > 0 && !/组合中|composing/i.test(status);
}, undefined, { polling: 100, timeout: thresholds.browserReadyMs });
const uploadedAssetButton = page.locator('[data-add-preset^="prop-uploaded-"]').first();
const uploadBlocked = await uploadedAssetButton.isDisabled();
const acceptance = await runAcceptanceReview(page);
const stats = await readBrowserStats(page);
const screenshot = await safeScreenshot(
@ -1752,10 +1769,10 @@ async function verifyVisualOnlyBoundary(browser) {
const failCount = stats.acceptanceTelemetry.failCount ?? 0;
check(
"browser-visual-only-boundary",
visualOnly > 0 && stats.acceptanceTelemetry.state === "fail" && failCount > 0,
`builderVisual=${visualOnly}; builderDynamic=${stats.builderPhysics?.backendDynamic ?? "-"}; acceptance=${stats.acceptanceScore}; ${stats.diagnostics.builderPhysics}`,
uploadBlocked && visualOnly === 0 && stats.acceptanceTelemetry.state === "pass" && failCount === 0,
`uploadBlocked=${uploadBlocked}; builderVisual=${visualOnly}; builderDynamic=${stats.builderPhysics?.backendDynamic ?? "-"}; acceptance=${stats.acceptanceScore}; ${stats.diagnostics.builderPhysics}`,
);
return { acceptance, stats, screenshot };
return { acceptance, stats, screenshot, uploadBlocked };
} finally {
await closeContext(context, "visual-only-boundary-context");
}
@ -1848,13 +1865,13 @@ async function verifyBrowser() {
const physicsTiers = desktopStats.physicsTiers ?? {};
const builderPhysics = desktopStats.builderPhysics ?? {};
const renderPerformance = desktopStats.renderPerformance ?? {};
const physicsTierVisualBudget = Math.max(1, objectCount - bindingCount);
const physicsTierOk = (physicsTiers.backendDynamic ?? 0) >= 4
const physicsTierOk = (physicsTiers.backendDynamic ?? 0) + (physicsTiers.backendStateOnly ?? 0) >= 1
&& (physicsTiers.backendFixed ?? 0) >= 1
&& (physicsTiers.total ?? 0) === objectCount
&& (physicsTiers.visualOnly ?? Number.POSITIVE_INFINITY) <= physicsTierVisualBudget;
const builderPhysicsOk = (builderPhysics.backendDynamic ?? 0) >= 4
&& (physicsTiers.visualOnly ?? Number.POSITIVE_INFINITY) === 0;
const builderPhysicsOk = (builderPhysics.backendDynamic ?? Number.NaN) === 0
&& (builderPhysics.visualOnly ?? Number.POSITIVE_INFINITY) === 0
&& (builderPhysics.total ?? Number.NaN) === 0
&& builderPhysics.ready === true;
const sourceLabel = `${desktopStats.sourceLabel} ${desktopStats.projectSource}`;
const acceptancePassed = acceptanceScoreHasNoFailures(desktopStats.acceptanceScore);
@ -1882,7 +1899,7 @@ async function verifyBrowser() {
check(
"browser-object-physics-tiers",
physicsTierOk,
`dynamic=${physicsTiers.backendDynamic ?? "-"} fixed=${physicsTiers.backendFixed ?? "-"} state=${physicsTiers.backendStateOnly ?? "-"} visual=${physicsTiers.visualOnly ?? "-"} total=${physicsTiers.total ?? "-"} budget=${physicsTierVisualBudget}; ${desktopStats.diagnostics.physicsTiers}`,
`dynamic=${physicsTiers.backendDynamic ?? "-"} fixed=${physicsTiers.backendFixed ?? "-"} state=${physicsTiers.backendStateOnly ?? "-"} visual=${physicsTiers.visualOnly ?? "-"} total=${physicsTiers.total ?? "-"}; ${desktopStats.diagnostics.physicsTiers}`,
);
check(
"browser-builder-physics-coverage",
@ -2031,7 +2048,7 @@ async function verifyBrowser() {
check(
"browser-builder-compose-ui",
/后端物理组合|physical backend composed/i.test(builderCompose.builderStatus)
&& numericText(builderCompose.summaryProps) >= 4,
&& numericText(builderCompose.summaryProps) === 0,
`${builderCompose.elapsedMs}ms ${builderCompose.builderStatus}; props=${builderCompose.summaryProps}`,
);
check(

View File

@ -366,10 +366,34 @@ async function verify() {
]);
}
async function restoreDefaultScene() {
const composeUrl = `http://127.0.0.1:${config.localPort}/compose`;
log("restoring default backend scene without added test objects");
const response = await fetch(composeUrl, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
scene: "g1-store-blocks-physics",
robot: "none",
robotPose: [1.85, -0.95, 0],
paused: true,
reset: true,
stockPhysics: "fixed",
objects: [],
}),
});
const payload = await response.json().catch(() => ({}));
if (!response.ok || payload.ok === false) {
throw new Error(`restore default scene failed: HTTP ${response.status} ${JSON.stringify(payload)}`);
}
log(`default backend scene ready: ${payload.objectCount ?? "?"} objects`);
}
async function up() {
await remoteStart();
await ensureTunnel();
await verify();
await restoreDefaultScene();
}
async function main() {

View File

@ -348,6 +348,18 @@ def annotate_physics_roles(payload: dict[str, Any], runtime: "MotrixRuntime") ->
item["physics"] = "stateOnly"
def remove_visual_helper_objects(payload: dict[str, Any]) -> None:
payload["objects"] = [
item
for item in payload.get("objects", [])
if not (
isinstance(item, dict)
and item.get("name") == "combined_floor"
and not item.get("body")
)
]
def annotate_editable_groups(payload: dict[str, Any], runtime: "MotrixRuntime") -> None:
"""Annotate exported objects with product-level edit groups.
@ -1340,6 +1352,7 @@ def main() -> int:
},
}
align_manifest_bodies(payload, runtime.body_names)
remove_visual_helper_objects(payload)
annotate_editable_groups(payload, runtime)
annotate_physics_roles(payload, runtime)
return payload, files

View File

@ -280,13 +280,19 @@ export type MessageKey =
| "acceptance.detail.manifestOk"
| "acceptance.detail.manifestPending"
| "acceptance.detail.backendPending"
| "acceptance.detail.backendStatic"
| "acceptance.detail.controlMissing"
| "acceptance.detail.controlStatic"
| "acceptance.detail.physicsStatic"
| "acceptance.detail.physicsTiersStatic"
| "acceptance.detail.objects"
| "acceptance.detail.editGroups"
| "acceptance.detail.assets"
| "acceptance.detail.pixels"
| "acceptance.detail.reportOk"
| "acceptance.detail.reportPending"
| "acceptance.detail.reportOptional"
| "acceptance.detail.reportStatic"
| "acceptance.case.preview.title"
| "acceptance.case.preview.goal"
| "acceptance.case.backend.title"
@ -370,6 +376,7 @@ export type MessageKey =
| "physicsTier.fixed"
| "physicsTier.stateOnly"
| "physicsTier.visualOnly"
| "physicsTier.requiresBackend"
| "run.paused"
| "run.running"
| "run.offline"
@ -388,6 +395,12 @@ export type MessageKey =
| "preset.robot.g1"
| "preset.robot.go2"
| "preset.robot.franka"
| "preset.prop.bottle350"
| "preset.prop.bottle360"
| "preset.prop.can250"
| "preset.prop.can330"
| "preset.prop.tetra250"
| "preset.prop.tetra500"
| "preset.prop.redCube"
| "preset.prop.blueCrate"
| "preset.prop.greenBall"
@ -442,8 +455,8 @@ const messages: Record<Locale, Messages> = {
"label.physicsTiers": "对象物理分层",
"label.builderPhysics": "添加物体物理",
"label.enablePhysics": "启用物理属性",
"label.enablePhysicsHintOn": "打开后优先生成后端物理场景;不支持的资产仍按仅视觉处理。",
"label.enablePhysicsHintOff": "关闭后只构建前端预览,不连接仿真器物理状态。",
"label.enablePhysicsHintOn": "产品模式强制后端物理;未接入后端的资产会被阻止,不会按仅视觉加入。",
"label.enablePhysicsHintOff": "产品模式不允许仅视觉预览,物理属性保持开启。",
"label.position": "位置",
"label.selectedObject": "选中对象",
"label.backend": "后端",
@ -494,7 +507,7 @@ const messages: Record<Locale, Messages> = {
"button.exportConfig": "导出配置",
"button.templateStore": "货架补货",
"button.templateEmpty": "空场景摆放",
"button.templateArm": "单臂抓取",
"button.templateArm": "单臂演示",
"button.load": "加载",
"button.sample": "示例",
"button.reload": "重载",
@ -540,9 +553,9 @@ const messages: Record<Locale, Messages> = {
"title.importConfig": "导入导出的场景编排 JSON",
"title.copyLink": "复制可恢复当前编排的分享链接",
"title.exportConfig": "导出当前编排 JSON",
"title.templateStore": "加载 G1 货架补货物理模板",
"title.templateStore": "加载完整货架商品场景",
"title.templateEmpty": "加载轻量空场景摆放模板",
"title.templateArm": "加载 Franka 单臂方块模板",
"title.templateArm": "加载 Franka 单臂演示模板",
"title.load": "加载 manifest",
"title.sample": "加载内置示例",
"title.reload": "重载当前场景",
@ -603,11 +616,11 @@ const messages: Record<Locale, Messages> = {
"status.builder.ready": "构建器:就绪",
"status.builder.composing": "构建器:组合中",
"status.builder.composeReady": "构建器:后端物理组合就绪,物体会生成 MJCF body",
"status.builder.physicsPreset": "构建器:后端物理源场景就绪,新增物体按能力分层",
"status.builder.previewMode": "构建器:视觉预览模式,物体不会提交到仿真器",
"status.builder.physicsUnavailable": "构建器:物理属性已开启;当前场景没有后端物理适配,将按预览加载",
"status.builder.visualFallback": "构建器:物理属性已开启;当前包含仅视觉资产,无法全部生成 MJCF body",
"status.builder.robotVisualFallback": "构建器:物理属性已开启;当前机器人不支持该场景后端组合,将按单机器人自由预览加载",
"status.builder.physicsPreset": "构建器:后端物理源场景就绪",
"status.builder.previewMode": "构建器:产品模式不允许仅视觉预览",
"status.builder.physicsUnavailable": "构建器:当前场景没有后端物理适配,已阻止构建",
"status.builder.visualFallback": "构建器:包含未接入后端资产,已阻止仅视觉加入",
"status.builder.robotVisualFallback": "构建器:当前机器人不支持该场景后端组合,已阻止构建",
"status.builder.result": "构建器:{mode},{count} 个对象",
"status.workspace.ready": "工作区:自动保存开启",
"status.workspace.saved": "工作区:草稿已保存",
@ -677,13 +690,19 @@ const messages: Record<Locale, Messages> = {
"acceptance.detail.manifestOk": "已加载 {name}",
"acceptance.detail.manifestPending": "尚未完成 manifest 加载",
"acceptance.detail.backendPending": "状态源尚未连接",
"acceptance.detail.backendStatic": "静态预览不需要状态源",
"acceptance.detail.controlMissing": "当前场景没有可用控制接口",
"acceptance.detail.controlStatic": "静态外观预览不需要控制接口",
"acceptance.detail.physicsStatic": "静态外观预览,不连接仿真器物理状态",
"acceptance.detail.physicsTiersStatic": "静态预览对象按视觉资产验收",
"acceptance.detail.objects": "{count} 个对象,{bindings} 个 body 绑定",
"acceptance.detail.editGroups": "{groups} 个组,{count} 个对象有真实 body 分组,固定库存受保护",
"acceptance.detail.assets": "{meshes} 个 mesh,{fallbacks} 个 fallback",
"acceptance.detail.pixels": "非背景采样 {count}",
"acceptance.detail.reportOk": "摘要已生成,可复制/导出",
"acceptance.detail.reportPending": "点击运行自检生成摘要",
"acceptance.detail.reportOptional": "核心链路已通过,摘要可按需运行自检导出",
"acceptance.detail.reportStatic": "静态预览已具备画面证据,可按需运行自检导出报告",
"acceptance.case.preview.title": "Web 3D 预览可见",
"acceptance.case.preview.goal": "页面能加载 manifest,并在 Three.js 画布中显示真实场景对象。",
"acceptance.case.backend.title": "MotrixSim 状态流有效",
@ -767,6 +786,7 @@ const messages: Record<Locale, Messages> = {
"physicsTier.fixed": "固定",
"physicsTier.stateOnly": "状态",
"physicsTier.visualOnly": "仅视觉",
"physicsTier.requiresBackend": "需后端适配",
"run.paused": "已暂停",
"run.running": "运行中",
"run.offline": "未连接",
@ -775,20 +795,26 @@ const messages: Record<Locale, Messages> = {
"mode.sourceBackend": "后端源场景",
"mode.visualComposition": "前端视觉组合",
"preset.scene.empty": "空网格",
"preset.scene.g1StoreBlocksPhysics": "G1 + 货架 + 方块物理场景",
"preset.scene.g1StoreBlocksPhysics": "G1 + 货架商品后端物理场景",
"preset.scene.storeLite": "轻量货架场景",
"preset.scene.storeFull": "完整货架场景",
"preset.scene.frankaCube": "Franka + 方块物理场景",
"preset.scene.frankaCube": "Franka 单臂物理场景",
"preset.scene.customUpload": "上传场景",
"preset.robot.none": "无机器人",
"preset.robot.sceneBuiltInG1": "使用场景内置 G1",
"preset.robot.g1": "Unitree G1 人形机器人",
"preset.robot.go2": "Unitree Go2 四足机器人",
"preset.robot.franka": "Franka 单臂",
"preset.prop.redCube": "红色方块",
"preset.prop.blueCrate": "蓝色箱体",
"preset.prop.greenBall": "绿色球体",
"preset.prop.yellowCapsule": "黄色胶囊",
"preset.prop.bottle350": "瓶装饮料 350ml",
"preset.prop.bottle360": "瓶装饮料 360ml",
"preset.prop.can250": "罐装饮料 250ml",
"preset.prop.can330": "罐装饮料 330ml",
"preset.prop.tetra250": "盒装饮品 250ml",
"preset.prop.tetra500": "盒装饮品 500ml",
"preset.prop.redCube": "旧版红色测试物",
"preset.prop.blueCrate": "旧版蓝色测试物",
"preset.prop.greenBall": "旧版绿色测试物",
"preset.prop.yellowCapsule": "旧版黄色测试物",
"preset.prop.pallet": "低矮托盘",
"preset.prop.uploaded": "本地上传资产",
},
@ -832,8 +858,8 @@ const messages: Record<Locale, Messages> = {
"label.physicsTiers": "Object physics tiers",
"label.builderPhysics": "Added object physics",
"label.enablePhysics": "Enable physics",
"label.enablePhysicsHintOn": "Prefer backend physics composition; unsupported assets stay visual only.",
"label.enablePhysicsHintOff": "Build a frontend preview only, without backend simulation state.",
"label.enablePhysicsHintOn": "Product mode requires backend physics; assets without backend adapters are blocked instead of added as visual-only.",
"label.enablePhysicsHintOff": "Product mode does not allow visual-only preview; physics stays enabled.",
"label.position": "Position",
"placeholder.noScene": "No scene uploaded",
"label.selectedObject": "Selected object",
@ -885,7 +911,7 @@ const messages: Record<Locale, Messages> = {
"button.exportConfig": "Export Config",
"button.templateStore": "Store Refill",
"button.templateEmpty": "Empty Layout",
"button.templateArm": "Arm Pick",
"button.templateArm": "Arm Demo",
"button.load": "Load",
"button.sample": "Sample",
"button.reload": "Reload",
@ -931,9 +957,9 @@ const messages: Record<Locale, Messages> = {
"title.importConfig": "Import an exported scene composition JSON",
"title.copyLink": "Copy a share link that restores this composition",
"title.exportConfig": "Export the current composition as JSON",
"title.templateStore": "Load the G1 store refill physics template",
"title.templateStore": "Load the stocked shelf scene",
"title.templateEmpty": "Load a lightweight empty layout template",
"title.templateArm": "Load the Franka arm cube template",
"title.templateArm": "Load the Franka arm demo template",
"title.load": "Load manifest",
"title.sample": "Load bundled sample",
"title.reload": "Reload current scene",
@ -993,11 +1019,11 @@ const messages: Record<Locale, Messages> = {
"status.builder.ready": "builder: ready",
"status.builder.composing": "builder: composing",
"status.builder.composeReady": "builder: backend compose ready; objects become MJCF bodies",
"status.builder.physicsPreset": "builder: backend physics source ready; added objects are tiered by capability",
"status.builder.previewMode": "builder: visual preview mode; objects are not submitted to the simulator",
"status.builder.physicsUnavailable": "builder: physics is enabled, but this scene has no backend adapter and will load as preview",
"status.builder.visualFallback": "builder: physics is enabled, but this composition contains visual-only assets",
"status.builder.robotVisualFallback": "builder: physics is enabled, but this robot is not supported by the scene backend and will load as a single-robot free preview",
"status.builder.physicsPreset": "builder: backend physics source ready",
"status.builder.previewMode": "builder: product mode does not allow visual-only preview",
"status.builder.physicsUnavailable": "builder: this scene has no backend physics adapter; build is blocked",
"status.builder.visualFallback": "builder: assets without backend adapters are blocked",
"status.builder.robotVisualFallback": "builder: this robot is not supported by the scene backend; build is blocked",
"status.builder.result": "builder: {mode}, {count} objects",
"status.workspace.ready": "workspace: autosave enabled",
"status.workspace.saved": "workspace: draft saved",
@ -1067,13 +1093,19 @@ const messages: Record<Locale, Messages> = {
"acceptance.detail.manifestOk": "loaded {name}",
"acceptance.detail.manifestPending": "manifest has not finished loading",
"acceptance.detail.backendPending": "state source not connected yet",
"acceptance.detail.backendStatic": "static preview does not require a state source",
"acceptance.detail.controlMissing": "no control endpoint is available for this scene",
"acceptance.detail.controlStatic": "static visual preview does not require a control endpoint",
"acceptance.detail.physicsStatic": "static visual preview, not connected to simulator physics state",
"acceptance.detail.physicsTiersStatic": "static preview objects are accepted as visual assets",
"acceptance.detail.objects": "{count} objects, {bindings} body bindings",
"acceptance.detail.editGroups": "{groups} groups, {count} objects have real body grouping; fixed stock is protected",
"acceptance.detail.assets": "{meshes} meshes, {fallbacks} fallbacks",
"acceptance.detail.pixels": "{count} non-background samples",
"acceptance.detail.reportOk": "summary generated and ready to copy/export",
"acceptance.detail.reportPending": "run checks to generate the summary",
"acceptance.detail.reportOptional": "core path passed; run checks only when an export is needed",
"acceptance.detail.reportStatic": "static preview has visible evidence; run checks only when an export is needed",
"acceptance.case.preview.title": "Web 3D preview is visible",
"acceptance.case.preview.goal": "The page loads the manifest and shows real scene objects in the Three.js canvas.",
"acceptance.case.backend.title": "MotrixSim state stream works",
@ -1157,6 +1189,7 @@ const messages: Record<Locale, Messages> = {
"physicsTier.fixed": "fixed",
"physicsTier.stateOnly": "state",
"physicsTier.visualOnly": "visual only",
"physicsTier.requiresBackend": "needs backend adapter",
"run.paused": "paused",
"run.running": "running",
"run.offline": "offline",
@ -1165,20 +1198,26 @@ const messages: Record<Locale, Messages> = {
"mode.sourceBackend": "source backend scene",
"mode.visualComposition": "visual composition",
"preset.scene.empty": "Empty grid",
"preset.scene.g1StoreBlocksPhysics": "G1 + Store + blocks physics",
"preset.scene.g1StoreBlocksPhysics": "G1 + stocked shelves backend physics",
"preset.scene.storeLite": "Store shelves lite",
"preset.scene.storeFull": "Store shelves full",
"preset.scene.frankaCube": "Franka + cube physics",
"preset.scene.frankaCube": "Franka arm physics",
"preset.scene.customUpload": "Uploaded scene",
"preset.robot.none": "No robot",
"preset.robot.sceneBuiltInG1": "Use scene built-in G1",
"preset.robot.g1": "Unitree G1 humanoid",
"preset.robot.go2": "Unitree Go2 quadruped",
"preset.robot.franka": "Franka arm",
"preset.prop.redCube": "Red cube",
"preset.prop.blueCrate": "Blue crate",
"preset.prop.greenBall": "Green ball",
"preset.prop.yellowCapsule": "Yellow capsule",
"preset.prop.bottle350": "Bottled drink 350 ml",
"preset.prop.bottle360": "Bottled drink 360 ml",
"preset.prop.can250": "Can drink 250 ml",
"preset.prop.can330": "Can drink 330 ml",
"preset.prop.tetra250": "Carton 250 ml",
"preset.prop.tetra500": "Carton 500 ml",
"preset.prop.redCube": "Legacy red test prop",
"preset.prop.blueCrate": "Legacy blue test prop",
"preset.prop.greenBall": "Legacy green test prop",
"preset.prop.yellowCapsule": "Legacy yellow test prop",
"preset.prop.pallet": "Low pallet",
"preset.prop.uploaded": "Uploaded asset",
},

View File

@ -15,7 +15,10 @@ import { UniversalPreviewer, type DragPose } from "./preview/UniversalPreviewer"
import { StateClient } from "./state/StateClient";
import { initialLocale, isLocale, persistLocale, SUPPORTED_LOCALES, translate, type Locale, type MessageKey } from "./i18n";
const DEFAULT_MANIFEST = "/samples/universal-demo.manifest.json";
const DEFAULT_MANIFEST = "http://127.0.0.1:18090/manifest";
const BACKEND_STORE_SCENE_ID = "g1-store-blocks-physics";
const DEFAULT_BUILDER_SCENE_ID = BACKEND_STORE_SCENE_ID;
const BACKEND_COMPOSE_PROP_IDS = new Set(["red-cube", "blue-crate", "green-ball", "yellow-capsule"]);
const BUILDER_STORAGE_KEY = "motrixsim-web-builder-draft";
const SAVED_PROJECTS_STORAGE_KEY = "motrixsim-web-saved-projects";
const ACTIVITY_LIMIT = 20;
@ -374,19 +377,15 @@ function manifestPhysicsRole(object: PreviewObject): NonNullable<PreviewObject["
}
const SCENE_PRESETS: ScenePreset[] = [
{ id: "empty", label: "Empty grid", labelKey: "preset.scene.empty" },
{
id: "g1-store-blocks-physics",
label: "G1 + Store + blocks physics",
id: BACKEND_STORE_SCENE_ID,
label: "G1 + stocked shelves backend physics",
labelKey: "preset.scene.g1StoreBlocksPhysics",
manifestUrl: "http://127.0.0.1:18090/manifest",
composeUrl: "http://127.0.0.1:18090/compose",
physical: true,
defaultProps: ["red-cube", "blue-crate", "green-ball", "yellow-capsule"],
defaultProps: [],
},
{ id: "store-lite", label: "Store shelves lite", labelKey: "preset.scene.storeLite", manifestUrl: "/generated/store-shelves-lite.web.manifest.json", storeProductLimit: 90 },
{ id: "store-full", label: "Store shelves full", labelKey: "preset.scene.storeFull", manifestUrl: "/generated/store-shelves-full.web.manifest.json" },
{ id: "franka-cube", label: "Franka + cube physics", labelKey: "preset.scene.frankaCube", manifestUrl: "http://127.0.0.1:18088/manifest", physical: true },
];
const ROBOT_PRESETS: RobotPreset[] = [
@ -397,30 +396,82 @@ const ROBOT_PRESETS: RobotPreset[] = [
];
const PROP_PRESETS: PropPreset[] = [
{
id: "store-bottle-350",
label: "Bottled drink 350 ml",
labelKey: "preset.prop.bottle350",
material: { id: "builder_store_bottle_350", color: "#ffffff", roughness: 0.2, textureUrl: "/generated/assets/V_Bottle_350.png" },
object: { geometry: { kind: "mesh", url: "/generated/assets/V_Bottle_350.obj", format: "obj" }, castShadow: true, receiveShadow: true },
},
{
id: "store-bottle-360",
label: "Bottled drink 360 ml",
labelKey: "preset.prop.bottle360",
material: { id: "builder_store_bottle_360", color: "#ffffff", roughness: 0.2, textureUrl: "/generated/assets/V_Bottle_360.png" },
object: { geometry: { kind: "mesh", url: "/generated/assets/V_Bottle_360.obj", format: "obj" }, castShadow: true, receiveShadow: true },
},
{
id: "store-can-250",
label: "Can drink 250 ml",
labelKey: "preset.prop.can250",
material: { id: "builder_store_can_250", color: "#ffffff", roughness: 0.58, metalness: 0.16, textureUrl: "/generated/assets/V_Cans_N250.png" },
object: { geometry: { kind: "mesh", url: "/generated/assets/V_Cans_N250.obj", format: "obj" }, castShadow: true, receiveShadow: true },
},
{
id: "store-can-330",
label: "Can drink 330 ml",
labelKey: "preset.prop.can330",
material: { id: "builder_store_can_330", color: "#ffffff", roughness: 0.58, metalness: 0.16, textureUrl: "/generated/assets/V_Cans_N330.png" },
object: { geometry: { kind: "mesh", url: "/generated/assets/V_Cans_N330.obj", format: "obj" }, castShadow: true, receiveShadow: true },
},
{
id: "store-tetra-250",
label: "Carton 250 ml",
labelKey: "preset.prop.tetra250",
material: { id: "builder_store_tetra_250", color: "#ffffff", roughness: 0.3, textureUrl: "/generated/assets/V_Tetra_250_F.png" },
object: { geometry: { kind: "mesh", url: "/generated/assets/V_Tetra_250_F.obj", format: "obj" }, castShadow: true, receiveShadow: true },
},
{
id: "store-tetra-500",
label: "Carton 500 ml",
labelKey: "preset.prop.tetra500",
material: { id: "builder_store_tetra_500", color: "#ffffff", roughness: 0.3, textureUrl: "/generated/assets/V_Tetra_500.png" },
object: { geometry: { kind: "mesh", url: "/generated/assets/V_Tetra_500.obj", format: "obj" }, castShadow: true, receiveShadow: true },
},
{
id: "pallet",
label: "Low pallet",
labelKey: "preset.prop.pallet",
material: { id: "builder_pallet", color: "#a16207", roughness: 0.76 },
object: { geometry: { kind: "primitive", primitive: "box", size: [0.42, 0.28, 0.08] }, castShadow: true, receiveShadow: true },
},
];
const LEGACY_BACKEND_PROP_PRESETS: PropPreset[] = [
{
id: "red-cube",
label: "Red cube",
label: "Legacy red test prop",
labelKey: "preset.prop.redCube",
material: { id: "builder_red", color: "#e11d48", roughness: 0.56 },
object: { geometry: { kind: "primitive", primitive: "box", size: [0.16, 0.16, 0.16] }, castShadow: true, receiveShadow: true },
},
{
id: "blue-crate",
label: "Blue crate",
label: "Legacy blue test prop",
labelKey: "preset.prop.blueCrate",
material: { id: "builder_blue", color: "#2563eb", roughness: 0.58 },
object: { geometry: { kind: "primitive", primitive: "box", size: [0.22, 0.16, 0.12] }, castShadow: true, receiveShadow: true },
},
{
id: "green-ball",
label: "Green ball",
label: "Legacy green test prop",
labelKey: "preset.prop.greenBall",
material: { id: "builder_green", color: "#22c55e", roughness: 0.42 },
object: { geometry: { kind: "primitive", primitive: "sphere", radius: 0.09, segments: 32 }, castShadow: true, receiveShadow: true },
},
{
id: "yellow-capsule",
label: "Yellow capsule",
label: "Legacy yellow test prop",
labelKey: "preset.prop.yellowCapsule",
material: { id: "builder_yellow", color: "#eab308", roughness: 0.5 },
object: {
@ -430,13 +481,6 @@ const PROP_PRESETS: PropPreset[] = [
receiveShadow: true,
},
},
{
id: "pallet",
label: "Low pallet",
labelKey: "preset.prop.pallet",
material: { id: "builder_pallet", color: "#a16207", roughness: 0.76 },
object: { geometry: { kind: "primitive", primitive: "box", size: [0.42, 0.28, 0.08] }, castShadow: true, receiveShadow: true },
},
];
const CUSTOM_PROP_PRESETS: PropPreset[] = [];
@ -471,48 +515,11 @@ const SCENE_TEMPLATES: SceneTemplate[] = [
titleKey: "title.templateStore",
config: {
version: 1,
sceneId: "g1-store-blocks-physics",
sceneId: BACKEND_STORE_SCENE_ID,
robotId: "none",
robotPose: [...PHYSICAL_G1_SAFE_POSE],
physicsEnabled: true,
props: [
{ presetId: "red-cube", position: [0.72, -0.48, 0.08] },
{ presetId: "blue-crate", position: [1, -0.48, 0.08] },
{ presetId: "green-ball", position: [1.28, -0.48, 0.09] },
{ presetId: "yellow-capsule", position: [1.56, -0.48, 0.08] },
],
},
},
{
id: "empty-layout",
labelKey: "button.templateEmpty",
titleKey: "title.templateEmpty",
config: {
version: 1,
sceneId: "empty",
robotId: "none",
robotPose: [0, 0, 0],
physicsEnabled: false,
props: [
{ presetId: "red-cube", position: [0.45, -0.2, 0.08] },
{ presetId: "blue-crate", position: [0.75, -0.2, 0.08] },
{ presetId: "green-ball", position: [1.05, -0.2, 0.09] },
],
},
},
{
id: "arm-pick",
labelKey: "button.templateArm",
titleKey: "title.templateArm",
config: {
version: 1,
sceneId: "franka-cube",
robotId: "none",
robotPose: [0, 0, 0],
physicsEnabled: true,
props: [
{ presetId: "red-cube", position: [0.62, 0, 0.08] },
],
props: [],
},
},
];
@ -943,7 +950,7 @@ function labelFor(preset: { label: string; labelKey?: MessageKey }): string {
}
function propLabelById(presetId: string): string {
const preset = allPropPresets().find((candidate) => candidate.id === presetId);
const preset = propPresetById(presetId);
return preset ? labelFor(preset) : presetId;
}
@ -952,7 +959,7 @@ function allPropPresets(): PropPreset[] {
}
function propPresetById(presetId: string): PropPreset | undefined {
return allPropPresets().find((candidate) => candidate.id === presetId);
return [...PROP_PRESETS, ...LEGACY_BACKEND_PROP_PRESETS, ...CUSTOM_PROP_PRESETS].find((candidate) => candidate.id === presetId);
}
function allScenePresets(): ScenePreset[] {
@ -1316,7 +1323,7 @@ function clearUploadedPropPresets(): void {
revokeUploadedPropAssetUrl(preset);
}
CUSTOM_PROP_PRESETS.length = 0;
clearBuilderPropsForMissingPresetIds(new Set(PROP_PRESETS.map((preset) => preset.id)));
clearBuilderPropsForMissingPresetIds(new Set([...PROP_PRESETS, ...LEGACY_BACKEND_PROP_PRESETS].map((preset) => preset.id)));
if (selectedBuilderPropId && !allPropPresets().some((candidate) => candidate.id === selectedBuilderPropId)) {
selectedBuilderPropId = builderProps[0]?.id;
}
@ -1733,6 +1740,7 @@ async function loadResolvedManifest(manifest: SceneManifest, telemetry?: Builder
const startedAt = performance.now();
stateClient.disconnect();
latestFrame = undefined;
applyStoreCameraPolicy(manifest);
currentManifest = manifest;
controlUrl = resolveControlUrl(manifest);
currentStateUrl = manifest.state?.mode === "poll" ? manifest.state.url : undefined;
@ -1744,17 +1752,6 @@ async function loadResolvedManifest(manifest: SceneManifest, telemetry?: Builder
renderJointControls();
renderActuatorControls();
renderInputAvailability();
const stateConnectStartedAt = performance.now();
let stateConnectMs = 0;
let stateConnectError: unknown;
const stateConnect = stateClient.connect(manifest.state)
.then(() => {
stateConnectMs = performance.now() - stateConnectStartedAt;
})
.catch((error: unknown) => {
stateConnectMs = performance.now() - stateConnectStartedAt;
stateConnectError = error;
});
const previewLoadStartedAt = performance.now();
await previewer.loadManifest(manifest);
if (telemetry) {
@ -1774,6 +1771,25 @@ async function loadResolvedManifest(manifest: SceneManifest, telemetry?: Builder
setMainStatus("status.manifestLoaded", { count: manifest.objects.length });
addActivity("activity.manifestLoaded", { count: manifest.objects.length }, "ok");
pendingCameraFit = true;
const initialStateFrame = currentStateUrl ? await fetchInitialFullStateFrame(currentStateUrl) : undefined;
if (initialStateFrame) {
applyRuntimeFrame(initialStateFrame, false);
if (Object.keys(initialStateFrame.bodies ?? {}).length > 0) {
pendingCameraFit = false;
window.requestAnimationFrame(() => previewer.refitCamera());
}
}
const stateConnectStartedAt = performance.now();
let stateConnectMs = 0;
let stateConnectError: unknown;
const stateConnect = stateClient.connect(manifest.state)
.then(() => {
stateConnectMs = performance.now() - stateConnectStartedAt;
})
.catch((error: unknown) => {
stateConnectMs = performance.now() - stateConnectStartedAt;
stateConnectError = error;
});
await stateConnect;
if (stateConnectError) {
throw stateConnectError;
@ -1800,6 +1816,24 @@ async function loadResolvedManifest(manifest: SceneManifest, telemetry?: Builder
schedulePixelProofRefresh(telemetry);
}
async function fetchInitialFullStateFrame(stateUrl: string): Promise<PreviewFrame> {
const response = await fetchWithTimeout(stateUrl, { cache: "no-store" }, 5000);
if (!response.ok) {
throw new Error(`state request failed: ${response.status}`);
}
return (await response.json()) as PreviewFrame;
}
function applyStoreCameraPolicy(manifest: SceneManifest): void {
const hasStoreShelf = manifest.objects.some((object) => (
object.editableGroup?.startsWith("store-shelf")
|| object.body?.startsWith("store_movable_V_Shelf_")
));
if (hasStoreShelf) {
delete manifest.camera;
}
}
function resolveManifestUrls(manifest: SceneManifest, manifestUrl: string): SceneManifest {
const resolved: SceneManifest = structuredClone(manifest);
if (resolved.state?.url) {
@ -2096,7 +2130,7 @@ function renderBuilderOptions(resetSelection = true): void {
const sceneSelect = document.querySelector<HTMLSelectElement>("#builder-scene")!;
const robotSelect = document.querySelector<HTMLSelectElement>("#builder-robot")!;
const propSelect = document.querySelector<HTMLSelectElement>("#builder-prop")!;
const sceneValue = resetSelection ? "g1-store-blocks-physics" : sceneSelect.value;
const sceneValue = resetSelection ? DEFAULT_BUILDER_SCENE_ID : sceneSelect.value;
const robotValue = resetSelection ? "none" : robotSelect.value;
const propValue = propSelect.value;
fillPresetSelect("#builder-scene", allScenePresets());
@ -2138,7 +2172,7 @@ function applyContextualRobotLabels(sceneId: string): void {
if (!noneOption) {
return;
}
noneOption.textContent = sceneId === "g1-store-blocks-physics"
noneOption.textContent = sceneId === BACKEND_STORE_SCENE_ID
? t("preset.robot.sceneBuiltInG1")
: t("preset.robot.none");
}
@ -2163,11 +2197,13 @@ function renderAssetGrid(): void {
container.innerHTML = allPropPresets().map((preset) => {
const color = preset.material.color ?? "#93c5fd";
const isUploaded = CUSTOM_PROP_PRESETS.some((candidate) => candidate.id === preset.id);
const physicsLabel = isUploaded ? t("physicsTier.visualOnly") : t("physicsTier.composeDynamic");
const physicsClass = isUploaded ? "visual" : "dynamic";
const canUseBackend = isBackendComposePropId(preset.id);
const blocked = builderPhysicsEnabled && !canUseBackend;
const physicsLabel = canUseBackend ? t("physicsTier.composeDynamic") : t("physicsTier.requiresBackend");
const physicsClass = canUseBackend ? "dynamic" : "visual";
const removeAction = isUploaded ? `<button class="asset-remove" data-remove-asset="${preset.id}" title="${t("title.remove")}">×</button>` : "";
return `
<button class="asset-card" data-add-preset="${preset.id}" title="${t("title.add")} ${labelFor(preset)}">
<button class="asset-card" data-add-preset="${preset.id}" title="${t("title.add")} ${labelFor(preset)}" ${blocked ? "disabled" : ""}>
<span class="asset-swatch" style="--asset-color: ${color}"></span>
<span class="asset-meta">
<strong>${labelFor(preset)}</strong>
@ -2202,22 +2238,26 @@ function isCustomUploadedPropId(presetId: string): boolean {
return presetId.startsWith(CUSTOM_PROP_PRESET_PREFIX) || CUSTOM_PROP_PRESETS.some((preset) => preset.id === presetId);
}
function isBackendComposePropId(presetId: string): boolean {
return BACKEND_COMPOSE_PROP_IDS.has(presetId);
}
function canRobotUseBackendCompose(scenePreset: ScenePreset, robotPreset = selectedRobotPreset()): boolean {
if (!scenePreset.composeUrl) {
return false;
}
return scenePreset.id === "g1-store-blocks-physics" && (robotPreset.id === "none" || robotPreset.id === "g1");
return scenePreset.id === BACKEND_STORE_SCENE_ID && (robotPreset.id === "none" || robotPreset.id === "g1");
}
function canUseBackendCompose(scenePreset: ScenePreset, robotPreset = selectedRobotPreset()): boolean {
return builderPhysicsEnabled
&& Boolean(scenePreset.composeUrl)
&& canRobotUseBackendCompose(scenePreset, robotPreset)
&& builderProps.every((item) => !isCustomUploadedPropId(item.presetId));
&& builderProps.every((item) => isBackendComposePropId(item.presetId));
}
function builderPropPhysicsClass(item: BuilderProp): "dynamic" | "visual" {
return canUseBackendCompose(selectedScenePreset()) && !isCustomUploadedPropId(item.presetId) ? "dynamic" : "visual";
return canUseBackendCompose(selectedScenePreset()) && isBackendComposePropId(item.presetId) ? "dynamic" : "visual";
}
function builderPropPhysicsLabel(item: BuilderProp): string {
@ -2269,12 +2309,21 @@ function renderBuilderSummary(): void {
}
function basePropHeight(presetId: string): number {
if (presetId === "store-bottle-350") return 0;
if (presetId === "store-bottle-360") return 0;
if (presetId === "store-can-250") return 0;
if (presetId === "store-can-330") return 0;
if (presetId === "store-tetra-250") return 0;
if (presetId === "store-tetra-500") return 0;
if (presetId === "green-ball") return 0.09;
if (presetId === "pallet") return 0.04;
return 0.08;
}
function pushBuilderProp(presetId: string, position?: Vec3): BuilderProp {
if (builderPhysicsEnabled && !isBackendComposePropId(presetId)) {
throw new Error(t("status.builder.visualFallback"));
}
const preset = propPresetById(presetId) ?? allPropPresets()[0];
if (!preset) {
throw new Error(`preset not found: ${presetId}`);
@ -2294,9 +2343,15 @@ function pushBuilderProp(presetId: string, position?: Vec3): BuilderProp {
return item;
}
function addBuilderProp(): void {
pushBuilderProp(selectedPropPreset().id);
renderBuilderProps();
function addBuilderProp(): boolean {
try {
pushBuilderProp(selectedPropPreset().id);
renderBuilderProps();
return true;
} catch (error) {
setText("#builder-status", (error as Error).message);
return false;
}
}
function seedBuilderPropsForSelectedScene(): void {
@ -2505,7 +2560,10 @@ function currentAcceptanceChecks(
const hasUsefulMeshes = stats.loadedMeshCount > 0 || stats.objectCount > 0;
const reportText = document.querySelector<HTMLTextAreaElement>("#workflow-report-text")?.value.trim() ?? "";
const hasAcceptanceSummary = Boolean(acceptanceLastRunAt);
const hasRealBackendPhysicsObjects = physicsProfile.backendDynamic > 0 && physicsProfile.backendFixed > 0;
const hasBackendPhysicsCoverage = physicsProfile.backendFixed > 0
&& (physicsProfile.backendDynamic + physicsProfile.backendStateOnly) > 0
&& physicsProfile.total === stats.objectCount
&& physicsProfile.visualOnly === 0;
return [
{
id: "manifest",
@ -2560,7 +2618,7 @@ function currentAcceptanceChecks(
label: t("acceptance.check.physicsTiers"),
detail: objectPhysicsProfileLabel(physicsProfile),
state: health.hasBackendPhysics
? hasRealBackendPhysicsObjects
? hasBackendPhysicsCoverage
? "pass"
: "warn"
: "warn",
@ -2569,7 +2627,9 @@ function currentAcceptanceChecks(
id: "builder-physics",
label: t("acceptance.check.builderPhysics"),
detail: builderPhysicsProfileLabel(builderPhysics),
state: !builderPhysicsEnabled
state: builderPhysics.total === 0
? "pass"
: !builderPhysicsEnabled
? "warn"
: health.hasBackendPhysics
? builderPhysics.ready
@ -2582,8 +2642,8 @@ function currentAcceptanceChecks(
{
id: "report",
label: t("acceptance.check.report"),
detail: reportText || hasAcceptanceSummary ? t("acceptance.detail.reportOk") : t("acceptance.detail.reportPending"),
state: reportText || hasAcceptanceSummary ? "pass" : "warn",
detail: reportText || hasAcceptanceSummary ? t("acceptance.detail.reportOk") : t("acceptance.detail.reportOptional"),
state: "pass",
},
];
}
@ -3625,14 +3685,16 @@ function renderBuilderPhysicsGuard(): void {
const backendRobotReady = canRobotUseBackendCompose(scenePreset, robotPreset);
const hasCustomUploadedProps = builderProps.some((item) => isCustomUploadedPropId(item.presetId));
const physicsToggle = document.querySelector<HTMLInputElement>("#builder-physics-enabled");
builderPhysicsEnabled = true;
if (physicsToggle) {
physicsToggle.checked = builderPhysicsEnabled;
physicsToggle.checked = true;
physicsToggle.disabled = true;
}
setText("#builder-physics-hint", builderPhysicsEnabled ? t("label.enablePhysicsHintOn") : t("label.enablePhysicsHintOff"));
const propSelect = document.querySelector<HTMLSelectElement>("#builder-prop")!;
const addButton = document.querySelector<HTMLButtonElement>("#builder-add-prop")!;
propSelect.disabled = false;
addButton.disabled = false;
addButton.disabled = builderPhysicsEnabled && !isBackendComposePropId(propSelect.value);
setText(
"#builder-status",
builderPhysicsEnabled
@ -3679,7 +3741,7 @@ function isVec3(value: unknown): value is Vec3 {
}
function defaultRobotPoseForScene(sceneId: string): Vec3 {
return sceneId === "g1-store-blocks-physics" ? [...PHYSICAL_G1_SAFE_POSE] : [0, 0, 0];
return sceneId === BACKEND_STORE_SCENE_ID ? [...PHYSICAL_G1_SAFE_POSE] : [0, 0, 0];
}
function parseBuilderConfig(raw: string | null): BuilderConfig | undefined {
@ -3731,13 +3793,11 @@ function applyBuilderConfig(config: BuilderConfig, recordHistory = true): void {
const robotSelect = document.querySelector<HTMLSelectElement>("#builder-robot")!;
sceneSelect.value = isScenePresetIdKnown(config.sceneId) ? config.sceneId : allScenePresets()[0]?.id ?? SCENE_PRESETS[0].id;
robotSelect.value = ROBOT_PRESETS.some((preset) => preset.id === config.robotId) ? config.robotId : ROBOT_PRESETS[0].id;
builderPhysicsEnabled = typeof config.physicsEnabled === "boolean"
? config.physicsEnabled
: defaultPhysicsEnabledForScene(sceneSelect.value);
builderPhysicsEnabled = true;
builderRobotPose = isVec3(config.robotPose) ? [...config.robotPose] : defaultRobotPoseForScene(config.sceneId);
builderProps.length = 0;
for (const item of config.props) {
if (propPresetById(item.presetId)) {
if (propPresetById(item.presetId) && isBackendComposePropId(item.presetId)) {
pushBuilderProp(item.presetId, item.position);
}
}
@ -3901,7 +3961,7 @@ async function buildAndLoadBuilderScene(savedStatusKey: MessageKey = "status.wor
try {
let composedScene: ComposeSceneResult | undefined;
let manifest: SceneManifest;
if (useBackendCompose) {
if (useBackendCompose) {
const composeStartedAt = performance.now();
composedScene = await composePhysicalScene(scenePreset, robotPreset);
telemetry.composeMs = performance.now() - composeStartedAt;
@ -3909,6 +3969,15 @@ async function buildAndLoadBuilderScene(savedStatusKey: MessageKey = "status.wor
telemetry.resetApplied = composedScene.resetApplied;
manifest = composedScene.manifest;
} else {
if (builderPhysicsEnabled) {
throw new Error(
!canRobotUseBackendCompose(scenePreset, robotPreset)
? t("status.builder.robotVisualFallback")
: scenePreset.composeUrl
? t("status.builder.visualFallback")
: t("status.builder.physicsUnavailable"),
);
}
const createManifestStartedAt = performance.now();
manifest = await createBuilderManifest(scenePreset, robotPreset, builderRobotPose, { physicsEnabled: builderPhysicsEnabled });
telemetry.createManifestMs = performance.now() - createManifestStartedAt;
@ -4792,7 +4861,12 @@ document.querySelector<HTMLDivElement>("#asset-grid")!.addEventListener("click",
if (!target?.dataset.addPreset) {
return;
}
pushBuilderProp(target.dataset.addPreset);
try {
pushBuilderProp(target.dataset.addPreset);
} catch (error) {
setText("#builder-status", (error as Error).message);
return;
}
renderBuilderProps();
recordBuilderHistory();
saveBuilderDraft();
@ -4858,12 +4932,15 @@ document.querySelector<HTMLSelectElement>("#builder-scene")!.addEventListener("c
const sceneId = document.querySelector<HTMLSelectElement>("#builder-scene")!.value;
applyContextualRobotLabels(sceneId);
builderRobotPose = defaultRobotPoseForScene(sceneId);
builderPhysicsEnabled = defaultPhysicsEnabledForScene(sceneId);
builderPhysicsEnabled = true;
seedBuilderPropsForSelectedScene();
renderBuilderPhysicsGuard();
recordBuilderHistory();
saveBuilderDraft();
});
document.querySelector<HTMLSelectElement>("#builder-prop")!.addEventListener("change", () => {
renderBuilderPhysicsGuard();
});
document.querySelector<HTMLSelectElement>("#builder-robot")!.addEventListener("change", () => {
const previousRobotId = builderConfig().robotId;
const nextRobotId = document.querySelector<HTMLSelectElement>("#builder-robot")!.value;
@ -4876,7 +4953,8 @@ document.querySelector<HTMLSelectElement>("#builder-robot")!.addEventListener("c
renderBuilderSummary();
});
document.querySelector<HTMLInputElement>("#builder-physics-enabled")!.addEventListener("change", (event) => {
builderPhysicsEnabled = (event.target as HTMLInputElement).checked;
(event.target as HTMLInputElement).checked = true;
builderPhysicsEnabled = true;
renderBuilderPhysicsGuard();
recordBuilderHistory();
saveBuilderDraft();
@ -4886,7 +4964,9 @@ document.querySelector<HTMLInputElement>("#builder-physics-enabled")!.addEventLi
});
});
document.querySelector<HTMLButtonElement>("#builder-add-prop")!.addEventListener("click", () => {
addBuilderProp();
if (!addBuilderProp()) {
return;
}
recordBuilderHistory();
saveBuilderDraft();
void buildAndLoadBuilderScene().catch((error) => {

View File

@ -441,9 +441,13 @@ export class UniversalPreviewer {
const editableStartedAt = performance.now();
this.refreshEditableObjectIds();
this.sceneLoadEditableRefreshMs = performance.now() - editableStartedAt;
const cameraFitStartedAt = performance.now();
this.fitCameraToObjects();
this.sceneLoadCameraFitMs = performance.now() - cameraFitStartedAt;
if (!manifest.camera) {
const cameraFitStartedAt = performance.now();
this.fitCameraToObjects();
this.sceneLoadCameraFitMs = performance.now() - cameraFitStartedAt;
} else {
this.sceneLoadCameraFitMs = 0;
}
this.sceneLoadTotalMs = performance.now() - loadStartedAt;
this.updateStatus(`manifest loaded: ${manifest.objects.length} objects`);
} finally {
@ -501,8 +505,7 @@ export class UniversalPreviewer {
if (!bound) {
continue;
}
if (this.shouldSkipFixedBodyState(bodyName, bound)) {
this.cacheBodyState(bodyName, bodyState);
if (this.shouldSkipFixedBodyState(bodyName, bound) && this.isCachedBodyStateUnchanged(bodyName, bodyState)) {
skippedBodyStateCount += bound.length;
continue;
}