Stabilize store inventory physics tiers

This commit is contained in:
eust-w 2026-06-24 16:09:20 +08:00
parent 4c07aa5a73
commit 0df3f8497a
10 changed files with 272 additions and 54 deletions

View File

@ -76,16 +76,16 @@ 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 physics world.
objects share one MotrixSim collision world.
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
free joints and collision geoms, not front-end-only Three.js meshes.
For physical store scenes, the bridge also publishes product-level
`editableGroup` metadata derived from real runtime body poses. Store shelf
frames and plates are fixed environment bodies so they keep their collision
shape and do not topple when the simulator resumes. Store products and user
added primitive props remain real dynamic bodies that can be edited while
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.
@ -274,7 +274,7 @@ Additional remote scenes verified:
- 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, products, and demo
primitives. Store shelf/product groups are exposed as editable entity groups
so the web UI can synchronize paused layout edits back into the MotrixSim
runtime instead of only moving Three.js visuals.
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`.

View File

@ -23,6 +23,7 @@ runtime state by body name.
{
"id": "ball_visual",
"body": "_unnamed_link_0",
"physics": "dynamic",
"editableGroup": "shelf-1",
"editableGroupRole": "member",
"geometry": { "kind": "primitive", "primitive": "sphere", "radius": 0.5 },
@ -51,11 +52,14 @@ runtime state by body name.
- Materials: solid color, transparent color, file texture, and generated
checker texture with repeat.
- State binding: `object.body` maps a visual node to a runtime body name.
- Physics role: `object.physics` may be `dynamic`, `fixed`, `stateOnly`, or
`visualOnly`. The browser uses this to decide whether an object can be
dragged and how to label physics tiers; `fixed` bodies can still have backend
collision while being protected from pose edits.
- Editable grouping: `object.editableGroup` groups multiple real runtime
bodies into a product-level edit entity. `editableGroupRole = "anchor"` means
dragging this object moves all editable objects in the group. `"member"`
means the object follows anchor drags but remains individually draggable when
picked directly.
bodies into a product-level entity. `editableGroupRole = "anchor"` and
`"member"` describe group structure; actual editability is governed by
`object.physics`.
- Runtime body names may be MotrixSim body names or link names. The headless
bridge publishes link poses first, then fills non-duplicate body poses.
- MJCF export: the current exporter expands `<include>` files, resolves mesh
@ -108,9 +112,10 @@ bridge. The current bridge supports:
- `{"action": "set_joints", "values": {"joint1": 0, "joint2": 0.6}}`
- `{"action": "gripper", "value": 0.04}` for known finger joints
- `{"action": "set_body_pose", "body": "box_0", "pos": [0.6, 0, 0.2],
"quat": [0, 0, 0, 1]}` for paused entity layout edits
- `{"action": "set_body_poses", "poses": [...]}` for paused batched edits,
such as moving a shelf anchor and all grouped products together
"quat": [0, 0, 0, 1]}` for paused edits of dynamic bodies
- `{"action": "set_body_poses", "poses": [...]}` for paused batched dynamic
body edits. Fixed bodies return an explicit error instead of being silently
moved.
The bridge returns the same frame shape as `/state`, so the frontend can update
the renderer and the control panel from one response.

View File

@ -28,10 +28,11 @@ Important properties:
- Three.js renders real manifest assets and applies real runtime body poses.
- Pause, resume, reset, step, joint edits, and body pose edits are sent to
`/control`; the UI does not invent physics results.
- Store shelf frames and plates are fixed environment collision bodies. This
prevents the shelf scene from toppling when the simulator resumes.
- Store products and user-added primitive props remain real dynamic bodies that
can be edited while paused and then released back to backend physics.
- 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.
- 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
@ -115,8 +116,9 @@ 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 object/product body
pose sync and fixed shelf anchor stability after resume.
- Real backend editing through `/control`, including dynamic primitive 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.
@ -197,10 +199,15 @@ Representative product gate baseline for the current thresholds:
and live state.
- Static shelf stability: selected shelf anchors had `max drift 0.00000m` after
a 2500 ms resume window, preventing the shelf-toppling regression.
- 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,
proving dynamic props still use backend physics.
- Object physics tiers: the diagnostics panel and exported acceptance artifacts
count backend dynamic, backend fixed, backend state-only, and visual-only
objects. The release gate requires at least one backend fixed environment
object and at least four backend dynamic objects in the product physical scene.
objects. The product physical scene currently reports `dynamic=4`,
`fixed=568`, `stateOnly=63`, and `visualOnly=1`.
- Product UI compose: the Scene Builder `Physical Scene` workflow reaches
`后端物理组合场景`, keeps `4` builder props, exposes `/control`, and shows
`外部仿真 / 后端物理` diagnostics.
@ -291,8 +298,9 @@ Control evidence:
- Compose endpoint: `567ms`, `4/4` composed object bodies synced.
- Scene Builder UI compose: representative run `47850ms` end to end with real
backend diagnostics.
- Composed object body edit: `44ms`.
- Shelf product member edit: `60ms`.
- Composed object body edit: `133ms`.
- Fixed inventory edit rejection: `86ms`.
- Dynamic composed object drop: `0.48012m`.
- Static shelf anchor stability: `max drift 0.00000m` after a 2500 ms resume
window.
- Resume backend state: `56ms paused=false`
@ -378,9 +386,9 @@ Current supported product path:
- Product UI physical composition through the Scene Builder `Physical Scene`
control.
- Real backend pause/resume/reset/step.
- Real backend dynamic body pose editing while paused.
- Fixed shelf anchors with product grouping metadata for inspection and
stability checks.
- Real backend dynamic primitive body pose editing while paused.
- 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.
@ -413,5 +421,5 @@ Before calling a build acceptable for demo or review:
9. The browser gate proves the downloaded HTML acceptance report renders with
readable acceptance evidence.
10. `verify:real-backend` shows real `/compose`, composed object body sync,
product body sync, and fixed shelf anchor stability.
fixed inventory protection, dynamic object drop, and fixed shelf stability.
11. Any new physical asset type has an explicit backend compose/export path.

View File

@ -56,6 +56,40 @@ function summarize(items) {
};
}
function logProgress(message) {
process.stderr.write(`[product-gate] ${message}\n`);
}
async function withTimeout(label, promise, timeoutMs = 15000) {
let timeout;
try {
return await Promise.race([
promise,
new Promise((_, reject) => {
timeout = setTimeout(() => reject(new Error(`${label} timed out after ${timeoutMs}ms`)), timeoutMs);
}),
]);
} finally {
clearTimeout(timeout);
}
}
async function closeContext(context, label) {
try {
await withTimeout(label, context.close(), 15000);
} catch (error) {
check(`${label}-close`, "warn", error.message);
}
}
async function closeBrowser(browser) {
try {
await withTimeout("browser.close", browser.close(), 15000);
} catch (error) {
check("browser-close", "warn", error.message);
}
}
function run(args, options = {}) {
const [bin, ...rest] = args;
return new Promise((resolve) => {
@ -745,7 +779,7 @@ async function clickAndSaveDownload(page, selector, filePath) {
clickButton(page, selector),
]);
const suggestedFilename = download.suggestedFilename();
await download.saveAs(filePath);
await withTimeout(`save download ${suggestedFilename}`, download.saveAs(filePath), 15000);
return {
path: filePath,
suggestedFilename,
@ -1091,7 +1125,7 @@ async function restoreBuilderConfigFile(browser, configExport) {
screenshot,
};
} finally {
await context.close();
await closeContext(context, "config-import-context");
}
}
@ -1144,7 +1178,7 @@ async function restoreBuilderShareLink(browser, shareLink) {
screenshot,
};
} finally {
await context.close();
await closeContext(context, "share-restore-context");
}
}
@ -1251,7 +1285,8 @@ async function verifyBrowser() {
await postControl("pause");
const browser = await chromium.launch({ headless: true });
try {
const builderContext = await browser.newContext({ viewport: { width: 1440, height: 820 }, deviceScaleFactor: 1 });
logProgress("builder compose start");
const builderContext = await browser.newContext({ viewport: { width: 1440, height: 820 }, deviceScaleFactor: 1, acceptDownloads: true });
await builderContext.grantPermissions(["clipboard-read", "clipboard-write"], { origin: frontendOrigin() });
await builderContext.addInitScript(() => {
window.localStorage.removeItem("motrixsim-web-locale");
@ -1267,13 +1302,19 @@ async function verifyBrowser() {
);
const builderConfigExport = await exportBuilderConfigArtifact(builderPage);
const shareLink = await copyBuilderShareLink(builderPage);
await builderContext.close();
await closeContext(builderContext, "builder-context");
logProgress("builder compose done");
await postControl("pause");
logProgress("share restore start");
const shareRestore = await restoreBuilderShareLink(browser, shareLink);
logProgress("share restore done");
await postControl("pause");
logProgress("config import restore start");
const configImportRestore = await restoreBuilderConfigFile(browser, builderConfigExport);
logProgress("config import restore done");
await postControl("pause");
logProgress("desktop acceptance start");
const desktopContext = await browser.newContext({ viewport: { width: 1440, height: 820 }, deviceScaleFactor: 1, acceptDownloads: true });
await desktopContext.addInitScript(() => {
window.localStorage.removeItem("motrixsim-web-locale");
@ -1290,8 +1331,10 @@ async function verifyBrowser() {
const desktopStats = await readBrowserStats(desktop);
const desktopScreenshot = await safeScreenshot("browser-desktop-screenshot", desktop, path.join(outDir, "product-readiness-desktop.jpg"), { preferCanvas: true });
const acceptanceExports = await exportAcceptanceArtifacts(desktop);
await desktopContext.close();
await closeContext(desktopContext, "desktop-context");
logProgress("desktop acceptance done");
logProgress("mobile acceptance start");
const mobileContext = await browser.newContext({ viewport: { width: 390, height: 844 }, deviceScaleFactor: 2, isMobile: true });
await mobileContext.addInitScript(() => {
window.localStorage.removeItem("motrixsim-web-locale");
@ -1303,7 +1346,8 @@ async function verifyBrowser() {
const mobileAcceptance = await runAcceptanceReview(mobile);
const mobileStats = await readBrowserStats(mobile);
const mobileScreenshot = await safeScreenshot("browser-mobile-screenshot", mobile, path.join(outDir, "product-readiness-mobile.jpg"), { preferPreview: true });
await mobileContext.close();
await closeContext(mobileContext, "mobile-context");
logProgress("mobile acceptance done");
const groups = parseGroups(desktopStats.groups);
const objectCount = numericText(desktopStats.objects);
@ -1407,7 +1451,7 @@ async function verifyBrowser() {
};
} finally {
await postControl("pause").catch(() => undefined);
await browser.close();
await closeBrowser(browser);
}
}

View File

@ -111,6 +111,8 @@ let singleMemberResult;
let resumeResult;
let pauseResult;
let staticAnchorMaxDrift;
let composedBody;
let liftedComposedPose;
try {
const healthUrl = new URL("/health", manifestUrl).href;
@ -216,9 +218,13 @@ try {
const missingGroupBodies = selectedGroup.bodies.filter((body) => !initialState?.bodies?.[body]);
checks.push(check("group-bodies-in-state", availableGroupBodies.length === selectedGroup.bodies.length, `${availableGroupBodies.length}/${selectedGroup.bodies.length} bodies available; missing=${missingGroupBodies.slice(0, 8).join(",")}`));
const composedBody = composedBodiesInState[0]?.id;
composedBody = composedBodiesInState[0]?.id;
const composedPose = poseForBody(initialState, composedBody);
composedBodyResult = await postControl(controlUrl, "set_body_pose", composedPose);
liftedComposedPose = {
...composedPose,
pos: [composedPose.pos[0], composedPose.pos[1], composedPose.pos[2] + 0.45],
};
composedBodyResult = await postControl(controlUrl, "set_body_pose", liftedComposedPose);
checks.push(check(
"composed-object-pose",
composedBodyResult.ok && composedBodyResult.json?.updated_bodies?.[0] === composedBody,
@ -230,12 +236,11 @@ try {
const memberPose = poseForBody(initialState, memberBody);
singleMemberResult = await postControl(controlUrl, "set_body_pose", memberPose);
checks.push(check(
"single-member-pose",
singleMemberResult.ok && singleMemberResult.json?.updated_bodies?.[0] === memberBody,
`${singleMemberResult.elapsedMs}ms updated=${singleMemberResult.json?.updated_bodies?.join(",")}`,
"fixed-inventory-pose-rejected",
!singleMemberResult.ok && /fixed|cannot be moved|set_body_pose/i.test(singleMemberResult.json?.error ?? ""),
`${singleMemberResult.elapsedMs}ms status=${singleMemberResult.status} error=${singleMemberResult.json?.error ?? "-"}`,
));
checks.push(check("single-member-latency", singleMemberResult.elapsedMs <= maxControlLatencyMs, `${singleMemberResult.elapsedMs}ms <= ${maxControlLatencyMs}ms`, "warn"));
checks.push(check("single-member-compact", !("bodies" in (singleMemberResult.json ?? {})), "single pose response omits full bodies"));
checks.push(check("fixed-inventory-reject-latency", singleMemberResult.elapsedMs <= maxControlLatencyMs, `${singleMemberResult.elapsedMs}ms <= ${maxControlLatencyMs}ms`, "warn"));
const anchorReference = new Map(
selectedGroup.anchors
@ -265,6 +270,15 @@ try {
anchorDrifts.length >= minAnchors && staticAnchorMaxDrift <= maxStaticAnchorDrift,
`${anchorDrifts.length} anchors; max drift ${staticAnchorMaxDrift.toFixed(5)}m after ${stabilityRunMs}ms`,
));
const finalComposedPose = finalState?.bodies?.[composedBody];
const composedDrop = liftedComposedPose && finalComposedPose
? liftedComposedPose.pos[2] - finalComposedPose.pos?.[2]
: 0;
checks.push(check(
"dynamic-composed-object-drop",
Number.isFinite(composedDrop) && composedDrop > 0.2,
`${composedBody ?? "-"} dropped ${composedDrop.toFixed(5)}m after resume`,
));
checks.push(check("final-state-paused", finalState?.paused === true, `paused=${finalState?.paused}; state in ${finalStateResponse.elapsedMs}ms`));
} catch (error) {
checks.push(check("unexpected-error", false, error?.stack ?? error?.message ?? String(error)));
@ -317,6 +331,11 @@ const report = {
groupedObjectCount: (manifest.objects ?? []).filter((object) => object.editableGroup).length,
anchorCount: (manifest.objects ?? []).filter((object) => object.editableGroupRole === "anchor").length,
memberCount: (manifest.objects ?? []).filter((object) => object.editableGroupRole === "member").length,
physics: (manifest.objects ?? []).reduce((acc, object) => {
const role = object.physics ?? (object.body ? "unknown" : "visualOnly");
acc[role] = (acc[role] ?? 0) + 1;
return acc;
}, {}),
}
: undefined,
selectedGroup: selectedGroup
@ -330,8 +349,11 @@ const report = {
: undefined,
controlTimings: {
composedBodyMs: composedBodyResult?.elapsedMs,
singleMemberMs: singleMemberResult?.elapsedMs,
fixedInventoryRejectMs: singleMemberResult?.elapsedMs,
staticAnchorMaxDrift,
dynamicDrop: liftedComposedPose && finalState?.bodies?.[composedBody]
? liftedComposedPose.pos[2] - finalState.bodies[composedBody].pos?.[2]
: undefined,
resumeMs: resumeResult?.elapsedMs,
pauseMs: pauseResult?.elapsedMs,
},

View File

@ -200,7 +200,29 @@ def wrap_worldbody_visual_geom_groups(root: ET.Element) -> int:
return wrapped_count
def write_namespaced_store_scene(store_scene: Path, output_path: Path) -> Path:
def freeze_store_product_joints(root: ET.Element) -> int:
"""Turn the pre-stocked store inventory into fixed collision bodies.
The store example contains hundreds of free bodies already resting on shelf
plates. Leaving all of them dynamic makes the scene easy to avalanche when
the robot or a dragged object bumps the display. Productized composition
keeps stock inventory as fixed environment collision and reserves dynamic
motion for user-added props.
"""
frozen = 0
for body in root.iter("body"):
name = body.get("name") or ""
if not is_store_product_body(name):
continue
joints = [child for child in list(body) if child.tag in {"joint", "freejoint"}]
for joint in joints:
body.remove(joint)
if joints:
frozen += 1
return frozen
def write_namespaced_store_scene(store_scene: Path, output_path: Path, *, freeze_inventory: bool = True) -> Path:
tree = ET.parse(store_scene)
root = tree.getroot()
compiler = root.find("compiler")
@ -221,6 +243,8 @@ def write_namespaced_store_scene(store_scene: Path, output_path: Path) -> Path:
element.set("file", (asset_base / file_name).resolve().as_posix())
wrap_worldbody_visual_geom_groups(root)
if freeze_inventory:
freeze_store_product_joints(root)
output_path.parent.mkdir(parents=True, exist_ok=True)
ET.indent(tree, space=" ")
@ -241,6 +265,26 @@ def is_store_product_body(body_name: str) -> bool:
return body_name.startswith(PRODUCT_BODY_PREFIXES)
def is_robot_state_body(body_name: str) -> bool:
normalized = body_name.lower()
return any(
token in normalized
for token in (
"link",
"pelvis",
"waist",
"hip",
"knee",
"ankle",
"shoulder",
"elbow",
"wrist",
"torso",
"head",
)
)
def body_position(runtime: "MotrixRuntime", body_name: str) -> list[float] | None:
try:
return runtime.pose_for("body", body_name)["pos"]
@ -254,12 +298,33 @@ def nearest_shelf_group(x: float, shelf_centers: list[tuple[float, str]]) -> str
return min(shelf_centers, key=lambda item: abs(item[0] - x))[1]
def annotate_physics_roles(payload: dict[str, Any], runtime: "MotrixRuntime") -> None:
pose_editable = runtime.pose_editable_bodies
for item in payload.get("objects", []):
if not isinstance(item, dict):
continue
body_name = item.get("body")
if not isinstance(body_name, str):
item["physics"] = "visualOnly"
continue
if is_shelf_body(body_name):
item["physics"] = "fixed"
elif is_robot_state_body(body_name):
item["physics"] = "stateOnly"
elif body_name in pose_editable:
item["physics"] = "dynamic"
elif body_name in runtime.body_names:
item["physics"] = "fixed" if is_store_product_body(body_name) else "stateOnly"
else:
item["physics"] = "stateOnly"
def annotate_editable_groups(payload: dict[str, Any], runtime: "MotrixRuntime") -> None:
"""Annotate exported objects with product-level edit groups.
Shelf frame/plate bodies are anchors: dragging one moves the whole shelf
unit. Products are members: they move with the shelf unit, but can still be
dragged individually when picked directly.
Shelf frame/plate bodies are anchors for inspection. Products are members
for grouping metadata; whether they are draggable is decided by their
physics role.
"""
frame_positions: list[tuple[int, float]] = []
for body_name in runtime.body_names:
@ -333,7 +398,13 @@ def compose_physical_scene(payload: dict[str, Any], compose_dir: Path) -> Path:
raise ValueError("at most 24 physical objects are supported per compose request")
compose_dir.mkdir(parents=True, exist_ok=True)
store_scene = write_namespaced_store_scene(DEFAULT_STORE_SCENE, compose_dir / "store_namespaced.xml")
stock_physics = str(payload.get("stockPhysics") or "fixed").lower()
freeze_inventory = stock_physics not in {"dynamic", "free", "movable"}
store_scene = write_namespaced_store_scene(
DEFAULT_STORE_SCENE,
compose_dir / "store_namespaced.xml",
freeze_inventory=freeze_inventory,
)
scene_path = compose_dir / "active_g1_store_scene.xml"
mujoco = ET.Element("mujoco", {"model": "motrixsim_web_composed"})
@ -598,12 +669,46 @@ def align_manifest_bodies(manifest: dict[str, Any], runtime_body_names: list[str
obj["runtimeBodyRemappedFrom"] = body
def iter_scene_roots(scene: Path, seen: set[Path] | None = None):
seen = seen or set()
scene = scene.resolve()
if scene in seen or not scene.is_file():
return
seen.add(scene)
try:
root = ET.parse(scene).getroot()
except ET.ParseError:
return
yield root
for include in root.findall("include"):
file_name = include.get("file")
if not file_name:
continue
include_path = Path(file_name)
if not include_path.is_absolute():
include_path = scene.parent / include_path
yield from iter_scene_roots(include_path, seen)
def collect_pose_editable_bodies(scene: Path) -> set[str]:
editable: set[str] = set()
for root in iter_scene_roots(scene):
for body in root.iter("body"):
name = body.get("name")
if not name:
continue
if any(child.tag in {"joint", "freejoint"} for child in list(body)):
editable.add(name)
return editable
class MotrixRuntime:
def __init__(self, scene: Path, reset_interval: float | None):
import motrixsim as mx
self.mx = mx
self.scene = scene
self.pose_editable_bodies = collect_pose_editable_bodies(scene)
self.model = mx.load_model(scene.as_posix())
self.data = mx.SceneData(self.model)
self.model.forward_kinematic(self.data)
@ -796,6 +901,8 @@ class MotrixRuntime:
body_name = str(payload.get("body") or "")
if not body_name:
raise ValueError("set_body_pose requires body")
if body_name not in self.pose_editable_bodies:
raise ValueError(f"body is fixed and cannot be moved with set_body_pose: {body_name}")
raw_pos = payload.get("pos")
if raw_pos is None:
raw_pos = payload.get("position")
@ -1067,6 +1174,7 @@ def main() -> int:
}
align_manifest_bodies(payload, runtime.body_names)
annotate_editable_groups(payload, runtime)
annotate_physics_roles(payload, runtime)
return payload, files
def create_bundle(scene: Path, *, paused: bool = False) -> tuple[MotrixRuntime, dict[str, Any], dict[str, Path], threading.Thread]:

View File

@ -660,7 +660,7 @@ const messages: Record<Locale, Messages> = {
"acceptance.detail.backendPending": "状态源尚未连接",
"acceptance.detail.controlMissing": "当前场景没有可用控制接口",
"acceptance.detail.objects": "{count} 个对象,{bindings} 个 body 绑定",
"acceptance.detail.editGroups": "{groups} 个组,{count} 个对象可按真实 body 同步编辑",
"acceptance.detail.editGroups": "{groups} 个组,{count} 个对象有真实 body 分组,固定库存受保护",
"acceptance.detail.assets": "{meshes} 个 mesh,{fallbacks} 个 fallback",
"acceptance.detail.pixels": "非背景采样 {count}",
"acceptance.detail.reportOk": "摘要已生成,可复制/导出",
@ -672,7 +672,7 @@ const messages: Record<Locale, Messages> = {
"acceptance.case.control.title": "仿真控制可用",
"acceptance.case.control.goal": "暂停、恢复、单步、重置等控制接口已连通。",
"acceptance.case.editing.title": "暂停态实体编排可同步",
"acceptance.case.editing.goal": "拖拽可编辑对象后,前端把真实 body pose 写回 MotrixSim;货架锚点会带动同组商品。",
"acceptance.case.editing.goal": "拖拽可编辑动态物体后,前端把真实 body pose 写回 MotrixSim;货架与默认库存保持固定环境碰撞。",
"acceptance.case.assets.title": "资产加载完整",
"acceptance.case.assets.goal": "mesh/primitive 能正常渲染,fallback 数量可见且可追踪。",
"acceptance.case.evidence.title": "交付证据可导出",
@ -1040,7 +1040,7 @@ const messages: Record<Locale, Messages> = {
"acceptance.detail.backendPending": "state source not connected yet",
"acceptance.detail.controlMissing": "no control endpoint is available for this scene",
"acceptance.detail.objects": "{count} objects, {bindings} body bindings",
"acceptance.detail.editGroups": "{groups} groups, {count} objects edit-synchronized through real body poses",
"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",
@ -1052,7 +1052,7 @@ const messages: Record<Locale, Messages> = {
"acceptance.case.control.title": "Simulation control is available",
"acceptance.case.control.goal": "Pause, resume, step, and reset controls are connected.",
"acceptance.case.editing.title": "Paused entity layout syncs back",
"acceptance.case.editing.goal": "Dragging editable objects writes real body poses back to MotrixSim; shelf anchors move their grouped products.",
"acceptance.case.editing.goal": "Dragging editable dynamic objects writes real body poses back to MotrixSim; shelves and default stock stay fixed environment collision.",
"acceptance.case.assets.title": "Assets load correctly",
"acceptance.case.assets.goal": "Meshes/primitives render and fallback counts remain visible and traceable.",
"acceptance.case.evidence.title": "Delivery evidence is exportable",

View File

@ -194,6 +194,10 @@ interface ObjectPhysicsProfile {
total: number;
}
function manifestPhysicsRole(object: PreviewObject): NonNullable<PreviewObject["physics"]> | undefined {
return object.physics;
}
const SCENE_PRESETS: ScenePreset[] = [
{ id: "empty", label: "Empty grid", labelKey: "preset.scene.empty" },
{
@ -1585,10 +1589,27 @@ function objectPhysicsProfile(manifest = currentManifest): ObjectPhysicsProfile
profile.visualOnly += 1;
continue;
}
const explicitRole = manifestPhysicsRole(object);
if (explicitRole === "visualOnly") {
profile.visualOnly += 1;
continue;
}
if (physicsModeKey !== "physics.backendPhysics") {
profile.backendStateOnly += 1;
continue;
}
if (explicitRole === "dynamic") {
profile.backendDynamic += 1;
continue;
}
if (explicitRole === "fixed") {
profile.backendFixed += 1;
continue;
}
if (explicitRole === "stateOnly") {
profile.backendStateOnly += 1;
continue;
}
if (object.editableGroupRole === "anchor" || !isDraggableObjectId(object.id)) {
profile.backendFixed += 1;
continue;
@ -3154,6 +3175,7 @@ async function composePhysicalScene(scenePreset: ScenePreset, robotPreset: Robot
scene: scenePreset.id,
robot: robotPreset.id,
robotPose: builderRobotPose,
stockPhysics: "fixed",
objects: builderProps.map((item) => ({
id: item.id,
presetId: item.presetId,
@ -3326,6 +3348,10 @@ function inferDefaultEditableObjectIds(manifest: SceneManifest, options: { requi
if (!isDraggableObjectId(object.id)) {
return false;
}
const physicsRole = manifestPhysicsRole(object);
if (physicsRole && physicsRole !== "dynamic") {
return false;
}
if (object.editableGroupRole === "anchor") {
return false;
}

View File

@ -1005,6 +1005,10 @@ export class UniversalPreviewer {
const isEditable = this.editableObjectIds.has(manifestId) || this.robotObjectIds.has(manifestId);
const disabledReason = isEditable && this.dragOptions.enabled === false
? "需暂停后拖拽"
: bound.manifest.physics === "fixed"
? "固定物理体"
: bound.manifest.physics === "stateOnly"
? "状态同步体"
: !isEditable && !bound.manifest.body
? "静态对象"
: undefined;

View File

@ -60,6 +60,7 @@ export interface PreviewObject {
id: string;
name?: string;
body?: string;
physics?: "dynamic" | "fixed" | "stateOnly" | "visualOnly";
parent?: string;
editableGroup?: string;
editableGroupRole?: "anchor" | "member";