Skip to content

Conversation

@xyao-nv
Copy link
Collaborator

@xyao-nv xyao-nv commented Dec 6, 2025

Summary

A POC impl for EnvCfg serialization & deserialization, tested on non-Mimic, non-teleop envs.

High Level Design

  • Serialization: Save the cfg after Arena composition, before gym.register() as Dict to dump into yaml
  • Deserialization: Native load_yaml() from Lab is not usable because we have
  1. Nested dict, containing func/class strings. Need to be converted as callables.
  2. Dynamically added data fields, e.g. events / terminations / scenes
  3. Default data fields are set to MISSING in configclass, which cannot be decoded automatically
  4. Apart from EnvCfgTerms/Groups needed by gym API, we have IsaacLabArenaEnv configclass object

Data Flow Diagram

┌─────────────────┐
│   YAML File     │
└────────┬────────┘
         │
         ↓
┌────────────────────────────────────────────────────────┐
│ load_env_cfg_from_yaml()                               │
│                                                         │
│  1. Register YAML constructors (numpy, slice, etc.)    │
│  2. Load YAML → dict                                   │
│  3. Create base IsaacLabArenaManagerBasedRLEnvCfg      │
└────────┬───────────────────────────────────────────────┘
         │
         ↓
┌────────────────────────────────────────────────────────┐
│ Phase 1: Deserialize Sections                          │
│                                                         │
│  ├─ _create_scene_config(scene_dict)                   │
│  │   → cfg.scene (InteractiveSceneCfg + assets)        │
│  │                                                      │
│  ├─ _create_actions_config(actions_dict)               │
│  │   → cfg.actions (ActionsCfg + terms)                │
│  │                                                      │
│  ├─ _create_observations_config(obs_dict)              │
│  │   → cfg.observations (ObservationCfg + groups)      │
│  │                                                      │
│  ├─ _create_events_config(events_dict)                 │
│  │   → cfg.events (EventsCfg + terms)                  │
│  │                                                      │
│  ├─ _create_dynamic_manager_config(...)                │
│  │   → cfg.rewards, cfg.terminations, etc.             │
│  │                                                      │
│  └─ _reconstruct_metrics_from_yaml(metrics_list)       │
│      → cfg.metrics (List[MetricBase])                  │
└────────┬───────────────────────────────────────────────┘
         │
         ↓
┌────────────────────────────────────────────────────────┐
│ IsaacLabArenaManagerBasedRLEnvCfg                      │
│                                                         │
│  • cfg.scene (all assets merged)                       │
│  • cfg.actions (all action terms merged)               │
│  • cfg.observations (all obs terms merged)             │
│  • cfg.events, cfg.rewards, cfg.terminations, etc.     │
│  • cfg.metrics                                         │
│  • cfg.isaaclab_arena_env = None (not yet built)       │
└────────┬───────────────────────────────────────────────┘
         │
         ↓
┌────────────────────────────────────────────────────────┐
│ Phase 2: Reconstruct Arena Environment                 │
│                                                         │
│  _reconstruct_isaaclab_arena_env(arena_env_dict, cfg)  │
│                                                         │
│  ├─ reconstruct_embodiment(embodiment_dict, cfg)       │
│  │   • Extracts embodiment-specific configs            │
│  │   • Deserializes camera configs (with filtering)    │
│  │   → EmbodimentBase                                  │
│  │                                                      │
│  ├─ reconstruct_scene(scene_dict, cfg)                 │
│  │   • Pass 1: Creates Object, Background assets       │
│  │   • Pass 2: Creates ObjectReference assets          │
│  │   • Extracts scene-specific configs                 │
│  │   → Scene                                           │
│  │                                                      │
│  └─ reconstruct_task(task_dict, cfg)                   │
│      • Extracts task-specific configs                  │
│      → GenericTask                                     │
└────────┬───────────────────────────────────────────────┘
         │
         ↓
┌────────────────────────────────────────────────────────┐
│ cfg.isaaclab_arena_env                                 │
│                                                         │
│  IsaacLabArenaEnvironment(                             │
│    embodiment=EmbodimentBase(...),                     │
│    scene=Scene(assets=[...]),                          │
│    task=GenericTask(...)                               │
│  )                                                      │
└────────────────────────────────────────────────────────┘

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants