# silverwingsbot/easycarla-rl architecture

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

- Interactive diagram: https://gitdiagram.com/silverwingsbot/easycarla-rl
- Repository: https://github.com/silverwingsbot/easycarla-rl

## Overview

EasyCarla-RL is a Gym-compatible CARLA environment for autonomous-driving reinforcement learning. Its main workflow configures and resets a simulated episode, accepts vehicle actions, and returns observations, reward, safety cost, and termination information. The repository also includes a demo, an advanced pretrained-agent evaluation example, and documentation for an offline dataset. The environment excerpt supports the lifecycle, sensing, and cost components shown; agent internals and dataset-generation code were not sampled, so those branches are limited to documented relationships.

Main entry points: [`easycarla/envs/carla_env.py`](https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/envs/carla_env.py) (CarlaEnv API), [`example/run_dql_in_carla.py`](https://github.com/silverwingsbot/easycarla-rl/blob/main/example/run_dql_in_carla.py) (DQL Evaluation), [`easycarla/__init__.py`](https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/__init__.py) (Gym Registration), [`easycarla_demo.py`](https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla_demo.py) (Quick Demo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_environment["Gym Environment"]
  node_registration["Gym Registration<br/>[__init__.py]"]
  node_env["CarlaEnv API<br/>[carla_env.py]"]
  node_demo["Quick Demo<br/>[easycarla_demo.py]"]
end

subgraph group_simulation["CARLA Simulation"]
  node_world["Episode World<br/>[carla_env.py]"]
  node_sensors["Observation Sensing<br/>[carla_env.py]"]
  node_signals["Reward and Cost<br/>[carla_env.py]"]
end

subgraph group_learning["RL Examples"]
  node_eval["DQL Evaluation"]
  node_agents["RL Agents"]
  node_checkpoints["Model Checkpoints"]
end

subgraph group_offline["Offline Data"]
  node_dataset[("Offline Dataset")]
end

node_user(("Researcher"))
node_carla["CARLA Server"]
node_dataset_host["Dataset Download"]

node_user -->|"runs demo"| node_demo
node_demo -->|"imports package"| node_registration
node_registration -->|"registers entry point"| node_env
node_env -->|"resets and ticks"| node_world
node_env -->|"returns observations"| node_sensors
node_env -->|"returns reward and cost"| node_signals
node_env -->|"controls simulation"| node_carla
node_user -->|"runs evaluation"| node_eval
node_eval -->|"loads agent"| node_agents
node_eval -->|"loads checkpoint"| node_checkpoints
node_eval -->|"evaluates in"| node_env
node_dataset_host -->|"provides download"| node_dataset
node_dataset -->|"trains or evaluates"| node_user

click node_registration "https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/__init__.py"
click node_env "https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/envs/carla_env.py"
click node_world "https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/envs/carla_env.py"
click node_sensors "https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/envs/carla_env.py"
click node_signals "https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/envs/carla_env.py"
click node_demo "https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla_demo.py"
click node_eval "https://github.com/silverwingsbot/easycarla-rl/blob/main/example/run_dql_in_carla.py"
click node_agents "https://github.com/silverwingsbot/easycarla-rl/tree/main/example/agents"
click node_checkpoints "https://github.com/silverwingsbot/easycarla-rl/tree/main/example/params_dql"

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_registration,node_env,node_demo toneBlue
class node_world,node_sensors,node_signals toneAmber
class node_eval,node_agents,node_checkpoints,node_carla toneMint
class node_dataset toneRose
class node_user,node_dataset_host toneIndigo
```

## Components

### Gym Environment

- [Gym Registration](https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/__init__.py): `easycarla/__init__.py`
- [CarlaEnv API](https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/envs/carla_env.py): `easycarla/envs/carla_env.py`
- [Quick Demo](https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla_demo.py): `easycarla_demo.py`

### CARLA Simulation

- [Episode World](https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/envs/carla_env.py): `easycarla/envs/carla_env.py`
- [Observation Sensing](https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/envs/carla_env.py): `easycarla/envs/carla_env.py`
- [Reward and Cost](https://github.com/silverwingsbot/easycarla-rl/blob/main/easycarla/envs/carla_env.py): `easycarla/envs/carla_env.py`

### RL Examples

- [DQL Evaluation](https://github.com/silverwingsbot/easycarla-rl/blob/main/example/run_dql_in_carla.py): `example/run_dql_in_carla.py`
- [RL Agents](https://github.com/silverwingsbot/easycarla-rl/tree/main/example/agents): `example/agents`
- [Model Checkpoints](https://github.com/silverwingsbot/easycarla-rl/tree/main/example/params_dql): `example/params_dql`

### Offline Data

- **Offline Dataset**

### Other components

- **Researcher**
- **CARLA Server**
- **Dataset Download**

## Connections

- Researcher → Quick Demo: runs demo (evidence: `README.md`)
- Quick Demo → Gym Registration: imports package (evidence: `easycarla_demo.py`)
- Gym Registration → CarlaEnv API: registers entry point (evidence: `easycarla/__init__.py`)
- CarlaEnv API → Episode World: resets and ticks (evidence: `easycarla/envs/carla_env.py`)
- CarlaEnv API → Observation Sensing: returns observations (evidence: `easycarla/envs/carla_env.py`)
- CarlaEnv API → Reward and Cost: returns reward and cost (evidence: `README.md`)
- CarlaEnv API → CARLA Server: controls simulation (evidence: `README.md`)
- Researcher → DQL Evaluation: runs evaluation (evidence: `README.md`)
- DQL Evaluation → RL Agents: loads agent (evidence: `README.md`)
- DQL Evaluation → Model Checkpoints: loads checkpoint (evidence: `README.md`)
- DQL Evaluation → CarlaEnv API: evaluates in (evidence: `README.md`)
- Dataset Download → Offline Dataset: provides download (evidence: `README.md`)
- Offline Dataset → Researcher: trains or evaluates (evidence: `README.md`)
