Skip to content
njuyoung35Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

TrackGen

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.

Quick Start

# 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.0

Pipeline

Config → Centerline Preset → Spline + Scale → Boundaries → CSV Export → INI → Raceline Optimizer

Config

Probabilistic parameters via distparser distribution strings (e.g., "uniform(60, 90)"). CLI overrides, YAML config files, Streamlit UI — all supported.

Centerline Presets (8 strategies)

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

Boundary Generation

  • BufferOffset — Shapely polygon buffer (robust, default)
  • NormalOffset — tangent/normal with fillet joins

Raceline Optimization

Vendored Raceline-Optimization library called via conda run subprocess. Generates f110.ini from config, runs IPOPT solver, extracts optimized racing line.

Project Structure

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

Development

uv pip install -e ".[dev]"
uv run ruff check src/ tests/ apps/
uv run pytest tests/ -q

Dependencies

  • Python ≥ 3.12
  • numpy, scipy, shapely — geometry
  • pydantic — config validation
  • distparser — probabilistic parameter parsing
  • streamlit — UI apps
  • matplotlib — visualization
  • pyyaml — config I/O

Raceline Optimizer (optional)

  • Conda environment with casadi, trajectory_planning_helpers

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages