Skip to main content

Generate random Formula Student Driverless race tracks.

Project description

Random Track Generator

Python License

Generate random, rules-compliant tracks for Formula Student Driverless competitions. Creates realistic tracks with proper track width, cone spacing, and corner radii using Voronoi diagram-based generation.

Developed by Formula Student Team Delft for use with FSSIM and FSDS.

How It Works

Tracks are generated using bounded Voronoi diagrams from uniformly sampled points. Regions are selected using one of three modes (Expand, Extend, or Random), then interpolated with cubic splines to create smooth, realistic racing lines.

Installation

uv sync

Usage

Generate a random track

from random_track_generator import generate_track

track = generate_track(
    n_points=60,       # Voronoi points
    n_regions=20,      # Regions to select
    min_bound=0.,      # Minimum x/y bound [m]
    max_bound=150.,    # Maximum x/y bound [m]
    mode="extend",     # Generation mode
    seed=42            # Optional: for reproducibility
)

cones_left, cones_right = track.as_tuple()

Generation Modes

  • "expand" - Selects nearest neighbors for roundish tracks
  • "extend" - Selects regions along a random line for elongated tracks
  • "random" - Randomly selects regions for large, irregular tracks

Note: Not all parameter combinations produce stable results. Experiment with settings if generation fails.

Load a preset track

from random_track_generator import load_track

track = load_track("FSG")
cones_left, cones_right = track.as_tuple()

Save to file

track.save("output/", sim_type="fssim")         # YAML for FSSIM
track.save("output/", sim_type="fsds")          # CSV for FSDS
track.save("output/", sim_type="gpx", 
           lat_offset=51.19, lon_offset=5.32)   # GPX with coordinates

Credits

Based on Ian Hudson's Race-Track-Generator.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

random_track_generator-1.0.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

random_track_generator-1.0.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file random_track_generator-1.0.0.tar.gz.

File metadata

File hashes

Hashes for random_track_generator-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e1c6f2df50edcf1ddb5ca5fb1e9a3fc1b18315d6fc6ef9004ab6ece5c91a4a35
MD5 d5b3e1c45fe8b2f8c27237ab9b8208b9
BLAKE2b-256 e9c9378175924dcd6b874ddcfa32780ec5e303e5751d410875e2d7890ba807e7

See more details on using hashes here.

File details

Details for the file random_track_generator-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for random_track_generator-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dd1cc2bf9f80163191809ae98475f0f556392fc54cfe9ca37b10f6d8e7a15c5f
MD5 f50868eba18a93e910eab3874db86e85
BLAKE2b-256 a17b5722bbd7b671e1053b8f3a5465a6e17ede1f9113aeeafa3cb86550c742ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page