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.
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.
uv syncfrom track_generator import TrackGenerator
from utils import Mode, SimType
# Configure track generation
track_gen = TrackGenerator(
n_points=60, # Voronoi points
n_regions=20, # Regions to select
min_bound=0., # Minimum x/y bound
max_bound=150., # Maximum x/y bound
mode=Mode.EXTEND, # Selection mode
plot_track=True,
visualise_voronoi=True,
create_output_file=True,
output_location='/',
sim_type=SimType.FSSIM
)
track_gen.create_track()Mode.EXPAND- Selects nearest neighbors for roundish tracksMode.EXTEND- Selects regions along a random line for elongated tracksMode.RANDOM- Randomly selects regions for large, irregular tracks
SimType.FSSIM- Exports YAML format for FSSIMSimType.FSDS- Exports CSV format for FSDSSimType.GPX- Exports GPX format with lat/lon coordinates
uv run python main.pyEdit parameters directly in main.py or use the TrackGenerator class in your own scripts.
All generation parameters can be configured through the TrackGenerator constructor. Key parameters include Voronoi diagram bounds, region selection count, track constraints (width, cone spacing, curvature), and output options.
Note: Not all parameter combinations produce stable results. Experiment with settings if generation fails.
Based on Ian Hudson's Race-Track-Generator.


