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

pip install random-track-generator

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.1.tar.gz (16.5 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.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for random_track_generator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fe0bb025b46004c2456fcc3701ffbce723d815c98357286b0edba75f921f2e65
MD5 5f40e3bbde4a1fe2e4d0c3858ed70746
BLAKE2b-256 c3ae74e1f3514d1d12d657ba2474beefca7a04ef25bffd35c0ebb5c7133eaaa8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for random_track_generator-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 429422cf75c60e592bd9b7fc1a82cb4fbf48dcc1c68b1505614ab4ee2be8a24f
MD5 c343f2ad9697b18f6f3f03acaae12fab
BLAKE2b-256 c3fb335567fef43afb11fe2a15632df716f4b992269867694eaf27e4c352f4e0

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