# jiangranlv/dywa architecture

> Architecture diagram of the GitHub repository jiangranlv/dywa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jiangranlv/dywa
- Repository: https://github.com/jiangranlv/dywa

## Overview

DyWA is a dynamics-adaptive world-action model for generalizable non-prehensile manipulation. The principal workflow trains a policy in simulated robot-and-object tasks, then evaluates pretrained policies on unseen objects. Simulation supplies observations and actions; wrappers prepare observations, point-cloud encoders and policy networks produce actions, and PPO/RMA training updates and saves policies. Separate branches cover student distillation and mesh/point-cloud transforms. The README documents evaluation but the evaluation script is not in the supplied tree; source-level links are limited to indexed references and documented relationships.

Main entry points: [`dywa/exp/train/train_ppo_arm.py`](https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/train_ppo_arm.py) (PPO training), [`dywa/src/env/env/base.py`](https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/env/base.py) (Arm simulation), [`dywa/exp/train/train_rma.py`](https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/train_rma.py) (RMA training), [`dywa/src/env/push_env.py`](https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/push_env.py) (Push simulation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation"]
  node_sim_env["Arm simulation<br/>[base.py]"]
  node_push_env["Push simulation<br/>[push_env.py]"]
  node_scene["Object scenes"]
  node_robot["Robot control<br/>[franka.py]"]
  node_task["Push tasks<br/>[push_task.py]"]
  node_env_wrappers["Environment wrappers<br/>[base.py]"]
  node_cube_wrappers["Cube wrappers"]
  node_push_wrappers["Push wrappers"]
end

subgraph group_perception["Perception"]
  node_transforms["Geometry transforms"]
  node_point_encoder["Point-cloud encoder<br/>[point_mae.py]"]
  node_model_components["Model components<br/>[common.py]"]
end

subgraph group_learning["Policy learning"]
  node_train_entry["PPO training<br/>[train_ppo_arm.py]"]
  node_state_encoder["State encoder"]
  node_ppo["PPO algorithm<br/>[ppo.py]"]
end

subgraph group_adaptation["Adaptation"]
  node_rma_train["RMA training<br/>[train_rma.py]"]
  node_distill["Student distillation<br/>[distill.py]"]
  node_rma_env["RMA environment<br/>[rma_env.py]"]
end

subgraph group_runtime["Training runtime"]
  node_checkpoint["Checkpoint handling<br/>[ckpt.py]"]
  node_config["Configuration<br/>[config.py]"]
end

node_researcher(("Researcher"))
node_simulator["Isaac Gym"]

node_researcher -->|"configures training"| node_train_entry
node_researcher -->|"starts training"| node_rma_train
node_researcher -->|"installs simulator"| node_simulator
node_train_entry -->|"builds environment"| node_sim_env
node_train_entry -->|"configures encoder"| node_state_encoder
node_train_entry -->|"uses algorithm"| node_ppo
node_train_entry -.->|"saves checkpoints"| node_checkpoint
node_sim_env -->|"uses scene"| node_scene
node_sim_env -->|"uses robot"| node_robot
node_sim_env -->|"uses task"| node_task
node_sim_env -.->|"simulates physics"| node_simulator
node_push_env -->|"selects scenes"| node_scene
node_push_env -->|"selects robots"| node_robot
node_push_env -->|"selects tasks"| node_task
node_env_wrappers -->|"delegates calls"| node_sim_env
node_cube_wrappers -->|"wraps environment"| node_env_wrappers
node_cube_wrappers -->|"uses transforms"| node_transforms
node_push_wrappers -->|"wraps environment"| node_push_env
node_state_encoder -->|"uses layers"| node_model_components
node_point_encoder -->|"uses components"| node_model_components
node_rma_train -->|"uses environment"| node_rma_env
node_rma_train -->|"reuses training"| node_train_entry
node_rma_train -->|"invokes distillation"| node_distill
node_rma_train -->|"uses checkpoints"| node_checkpoint
node_distill -->|"uses encoder"| node_point_encoder
node_distill -->|"loads checkpoints"| node_checkpoint
node_researcher -->|"evaluates pretrained policy"| node_rma_train
node_config -.->|"configures run"| node_train_entry

click node_train_entry "https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/train_ppo_arm.py"
click node_rma_train "https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/train_rma.py"
click node_distill "https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/distill.py"
click node_sim_env "https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/env/base.py"
click node_push_env "https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/push_env.py"
click node_scene "https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/scene/tabletop_with_object_scene.py"
click node_robot "https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/robot/franka.py"
click node_task "https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/task/push_task.py"
click node_env_wrappers "https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/env/wrap/base.py"
click node_cube_wrappers "https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/envs/cube_env_wrappers.py"
click node_push_wrappers "https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/envs/push_env_wrappers.py"
click node_transforms "https://github.com/jiangranlv/dywa/tree/main/dywa/src/data/transforms"
click node_point_encoder "https://github.com/jiangranlv/dywa/blob/main/dywa/src/models/cloud/point_mae.py"
click node_model_components "https://github.com/jiangranlv/dywa/blob/main/dywa/src/models/common.py"
click node_state_encoder "https://github.com/jiangranlv/dywa/blob/main/dywa/src/models/rl/generic_state_encoder.py"
click node_ppo "https://github.com/jiangranlv/dywa/blob/main/dywa/src/models/rl/v6/ppo.py"
click node_rma_env "https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/rma_env.py"
click node_checkpoint "https://github.com/jiangranlv/dywa/blob/main/dywa/src/train/ckpt.py"
click node_config "https://github.com/jiangranlv/dywa/blob/main/dywa/src/util/config.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sim_env,node_push_env,node_scene,node_robot,node_task,node_env_wrappers,node_cube_wrappers,node_push_wrappers toneBlue
class node_transforms,node_point_encoder,node_model_components toneAmber
class node_train_entry,node_state_encoder,node_ppo toneMint
class node_rma_train,node_distill,node_rma_env toneRose
class node_checkpoint,node_config,node_researcher,node_simulator toneIndigo
```

## Components

### Simulation

- [Arm simulation](https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/env/base.py): `dywa/src/env/env/base.py`
- [Push simulation](https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/push_env.py): `dywa/src/env/push_env.py`
- [Object scenes](https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/scene/tabletop_with_object_scene.py): `dywa/src/env/scene/tabletop_with_object_scene.py`
- [Robot control](https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/robot/franka.py): `dywa/src/env/robot/franka.py`
- [Push tasks](https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/task/push_task.py): `dywa/src/env/task/push_task.py`
- [Environment wrappers](https://github.com/jiangranlv/dywa/blob/main/dywa/src/env/env/wrap/base.py): `dywa/src/env/env/wrap/base.py`
- [Cube wrappers](https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/envs/cube_env_wrappers.py): `dywa/exp/train/envs/cube_env_wrappers.py`
- [Push wrappers](https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/envs/push_env_wrappers.py): `dywa/exp/train/envs/push_env_wrappers.py`

### Perception

- [Geometry transforms](https://github.com/jiangranlv/dywa/tree/main/dywa/src/data/transforms): `dywa/src/data/transforms`
- [Point-cloud encoder](https://github.com/jiangranlv/dywa/blob/main/dywa/src/models/cloud/point_mae.py): `dywa/src/models/cloud/point_mae.py`
- [Model components](https://github.com/jiangranlv/dywa/blob/main/dywa/src/models/common.py): `dywa/src/models/common.py`

### Policy learning

- [PPO training](https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/train_ppo_arm.py): `dywa/exp/train/train_ppo_arm.py`
- [State encoder](https://github.com/jiangranlv/dywa/blob/main/dywa/src/models/rl/generic_state_encoder.py): `dywa/src/models/rl/generic_state_encoder.py`
- [PPO algorithm](https://github.com/jiangranlv/dywa/blob/main/dywa/src/models/rl/v6/ppo.py): `dywa/src/models/rl/v6/ppo.py`

### Adaptation

- [RMA training](https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/train_rma.py): `dywa/exp/train/train_rma.py`
- [Student distillation](https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/distill.py): `dywa/exp/train/distill.py`
- [RMA environment](https://github.com/jiangranlv/dywa/blob/main/dywa/exp/train/rma_env.py): `dywa/exp/train/rma_env.py`

### Training runtime

- [Checkpoint handling](https://github.com/jiangranlv/dywa/blob/main/dywa/src/train/ckpt.py): `dywa/src/train/ckpt.py`
- [Configuration](https://github.com/jiangranlv/dywa/blob/main/dywa/src/util/config.py): `dywa/src/util/config.py`

### Other components

- **Researcher**
- **Isaac Gym**

## Connections

- Researcher → PPO training: configures training (evidence: `README.md`)
- Researcher → RMA training: starts training (evidence: `README.md`)
- Researcher → Isaac Gym: installs simulator (evidence: `README.md`)
- PPO training → Arm simulation: builds environment (evidence: `dywa/exp/train/train_ppo_arm.py`)
- PPO training → State encoder: configures encoder (evidence: `dywa/exp/train/train_ppo_arm.py`)
- PPO training → PPO algorithm: uses algorithm (evidence: `dywa/exp/train/train_ppo_arm.py`)
- PPO training → Checkpoint handling: saves checkpoints (evidence: `dywa/exp/train/train_ppo_arm.py`)
- Arm simulation → Object scenes: uses scene (evidence: `dywa/src/env/env/base.py`)
- Arm simulation → Robot control: uses robot (evidence: `dywa/src/env/env/base.py`)
- Arm simulation → Push tasks: uses task (evidence: `dywa/src/env/env/base.py`)
- Arm simulation → Isaac Gym: simulates physics
- Push simulation → Object scenes: selects scenes (evidence: `dywa/src/env/push_env.py`)
- Push simulation → Robot control: selects robots (evidence: `dywa/src/env/push_env.py`)
- Push simulation → Push tasks: selects tasks (evidence: `dywa/src/env/push_env.py`)
- Environment wrappers → Arm simulation: delegates calls (evidence: `dywa/src/env/env/wrap/base.py`)
- Cube wrappers → Environment wrappers: wraps environment (evidence: `dywa/exp/train/envs/cube_env_wrappers.py`)
- Cube wrappers → Geometry transforms: uses transforms (evidence: `dywa/exp/train/envs/cube_env_wrappers.py`)
- Push wrappers → Push simulation: wraps environment (evidence: `dywa/exp/train/envs/push_env_wrappers.py`)
- State encoder → Model components: uses layers (evidence: `dywa/src/models/rl/generic_state_encoder.py`)
- Point-cloud encoder → Model components: uses components (evidence: `dywa/src/models/cloud/point_mae.py`)
- RMA training → RMA environment: uses environment (evidence: `dywa/exp/train/train_rma.py`)
- RMA training → PPO training: reuses training (evidence: `dywa/exp/train/train_rma.py`)
- RMA training → Student distillation: invokes distillation (evidence: `dywa/exp/train/train_rma.py`)
- RMA training → Checkpoint handling: uses checkpoints (evidence: `dywa/exp/train/train_rma.py`)
- Student distillation → Point-cloud encoder: uses encoder (evidence: `dywa/exp/train/distill.py`)
- Student distillation → Checkpoint handling: loads checkpoints (evidence: `dywa/exp/train/distill.py`)
- Researcher → RMA training: evaluates pretrained policy (evidence: `README.md`)
- Configuration → PPO training: configures run (evidence: `dywa/exp/train/train_ppo_arm.py`)
