Skip to content

Feat: 接入 SceneEntityCfg 的 NumPy entity facade #1047

Description

@TATP-233

普通说明

只做一件事:让 manager term 能通过 env.scene["robot"]SceneEntityCfg,在初始化阶段把显式声明的 joint/body/geom/site/actuator 名称解析成缓存 ID,并从 UniLab 现有 SimBackend 读取 NumPy state view。

不接入 NpEnv.step/reset,不迁移生产 task,不新增 backend 方法,不解析 XML/asset,不实现第二套 scene composer,也不提供缺失能力的 fallback。预计 8–15 个文件、≤1,500 行 UniLab-specific 改动、1 个 PR。永久维护成本是一套很薄的 base scene/entity facade、selector conformance tests,以及明确的 capability error;backend 和 manager 不增加平行实现。

最小交付结果

  • src/unilab/base/ 增加显式 entity declaration、name-addressable scene facade 与 NumPy entity data facade。
  • SceneCfg 可声明 entity 分区;facade 只调用现有正式 SimBackend 方法,缓存 entity-local → backend ID/index 映射。
  • 保留 pinned mjlab SceneEntityCfg 的 name/regex、preserve_order、name/ID consistency 与全选压缩语义。
  • root/joint/body state 以及 geom/site/actuator selector 在已有 backend contract 范围内工作;未声明或 backend 不支持的 namespace 在冷路径直接 raise。
  • error 包含 manager、term、entity、capability 与 backend;不 warning、skip、zero/no-op 或旧路径 fallback。

In scope

  • base-owned EntityCfg / entity / scene / data facade。
  • cold-path materialization、regex selector、缓存 ID/index。
  • MuJoCo/Motrix/Drake capability-profile conformance tests(可使用严格 fake backend),以及真实 MuJoCo representative smoke。
  • manager term config resolution 的错误上下文。
  • repository-boundary test:不得访问 backend 私有对象,不得在热路径解析名称或 asset。

Non-goals

  • 不修改 NpEnv.step/reset、runner、scripts、IPC、learner、Hydra compose 或 production task。
  • 不新增 SimBackend 方法;若现有 contract 不足,停止并拆独立 backend-contract child。
  • 不实现 state write、完整 scene/asset hierarchy、sensor facade、terrain composer 或 unsupported tendon/camera/light/material/texture/pair 能力。

Owner 与预算

Base scene/entity public contract;普通/公共 contract child。≤25 个非删除文件、≤1,500 行 UniLab-specific 改动,1 PR;base 为 dev/issue-1042-manager-based-api

Acceptance criteria

  • selector 只在 construction/materialization 解析一次,step-like repeated reads 不再次调用 name resolver。
  • entity view 与 env IDs 全部使用 NumPy/slice;无 Torch、IPC、runner 或 backend private import。
  • supported state shape/order 与配置的 entity-local order 一致。
  • unsupported/missing capability 在最近冷路径 fail closed,诊断包含完整上下文。
  • focused tests 与 make test-all 通过。

Stop conditions

需要新增 SimBackend 方法、完整 scene runtime、backend 私有对象、XML/asset 热路径或第二套 entity implementation 时停止。

Umbrella: #1042
Depends on: #1045

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions