This repository contains the code for the project submitted for CS686. The architecture of the neural network is based off the architecture created by NVIDIA in End to End Learning for Self-Driving Cars famously known as PilotNet.
Although this code was tested on Windows 11 Version 22H2, this should also work on Linux as well as MacOS. In the case of MacOS, you will most likely have to use an external CARLA server.
-
CARLA Simulator version 0.9.13
-
Clone the repository
git clone https://github.com/faizansana/cs686-project.git
-
From within the working directory, create the conda environment.
conda create -f environment.yml -n some_name_that_you_want
-
Depending on whether you want to collect data, train or test an already built model in simulation, you will use the following scripts as shown below
Make sure the CARLA server has been started before running this script!
Run the collect_data.py
file. This takes one positional argument and the usage can also be seen by using
python collect_data.py -h
To run collect_data.py
for 2 minutes with a local CARLA server exposed on port 2000
python collect_data.py 2
This will then run data collection for 2 minutes and be stored in a folder called recordings/{timestamp}/
.
The images are stored with the following naming convention:
[time_in_seconds, steering_angle, throttle, brake_pressure]
You do not need the CARLA server for this case.
Run the model.py
file. This only has optional arguments.
To generate a model with the name first_model_epoch_100
with 100 epochs
python model.py --model-name "first_model_epoch_100" --epochs 100
This section requires a CARLA server to be running.
Run the run_model_in_carla.py
file which requires one positional argument.
In order to run simulation on a model stored in the path ./models/first_model_epoch_100
python run_model_in_carla.py ./models/first_model_epoch_100