Roboracer track generation and racing line optimization pipeline.
Generate procedurally-varied closed-loop race tracks with optimized racing lines for 1/10 scale autonomous cars in the 8 m × 22 m Roboracer arena.
# Clone and install
git clone <repo-url> && cd trackgen
uv pip install -e .
# Run the Streamlit demo
streamlit run apps/demo_algorithms.py
# Or the full pipeline app
streamlit run apps/full_pipeline.py
# Or the CLI
python -m src.main --seed 42 --track_length_m 60.0Config → Centerline Preset → Spline + Scale → Boundaries → CSV Export → INI → Raceline Optimizer
Probabilistic parameters via distparser distribution strings (e.g., "uniform(60, 90)").
CLI overrides, YAML config files, Streamlit UI — all supported.
| Generator | Style | Key Parameter |
|---|---|---|
StadiumGenerator |
Rounded rectangle | width, straight height |
MooreCurveGenerator |
Closed Hilbert curve | order (2–4) |
HexSnakeGenerator |
Hex grid snake | spacing |
PoissonTSPGenerator |
Poisson disk + TSP | point separation |
PolarGrowthGenerator |
Angle walk + Bezier | max curvature |
ConvexHullGenerator |
Hull + displacement | num points |
FigureEightGenerator |
Lemniscate | amplitude, stretch |
CloverleafGenerator |
Rose curve | radius |
BufferOffset— Shapely polygon buffer (robust, default)NormalOffset— tangent/normal with fillet joins
Vendored Raceline-Optimization library
called via conda run subprocess. Generates f110.ini from config, runs IPOPT solver,
extracts optimized racing line.
trackgen/
├── src/
│ ├── config/ # Config schema, loader, saver
│ ├── geometry/ # Track generation
│ │ ├── strategies/ # 8 centerline + 2 boundary generators
│ │ ├── pipeline.py # Rejection-sampling orchestrator
│ │ └── types.py # TrackGeometry dataclass
│ ├── export.py # CSV + metadata export
│ ├── ini.py # f110.ini generation
│ ├── raceline.py # Optimizer subprocess bridge
│ └── main.py # CLI entry point
├── apps/
│ ├── full_pipeline.py # Production Streamlit app
│ ├── demo_geometry.py # Step-by-step stadium demo
│ └── demo_algorithms.py# 9-tab algorithm comparison
├── tests/
├── notebooks/
├── config/ # Default YAMLs, INI templates, mapping
├── vendor/ # Raceline-Optimization submodule
└── research/ # Algorithm research reports & prompts
uv pip install -e ".[dev]"
uv run ruff check src/ tests/ apps/
uv run pytest tests/ -q- Python ≥ 3.12
- numpy, scipy, shapely — geometry
- pydantic — config validation
- distparser — probabilistic parameter parsing
- streamlit — UI apps
- matplotlib — visualization
- pyyaml — config I/O
- Conda environment with
casadi,trajectory_planning_helpers
MIT