This project demonstrates reinforcement learning using Soft Actor-Critic for autonomous racecar driving using BeamNG and Stable Baselines3.
git clone https://github.com/kikutabryan/rl-racecar.git
cd rl-racecarYou need to clone the BeamNG.gym repository fork and install it:
git clone https://github.com/kikutabryan/BeamNG.gym.git
cd BeamNG.gym
pip install -e .
cd ..It is recommended to use a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtMake sure you have BeamNG.tech installed and properly configured. You must set the BNG_HOME environment variable to the path of your BeamNG.tech installation (the folder containing EULA.pdf).
To test a trained model, run:
python simple_test.pyThis will load a pre-trained model and run it in the BeamNG environment.
You can view a demonstration video of the trained agent below:
Training is performed using the training_progressive.py script. This script implements progressive curriculum training, incrementally increasing the track length and saving models at each stage.
To start training, run:
python training_progressive.pyThis will save trained models in the models/ directory and logs in the logs/ directory.
