# leggedrobotics/pace-sim2real architecture

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

- Interactive diagram: https://gitdiagram.com/leggedrobotics/pace-sim2real
- Repository: https://github.com/leggedrobotics/pace-sim2real

## Overview

PACE is an Isaac Lab sim-to-real framework: collect excitation data, fit physical actuator/joint parameters with CMA-ES, then use the adapted models and task configurations for simulation and locomotion evaluation. The graph includes the documented data-to-fitting workflow and the sampled environment, actuator, optimizer, and RL play components. Training and plotting are documented by the tree/README but their internal relationships are not expanded beyond indexed references.

Main entry points: [`scripts/pace/fit.py`](https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/pace/fit.py) (Parameter fitting), [`scripts/rsl_rl/train.py`](https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/rsl_rl/train.py) (RL training), [`scripts/rsl_rl/play.py`](https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/rsl_rl/play.py) (Policy evaluation), [`source/pace_sim2real/pace_sim2real/optim/cma_es.py`](https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/optim/cma_es.py) (CMA-ES optimizer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identification["System identification"]
  node_data_collection["Excitation collection<br/>[data_collection.py]"]
  node_measured_data["Excitation data"]
  node_fit["Parameter fitting<br/>[fit.py]"]
  node_optimizer["CMA-ES optimizer<br/>[cma_es.py]"]
  node_fitted_parameters["Fitted parameters"]
end

subgraph group_simulation["Simulation model"]
  node_environment["PACE environment"]
  node_anymal_config["ANYmal configuration"]
  node_rewards["MDP rewards<br/>[rewards.py]"]
  node_actuator_config["Actuator configuration"]
  node_actuator["Delayed DC motor<br/>[pace_actuator.py]"]
end

subgraph group_locomotion["Locomotion workflows"]
  node_training["RL training<br/>[train.py]"]
  node_agent_config["PPO agent config<br/>[rsl_rl_ppo_cfg.py]"]
  node_cli_args["RL CLI options<br/>[cli_args.py]"]
  node_play["Policy evaluation<br/>[play.py]"]
  node_trajectory_plot["Trajectory plotting<br/>[plot_trajectory.py]"]
end

subgraph group_support["Package support"]
  node_root_paths["Project root lookup<br/>[paths.py]"]
  node_env_registration["Environment registration<br/>[__init__.py]"]
end

node_operator(("Engineer"))

node_operator -->|"runs collection"| node_data_collection
node_data_collection -->|"stores data"| node_measured_data
node_operator -->|"runs fitting"| node_fit
node_fit -->|"loads data"| node_measured_data
node_fit -->|"configures optimizer"| node_optimizer
node_optimizer -->|"writes results"| node_fitted_parameters
node_optimizer -->|"updates simulation"| node_environment
node_anymal_config -->|"specializes task"| node_environment
node_environment -->|"configures reward"| node_rewards
node_anymal_config -->|"configures actuator"| node_actuator_config
node_actuator_config -->|"selects implementation"| node_actuator
node_training -->|"uses options"| node_cli_args
node_training -->|"imports tasks"| node_env_registration
node_play -->|"uses options"| node_cli_args
node_play -->|"imports tasks"| node_env_registration
node_training -.->|"loads agent config"| node_agent_config
node_play --> node_trajectory_plot
node_fit --> node_root_paths

click node_data_collection "https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/pace/data_collection.py"
click node_fit "https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/pace/fit.py"
click node_optimizer "https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/optim/cma_es.py"
click node_environment "https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/pace_sim2real_env_cfg.py"
click node_anymal_config "https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/anymal_pace_env_cfg.py"
click node_rewards "https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/mdp/rewards.py"
click node_actuator_config "https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/utils/pace_actuator_cfg.py"
click node_actuator "https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/utils/pace_actuator.py"
click node_training "https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/rsl_rl/train.py"
click node_agent_config "https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/agents/rsl_rl_ppo_cfg.py"
click node_cli_args "https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/rsl_rl/cli_args.py"
click node_play "https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/rsl_rl/play.py"
click node_trajectory_plot "https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/pace/plot_trajectory.py"
click node_root_paths "https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/utils/paths.py"
click node_env_registration "https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/tasks/__init__.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_data_collection,node_measured_data,node_fit,node_optimizer,node_fitted_parameters toneBlue
class node_environment,node_anymal_config,node_rewards,node_actuator_config,node_actuator toneAmber
class node_training,node_agent_config,node_cli_args,node_play,node_trajectory_plot toneMint
class node_root_paths,node_env_registration toneRose
class node_operator toneIndigo
```

## Components

### System identification

- [Excitation collection](https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/pace/data_collection.py): `scripts/pace/data_collection.py`
- **Excitation data**
- [Parameter fitting](https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/pace/fit.py): `scripts/pace/fit.py`
- [CMA-ES optimizer](https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/optim/cma_es.py): `source/pace_sim2real/pace_sim2real/optim/cma_es.py`
- **Fitted parameters**

### Simulation model

- [PACE environment](https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/pace_sim2real_env_cfg.py): `source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/pace_sim2real_env_cfg.py`
- [ANYmal configuration](https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/anymal_pace_env_cfg.py): `source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/anymal_pace_env_cfg.py`
- [MDP rewards](https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/mdp/rewards.py): `source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/mdp/rewards.py`
- [Actuator configuration](https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/utils/pace_actuator_cfg.py): `source/pace_sim2real/pace_sim2real/utils/pace_actuator_cfg.py`
- [Delayed DC motor](https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/utils/pace_actuator.py): `source/pace_sim2real/pace_sim2real/utils/pace_actuator.py`

### Locomotion workflows

- [RL training](https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/rsl_rl/train.py): `scripts/rsl_rl/train.py`
- [PPO agent config](https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/agents/rsl_rl_ppo_cfg.py): `source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/agents/rsl_rl_ppo_cfg.py`
- [RL CLI options](https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/rsl_rl/cli_args.py): `scripts/rsl_rl/cli_args.py`
- [Policy evaluation](https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/rsl_rl/play.py): `scripts/rsl_rl/play.py`
- [Trajectory plotting](https://github.com/leggedrobotics/pace-sim2real/blob/main/scripts/pace/plot_trajectory.py): `scripts/pace/plot_trajectory.py`

### Package support

- [Project root lookup](https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/utils/paths.py): `source/pace_sim2real/pace_sim2real/utils/paths.py`
- [Environment registration](https://github.com/leggedrobotics/pace-sim2real/blob/main/source/pace_sim2real/pace_sim2real/tasks/__init__.py): `source/pace_sim2real/pace_sim2real/tasks/__init__.py`

### Other components

- **Engineer**

## Connections

- Engineer → Excitation collection: runs collection (evidence: `README.md`)
- Excitation collection → Excitation data: stores data (evidence: `README.md`)
- Engineer → Parameter fitting: runs fitting (evidence: `README.md`)
- Parameter fitting → Excitation data: loads data (evidence: `scripts/pace/fit.py`)
- Parameter fitting → CMA-ES optimizer: configures optimizer (evidence: `scripts/pace/fit.py`)
- CMA-ES optimizer → Fitted parameters: writes results (evidence: `README.md`)
- CMA-ES optimizer → PACE environment: updates simulation (evidence: `source/pace_sim2real/pace_sim2real/optim/cma_es.py`)
- ANYmal configuration → PACE environment: specializes task (evidence: `source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/anymal_pace_env_cfg.py`)
- PACE environment → MDP rewards: configures reward (evidence: `source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/pace_sim2real_env_cfg.py`)
- ANYmal configuration → Actuator configuration: configures actuator (evidence: `source/pace_sim2real/pace_sim2real/tasks/manager_based/pace/anymal_pace_env_cfg.py`)
- Actuator configuration → Delayed DC motor: selects implementation (evidence: `source/pace_sim2real/pace_sim2real/utils/pace_actuator_cfg.py`)
- RL training → RL CLI options: uses options (evidence: `scripts/rsl_rl/train.py`)
- RL training → Environment registration: imports tasks (evidence: `scripts/rsl_rl/train.py`)
- Policy evaluation → RL CLI options: uses options (evidence: `scripts/rsl_rl/play.py`)
- Policy evaluation → Environment registration: imports tasks (evidence: `scripts/rsl_rl/play.py`)
- RL training → PPO agent config: loads agent config
- Policy evaluation → Trajectory plotting
- Parameter fitting → Project root lookup
