# med-air/surrol architecture

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

- Interactive diagram: https://gitdiagram.com/med-air/surrol
- Repository: https://github.com/med-air/surrol

## Overview

This repository is a surgical embodied-intelligence research platform spanning SurRoL task simulation, VPPV training and deployment, haptic guidance, and data-driven scene simulation. The main VPPV workflow generates task data, trains a perceptual state regressor, learns a policy in simulation, then deploys task autonomy through dVRK or Sentire. README statements support the broad workflow and product capabilities; sampled source also shows scene simulation wiring and MPM task use. Several subsystem implementations were not sampled, so their internal links are omitted rather than inferred.

Main entry points: [`VPPV/Training/policy_learning/rl`](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Training/policy_learning/rl) (Policy Learning), [`Haptic_guidance/surrol/tasks`](https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/tasks) (Task Environments), [`VPPV/Deployment/Sentire`](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/Sentire) (Sentire System), [`Haptic_guidance/surrol/gym`](https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/gym) (Gym API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sim["Surgical Simulation"]
  node_gym["Gym API"]
  node_tasks["Task Environments"]
  node_robots["Surgical Robots"]
  node_physics["PyBullet Physics<br/>[pybullet_utils.py]"]
end

subgraph group_train["VPPV Training"]
  node_data_gen["Data Generation"]
  node_regressor["State Regression"]
  node_policy["Policy Learning"]
  node_rl_agents["RL Agents"]
end

subgraph group_deploy["VPPV Deployment"]
  node_dvrk_deploy["dVRK Deployment"]
  node_sentire["Sentire System"]
  node_fastsam["FastSAM Vision"]
  node_stereo["Stereo Vision"]
  node_tracking["Point Tracking"]
end

subgraph group_haptic["Haptic Guidance"]
  node_haptic_env["Haptic Tasks"]
  node_haptic_gui["Interactive Renderer<br/>[application.py]"]
  node_haptic_robot["Robot Control"]
end

subgraph group_scene["Scene Reconstruction"]
  node_gaussian["Gaussian Model<br/>[gaussian_model.py]"]
  node_renderer["Gaussian Renderer<br/>[__init__.py]"]
  node_reconstruct["Reconstruction"]
  node_mpm_task["MPM Tasks<br/>[psm_env_mpm.py]"]
  node_mpm_solver["MPM Solver<br/>[mpm3d.py]"]
end

node_user(("Task User"))
node_human(("Human Operator"))
node_scene_sim_user(("Simulation User"))

node_user -->|"selects task"| node_gym
node_gym -->|"exposes environments"| node_tasks
node_tasks -->|"uses robots"| node_robots
node_tasks -->|"uses physics"| node_physics
node_data_gen -->|"generates training data"| node_regressor
node_regressor -->|"provides perception"| node_policy
node_policy -.->|"trains with"| node_rl_agents
node_policy -->|"trains in simulation"| node_gym
node_policy -.->|"deploys policies"| node_dvrk_deploy
node_policy -.->|"deploys policies"| node_sentire
node_dvrk_deploy -.->|"uses vision"| node_fastsam
node_sentire -.->|"uses vision"| node_stereo
node_sentire -.->|"uses tracking"| node_tracking
node_human -->|"interacts with"| node_haptic_env
node_haptic_env -.->|"controls"| node_haptic_robot
node_haptic_gui -->|"renders"| node_haptic_env
node_scene_sim_user -->|"runs reconstruction"| node_reconstruct
node_reconstruct -.->|"builds model"| node_gaussian
node_gaussian -->|"renders scene"| node_renderer
node_scene_sim_user -->|"runs simulation"| node_mpm_task
node_mpm_task -->|"uses solver"| node_mpm_solver

click node_gym "https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/gym"
click node_tasks "https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/tasks"
click node_robots "https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/robots"
click node_physics "https://github.com/med-air/surrol/blob/SR-VPPV/Haptic_guidance/surrol/utils/pybullet_utils.py"
click node_data_gen "https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Training/data_generation/surrol/data"
click node_regressor "https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Training/state_regress"
click node_policy "https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Training/policy_learning/rl"
click node_rl_agents "https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Training/policy_learning/rl/agents"
click node_dvrk_deploy "https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/dvrk"
click node_sentire "https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/Sentire"
click node_fastsam "https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/dvrk/FastSAM/fastsam"
click node_stereo "https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/dvrk/IGEV/core"
click node_tracking "https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/Sentire/co-tracker/cotracker"
click node_haptic_env "https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/tasks"
click node_haptic_gui "https://github.com/med-air/surrol/blob/SR-VPPV/Haptic_guidance/surrol/gui/application.py"
click node_haptic_robot "https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/robots"
click node_gaussian "https://github.com/med-air/surrol/blob/SR-VPPV/Data_driven_scene_simulation/gs/scene/gaussian_model.py"
click node_renderer "https://github.com/med-air/surrol/blob/SR-VPPV/Data_driven_scene_simulation/gs/gaussian_renderer/__init__.py"
click node_reconstruct "https://github.com/med-air/surrol/tree/SR-VPPV/Data_driven_scene_simulation/reconstruction"
click node_mpm_task "https://github.com/med-air/surrol/blob/SR-VPPV/Data_driven_scene_simulation/surrol/tasks/psm_env_mpm.py"
click node_mpm_solver "https://github.com/med-air/surrol/blob/SR-VPPV/Data_driven_scene_simulation/MPM/mpm3d.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_gym,node_tasks,node_robots,node_physics,node_scene_sim_user toneBlue
class node_data_gen,node_regressor,node_policy,node_rl_agents toneAmber
class node_dvrk_deploy,node_sentire,node_fastsam,node_stereo,node_tracking toneMint
class node_haptic_env,node_haptic_gui,node_haptic_robot,node_user toneRose
class node_gaussian,node_renderer,node_reconstruct,node_mpm_task,node_mpm_solver,node_human toneIndigo
```

## Components

### Surgical Simulation

- [Gym API](https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/gym): `Haptic_guidance/surrol/gym`
- [Task Environments](https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/tasks): `Haptic_guidance/surrol/tasks`
- [Surgical Robots](https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/robots): `Haptic_guidance/surrol/robots`
- [PyBullet Physics](https://github.com/med-air/surrol/blob/SR-VPPV/Haptic_guidance/surrol/utils/pybullet_utils.py): `Haptic_guidance/surrol/utils/pybullet_utils.py`

### VPPV Training

- [Data Generation](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Training/data_generation/surrol/data): `VPPV/Training/data_generation/surrol/data`
- [State Regression](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Training/state_regress): `VPPV/Training/state_regress`
- [Policy Learning](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Training/policy_learning/rl): `VPPV/Training/policy_learning/rl`
- [RL Agents](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Training/policy_learning/rl/agents): `VPPV/Training/policy_learning/rl/agents`

### VPPV Deployment

- [dVRK Deployment](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/dvrk): `VPPV/Deployment/dvrk`
- [Sentire System](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/Sentire): `VPPV/Deployment/Sentire`
- [FastSAM Vision](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/dvrk/FastSAM/fastsam): `VPPV/Deployment/dvrk/FastSAM/fastsam`
- [Stereo Vision](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/dvrk/IGEV/core): `VPPV/Deployment/dvrk/IGEV/core`
- [Point Tracking](https://github.com/med-air/surrol/tree/SR-VPPV/VPPV/Deployment/Sentire/co-tracker/cotracker): `VPPV/Deployment/Sentire/co-tracker/cotracker`

### Haptic Guidance

- [Haptic Tasks](https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/tasks): `Haptic_guidance/surrol/tasks`
- [Interactive Renderer](https://github.com/med-air/surrol/blob/SR-VPPV/Haptic_guidance/surrol/gui/application.py): `Haptic_guidance/surrol/gui/application.py`
- [Robot Control](https://github.com/med-air/surrol/tree/SR-VPPV/Haptic_guidance/surrol/robots): `Haptic_guidance/surrol/robots`

### Scene Reconstruction

- [Gaussian Model](https://github.com/med-air/surrol/blob/SR-VPPV/Data_driven_scene_simulation/gs/scene/gaussian_model.py): `Data_driven_scene_simulation/gs/scene/gaussian_model.py`
- [Gaussian Renderer](https://github.com/med-air/surrol/blob/SR-VPPV/Data_driven_scene_simulation/gs/gaussian_renderer/__init__.py): `Data_driven_scene_simulation/gs/gaussian_renderer/__init__.py`
- [Reconstruction](https://github.com/med-air/surrol/tree/SR-VPPV/Data_driven_scene_simulation/reconstruction): `Data_driven_scene_simulation/reconstruction`
- [MPM Tasks](https://github.com/med-air/surrol/blob/SR-VPPV/Data_driven_scene_simulation/surrol/tasks/psm_env_mpm.py): `Data_driven_scene_simulation/surrol/tasks/psm_env_mpm.py`
- [MPM Solver](https://github.com/med-air/surrol/blob/SR-VPPV/Data_driven_scene_simulation/MPM/mpm3d.py): `Data_driven_scene_simulation/MPM/mpm3d.py`

### Other components

- **Task User**
- **Human Operator**
- **Simulation User**

## Connections

- Task User → Gym API: selects task (evidence: `README.md`)
- Gym API → Task Environments: exposes environments (evidence: `README.md`)
- Task Environments → Surgical Robots: uses robots (evidence: `Haptic_guidance/surrol/tasks/ecm_env.py`)
- Task Environments → PyBullet Physics: uses physics (evidence: `Haptic_guidance/surrol/tasks/ecm_env.py`)
- Data Generation → State Regression: generates training data (evidence: `README.md`)
- State Regression → Policy Learning: provides perception (evidence: `README.md`)
- Policy Learning → RL Agents: trains with
- Policy Learning → Gym API: trains in simulation (evidence: `README.md`)
- Policy Learning → dVRK Deployment: deploys policies (evidence: `README.md`)
- Policy Learning → Sentire System: deploys policies (evidence: `README.md`)
- dVRK Deployment → FastSAM Vision: uses vision (evidence: `VPPV/Deployment/dvrk/FastSAM/Inference.py`)
- Sentire System → Stereo Vision: uses vision
- Sentire System → Point Tracking: uses tracking (evidence: `VPPV/Deployment/Sentire/co-tracker/gradio_demo/app.py`)
- Human Operator → Haptic Tasks: interacts with (evidence: `README.md`)
- Haptic Tasks → Robot Control: controls (evidence: `Haptic_guidance/surrol/tasks/gauze_retrieve_full_dof_test1.py`)
- Interactive Renderer → Haptic Tasks: renders (evidence: `Haptic_guidance/surrol/gui/application.py`)
- Simulation User → Reconstruction: runs reconstruction (evidence: `README.md`)
- Reconstruction → Gaussian Model: builds model
- Gaussian Model → Gaussian Renderer: renders scene (evidence: `Data_driven_scene_simulation/gs/gaussian_renderer/__init__.py`)
- Simulation User → MPM Tasks: runs simulation (evidence: `README.md`)
- MPM Tasks → MPM Solver: uses solver (evidence: `Data_driven_scene_simulation/surrol/tasks/psm_env_mpm.py`)
