# rhoban/frasa architecture

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

- Interactive diagram: https://gitdiagram.com/rhoban/frasa
- Repository: https://github.com/rhoban/frasa

## Overview

FRASA is a reinforcement-learning environment and training setup for teaching a Sigmaban humanoid to recover and stand from prone or supine falls. The main path registers the Gymnasium environment, runs the stand-up task on MuJoCo, and lets RL training learn a recovery policy; a separate runner loads trained agents for demonstration. Initial-state generation and direct environment testing support this workflow. The source excerpts establish the environment-to-simulator connection; training, evaluation, and configuration links are based on README descriptions where runner internals were not sampled.

Main entry points: [`frasa_env/__init__.py`](https://github.com/rhoban/frasa/blob/main/frasa_env/__init__.py) (Gym registration), [`train_sbx.py`](https://github.com/rhoban/frasa/blob/main/train_sbx.py) (Training runner), [`frasa_env/env/standup_env.py`](https://github.com/rhoban/frasa/blob/main/frasa_env/env/standup_env.py) (Stand-up task), [`enjoy_sbx.py`](https://github.com/rhoban/frasa/blob/main/enjoy_sbx.py) (Agent runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["RL workflow"]
  node_train["Training runner<br/>[train_sbx.py]"]
  node_configs["Algorithm configs"]
  node_agent["RL algorithms"]
  node_enjoy["Agent runner<br/>[enjoy_sbx.py]"]
end

subgraph group_task["Stand-up task"]
  node_registered["Gym registration<br/>[__init__.py]"]
  node_frasa["FRASA defaults<br/>[standup.py]"]
  node_standup["Stand-up task<br/>[standup_env.py]"]
end

subgraph group_simulation["Simulation model"]
  node_sim["MuJoCo simulator<br/>[simulator.py]"]
  node_robotmodel["Sigmaban model"]
end

subgraph group_support["Task support"]
  node_initial["Initial-state generator"]
  node_test["Environment tester<br/>[test_env.py]"]
  node_states["Fall-state cache<br/>[standup_env.py]"]
end

node_user(("Researcher"))

node_user -->|"starts training"| node_train
node_train -->|"loads parameters"| node_configs
node_train -->|"trains policy"| node_agent
node_train -->|"trains environment"| node_registered
node_user -->|"runs agent"| node_enjoy
node_enjoy -->|"loads environment"| node_registered
node_registered -->|"registers entry point"| node_frasa
node_frasa -->|"inherits task"| node_standup
node_standup -->|"steps simulation"| node_sim
node_sim -->|"loads scene"| node_robotmodel
node_user -->|"generates fall states"| node_initial
node_initial -->|"creates environment"| node_registered
node_standup -->|"loads cached states"| node_states
node_user -->|"tests environment"| node_test
node_test -.->|"tests environment"| node_registered

click node_train "https://github.com/rhoban/frasa/blob/main/train_sbx.py"
click node_configs "https://github.com/rhoban/frasa/tree/main/hyperparams"
click node_enjoy "https://github.com/rhoban/frasa/blob/main/enjoy_sbx.py"
click node_registered "https://github.com/rhoban/frasa/blob/main/frasa_env/__init__.py"
click node_frasa "https://github.com/rhoban/frasa/blob/main/frasa_env/env/standup.py"
click node_standup "https://github.com/rhoban/frasa/blob/main/frasa_env/env/standup_env.py"
click node_sim "https://github.com/rhoban/frasa/blob/main/frasa_env/mujoco_simulator/simulator.py"
click node_robotmodel "https://github.com/rhoban/frasa/tree/main/frasa_env/mujoco_simulator/model"
click node_initial "https://github.com/rhoban/frasa/blob/main/standup_generate_initial.py"
click node_test "https://github.com/rhoban/frasa/blob/main/test_env.py"
click node_states "https://github.com/rhoban/frasa/blob/main/frasa_env/env/standup_env.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_train,node_configs,node_agent,node_enjoy toneBlue
class node_registered,node_frasa,node_standup toneAmber
class node_sim,node_robotmodel toneMint
class node_initial,node_test,node_states toneRose
class node_user toneIndigo
```

## Components

### RL workflow

- [Training runner](https://github.com/rhoban/frasa/blob/main/train_sbx.py): `train_sbx.py`
- [Algorithm configs](https://github.com/rhoban/frasa/tree/main/hyperparams): `hyperparams`
- **RL algorithms**
- [Agent runner](https://github.com/rhoban/frasa/blob/main/enjoy_sbx.py): `enjoy_sbx.py`

### Stand-up task

- [Gym registration](https://github.com/rhoban/frasa/blob/main/frasa_env/__init__.py): `frasa_env/__init__.py`
- [FRASA defaults](https://github.com/rhoban/frasa/blob/main/frasa_env/env/standup.py): `frasa_env/env/standup.py`
- [Stand-up task](https://github.com/rhoban/frasa/blob/main/frasa_env/env/standup_env.py): `frasa_env/env/standup_env.py`

### Simulation model

- [MuJoCo simulator](https://github.com/rhoban/frasa/blob/main/frasa_env/mujoco_simulator/simulator.py): `frasa_env/mujoco_simulator/simulator.py`
- [Sigmaban model](https://github.com/rhoban/frasa/tree/main/frasa_env/mujoco_simulator/model): `frasa_env/mujoco_simulator/model`

### Task support

- [Initial-state generator](https://github.com/rhoban/frasa/blob/main/standup_generate_initial.py): `standup_generate_initial.py`
- [Environment tester](https://github.com/rhoban/frasa/blob/main/test_env.py): `test_env.py`
- [Fall-state cache](https://github.com/rhoban/frasa/blob/main/frasa_env/env/standup_env.py): `frasa_env/env/standup_env.py`

### Other components

- **Researcher**

## Connections

- Researcher → Training runner: starts training (evidence: `README.md`)
- Training runner → Algorithm configs: loads parameters (evidence: `README.md`)
- Training runner → RL algorithms: trains policy (evidence: `README.md`)
- Training runner → Gym registration: trains environment (evidence: `README.md`)
- Researcher → Agent runner: runs agent (evidence: `README.md`)
- Agent runner → Gym registration: loads environment (evidence: `README.md`)
- Gym registration → FRASA defaults: registers entry point (evidence: `frasa_env/__init__.py`)
- FRASA defaults → Stand-up task: inherits task (evidence: `frasa_env/env/standup.py`)
- Stand-up task → MuJoCo simulator: steps simulation (evidence: `frasa_env/env/standup_env.py`)
- MuJoCo simulator → Sigmaban model: loads scene (evidence: `frasa_env/mujoco_simulator/simulator.py`)
- Researcher → Initial-state generator: generates fall states (evidence: `README.md`)
- Initial-state generator → Gym registration: creates environment (evidence: `standup_generate_initial.py`)
- Stand-up task → Fall-state cache: loads cached states (evidence: `frasa_env/env/standup_env.py`)
- Researcher → Environment tester: tests environment (evidence: `README.md`)
- Environment tester → Gym registration: tests environment
