Python code to interact with Assetto Corsa app AI Driver. This repository largely has two functions:
- Compute optimized racing line by minimizing curvature or lap time
- Take the computed racing line and drive a car within the game Assetto Corsa
Detailed write-up and results visualization are on my blog.
- Install Assetto Corsa (steam)
- Download AI Driver app for Assetto Corsa
- (optional) Download Content Manager
- Select car and track of choice from what's available
- Confirm tires are the default option
- Practice mode with ideal conditions
- (optional) If the track you want is not available, get AI Line Helper
- Use the “Track Left” button to map the left boundary
- Rename side_l.csv in the game installation directory to left.csv
- Use the “Track Left” button to map the right boundary
- Rename side_l.csv in the game installation directory to right.csv
- Copy into the content/tracks/track_name folder under the AC Self Driving repo below
- (optional) If the car you want is not available (YouTube instructions)
- Open Content Manager and go to the About section
- Click "Version" multiple times to enable developer mode
- Go to Content -> Cars and select the car you want
- Click "Unpack data" in the bottom row
- Copy into the content/cars/car_name folder under the AC Self Driving repo below
- Download the AC Self Driving repo
- pip install -r requirements.txt
- Run main.py
- Communicate with AI Driver app over local socket.
- Helper functions to
- Load arbitrary track boundary waypoints and split waypoints every 10 meters
- Read car details such as mass and tire coefficient of friction
- Tire coefficient of friction is for the default tire
- Calculate car engine mapping (speed -> force applied to ground) across full forward gear range
- Updated velocity calculation to account for change in slope on track (3D)
- Navigate out of pit lane
- Brake modulation to account for loss of total grip available due to load transfer
- Allow for loading of previously computed optimal lines in the optimization process
This repository is based on https://github.com/joedavison17/dissertation