The online racing simulator
I Trained a Neural Network to Drive Formula Student Tracks in LFS
Hey everyone,

Recently, I was involved in a research project involving autonomous driving at my uni. My task was to develop a vehicle control algorithm. I decided to use LFS as the basis for my testing, and now that the project is done, I thought the people in this forum might be interested.

My idea for the project was to use a neural network and train it on my driving data to get it to drive around Formula Student tracks. In case you aren’t aware, Formula Student has had a driverless category since 2017. One of the reasons I picked LFS as my sim was that it already had a Formula Student vehicle, as well as flat areas and cones, so the work to adapt it for my use case was smaller than for other sims.

In order to gather data, I created a tool that can convert hand-drawn tracks to lyt files, which I could then use in LFS. In the beginning, the tracks were simple, and over time I created tracks that contained corner complexes, which proved to be problematic during the evaluation phase. Overall, I created around 20 tracks on which I gathered data. I did 2-3 laps on each track. You can find a short demo of the creation process in this link:





I gathered the data using a mouse for steering, throttle, and brake, as I don’t have a sim setup. I also limited the performance of the vehicle by applying a 50% air restrictor to the engine and only using first gear. My project was a proof of concept, so I didn’t want to overcomplicate things by using multiple gears.

During driving, my program gets data from LFS using OutSim and InSim and sends the driving commands using vJoy. The computation takes around 5ms, so the driving can happen at the fastest rate LFS currently allows—100Hz (until the 1000Hz physics engine arrives).

As for driving performance, I’m very satisfied with the current state of the project. Of course, the main limitation of the method I used is that the AI will only ever be as fast as I am. If I ever come back to this project, I’d like to explore other methods, such as reinforcement learning, to further improve performance.

Here is a video of the final result:

perhaps you could release the ai and the layout tool please? or maybe give in private Smile
Wow, the end result is very impressive for an AI that only got trained with your driving. You must give reinforcement learning a shot, although it will take an enourmous amount of time, because you have to do runs in real time allways. Awesome project for uni, I'm sure your teachers are proud.

I would be interested to know more details about your neural network. How many neurons do you have, how many (hiden) layers, how many inputs and outputs. Which kind of activation functions you used and so on.
Quote from Krunal_01 :perhaps you could release the ai and the layout tool please? or maybe give in...

layout tool is literally in the video. i created my own track right now
I love that stuff like this can be done in LFS! Amazing work and thank you for sharing!
You can thank inSim for that, as without it this kind of stuff wouldn't be possible.

I went through the thesis, it is well writen, nice work man. I'm still amazed that you used such a tiny neural network with only 6 inputs and 1 hidden layer and still managed to get good driving results.

I'm interested to see how would Gabor do on such type of tracks and if AI would benefit if trained by his data set.
#8 - gu3st
I'ven't explored them myself, but heard there are some tools to mess round the system reported clock time the apps see, in order to run them artificialy faster. Than, some dummy vGPU card and you could try to squeze some few LFS instances in parrell. Real-time data gathering really would have too low yield otherwise.

FGED GREDG RDFGDR GSFDG