环境要求

  • Python 3.12
  • FastSim 0.1.0a6
  • UniRoboSim Core 0.10.0
  • UniRoboSim Isaac Lab adapter 0.10.1
  • Isaac Lab 3.0 / Isaac Sim 6.0,以及可用显示环境

配置

Scenario 包含两个独立可控实体:

  • robots.arm 暴露包含两个关节的 arm 资源组;
  • articulations.door 暴露包含一个 hinge 的 door 资源组。

门不会被伪装成机器人。两者都是 articulation,也都通过相同公共 descriptor API 声明 可移植控制能力。

关键代码逐行说明

python
descriptors = await simulation.control.targets()

该调用返回当前编译 Run 的不可变 ControlTargetDescriptor。它不会暴露 PhysX articulation view 或原生 joint index。

python
space = next(
    item for item in descriptor.command_spaces
    if item.command_space_id == "joint.position@1"
)
axes = tuple(axis.name for axis in space.axes)
units = tuple(axis.units[0] for axis in space.axes)

程序从 command-space descriptor 得到轴顺序和单位,不假设不同 backend 使用相同私有索引。

python
track = ControlTrack(
    track_id=f"tutorial-{descriptor.resource_group}",
    resource=ActuatorResource(descriptor.entity_id, descriptor.resource_group),
    controller=space.controller_ids[0],
    command_space=space.command_space_id,
    frames=(ControlFrame(...), ControlFrame(...)),
    interpolation=interpolation,
    semantics=semantics,
)

entity ID、group、兼容 controller、command space、axes、units、插值能力和必需 semantics 都来自公共 descriptor。只有目标值属于应用意图:手臂为 0.7/-0.45 rad,门为 0.65 rad

python
operation = await simulation.control.submit_tracks(tracks, timeout=10.0)

tuple 中恰好有两个互不重叠的 track。FastSim 生成一个 chunk 和一个终态,而不是提交两个 互不相关的 arm/door operation。

运行

从本案例目录运行:

bash
cd demo/fundamentals/15_multi_resource_tracks
fastsim config validate run.yaml --json
python main.py

预期输出包含两个已发现资源、一个 succeeded operation,以及每个 track 的 2/2 frames

验证等级

真实可见 Isaac 已通过。 本案例使用 FastSim 0.1.0a3、Core 0.10.0、Isaac adapter 0.10.1、Isaac Lab 3.0 和 Isaac Sim 6.0 真机运行,发现了以下两个资源:

text
articulations.door:door
robots.arm:arm

两个 track 都在同一个 succeeded operation 和同一个同步控制边界中完成 2/2 帧。 程序正常退出,未遗留 Isaac worker。

常见错误

  • 硬编码原生 joint index:应从 descriptor 读取 axes 和 units。
  • 两个 track 重复占用同一资源:一个 chunk 不允许重叠资源 owner。
  • 把 arm 和 door 分开提交:这不能证明多资源原子 operation。
  • 把门当成机器人:门应放在 articulations.*
  • 假设 provider 在原生 batch 中途拒绝命令后还能 rollback:当前 World SPI 没有 rollback 原语,因此 FastSim 会 fail-closed。

下一步:16 · 选择后端