Skip to content

Script that generates random tracks that adhere to the rules set by FSG for the Formula Student Driverless competitions.

License

Notifications You must be signed in to change notification settings

mvanlobensels/random-track-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Random Track Generator

Generate random tracks of different shapes and sizes that adhere to the Formula Student Rules for the Formula Student Driverless competitions in terms of track width, cone spacing and corner radius. This script was developed by Formula Student Team Delft, used for an FSSIM based simulator or the Formula Student Driverless Simulator.

Description

The tracks are generated using a bounded Voronoi diagram, which is created from a uniformly sampled set of points. From this Voronoi diagram, regions are selected based on one of three selection modes. By interpolating the selected region's vertices using a cubic spline, a track is generated.

Input parameters

  • n_points: Number of points to generate a Voronoi diagram from.
  • n_regions: Number of Voronoi regions (cells) to select.
  • min_bound: Minimum x and y bound of Voronoi diagram.
  • max_bound: Maximum x and y bound of Voronoi diagram.
  • mode: Method used to select Voronoi regions.
    1. Expand: Find the n closest neighbours to the first randomly selected region.
    2. Extend: Select a region randomly. Draw a line with random orientation and find the closest n regions to this line.
    3. Random: Select n regions randomly.

Please note that not all settings result in stable behaviour, and a track might not be found for your selected settings.

Track parameters

  • track_width: Track width in meters.
  • cone_spacing: Cone spacing in meters.
  • length_start_area: Length of the start area in meters.
  • curvature_threshold: Maximum curvature (minimum radius of curvature) threshold in 1/meters.
  • straight_threshold: Minimum curvature threshold for the starting area in 1/meters.

Output options

  • plot_track: Plot the resulting track.
  • visualise_voronoi: Visualise the Voronoi diagram and selected regions.
  • create_output_file: Create yaml output track file.
  • output_location: Location to output track file.
  • sim_type: Selection between output format for different simulators

Requirements

  • python >= 3.7.8
  • numpy >= 1.18.5
  • scipy >= 1.4.1
  • matplotlib >= 3.1.3
  • shapely >= 1.7.1
  • yaml >= 0.2.5

Install

pip3 install -r requirements.txt

Run

python3 main.py

Credits

This method is based on Ian Hudson's Race-Track-Generator.

About

Script that generates random tracks that adhere to the rules set by FSG for the Formula Student Driverless competitions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages