This is the repository that includes the code material for the ESweek 2021 for the Education Class Lecture A3 "Learn to Drive (and Race!) Autonomous Vehicles"
Lecture videos: Youtube Playlist
Lecturers:
The following code was tested on both MacOS (Big Sur, Monterey) and Linux (Ubuntu 18.04, 20.04)
- Start by installing a Virtual Environment (
virtualenv
) with Python 3.8 in the repository:
- Install the
virtualenv
python3 package
pip3 install virtualenv
- Create a virtual environment
virtualenv venv
- Enable the virtual environment
source venv/bin/activate
- Install the required python packages within the
virtualenv
with the following command:
pip3 install -r requirements.txt
- Install the F1TENTH gym environment while in the root folder of this repository by running the following command:
$ pip3 install -e gym/
- For more information about the F1TENTH Gym environment you can have a look at the the documentation here.
-
Change to the Folder 01_Follow_The_Gap
-
To experience the Follow the Gap algorithm, run the following command.
$ python3 FollowTheGap.py
-
You will see the simulation starting and a new windows with the simulation environment is popping up. This algorithm is running on a map that has obstacles included and you see the algorithm is avoiding these obstacles.
-
You can adjust the Follow The Gap parameter in the drivers.py file
-
Change to the Folder 02_Pure_Pursuit
-
To experience the Pure Pursuit algorithm, run the following command.
$ python3 PurePursuit.py
-
You will see the simulation starting and a new windows with the simulation environment is popping up. This algorithm is following a precalculated racline which is displayed in the simulation environment.
-
You can adjust the Pure Pursuit parameter directly in the PurePursuit.py file
-
To get a minimum curvature or minimum time global optimal raceline we recommend that you use the methods and code that is displaye here
-
Change to the Folder 03_GraphBasedPlanner
-
To experience the Graph based planner algorithm, run the following command.
$ python3 GraphPlanner_MultiVehiclepy.py
-
You will see the simulation starting and a new windows with the simulation environment is popping up. In addition first of all the graph for the whole racetrack is created. This algorithm is following a precalculated racline which while avoiding and overtaking obstacles - fast and safe.
-
A detailed documentation and explanation of the Graph Based Planner can be found here.
- On MacOS Big Sur and above, when rendering is turned on, you might encounter the error:
ImportError: Can't find framework /System/Library/Frameworks/OpenGL.framework.
You can fix the error by installing a newer version of pyglet:
$ pip3 install pyglet==1.5.11
And you might see an error similar to
gym 0.17.3 requires pyglet<=1.5.0,>=1.4.0, but you'll have pyglet 1.5.11 which is incompatible.
which could be ignored. The environment should still work without error.
For this repository we are using the theoretical foundations, images and code from the following papers. If you find our work useful in your research, please consider citing:
-
J. Betz, A. Wischnewski, A. Heilmeier, F. Nobis, T. Stahl, L. Hermansdorfer, B. Lohmann, M. Lienkamp "What we can learn from autonomous racing",2018, Springer (PDF)
-
M. O’Kelly, H. Zheng, D. Karthik, R. Mangharam "F1TENTH: An Open-source Evaluation Environment for Continuous Control and Reinforcement Learning" in Proceedings of the NeurIPS 2019 Competition and Demonstration Track, PMLR 123:77-89, 2020. (PDF)
-
T. Stahl, A. Wischnewski, J. Betz, and M. Lienkamp, “Multilayer Graph-Based Trajectory Planning for Race Vehicles in Dynamic Scenarios,” in 2019 IEEE Intelligent Transportation Systems Conference (ITSC), Oct. 2019, pp. 3149–3154. (PDF)
-
A. Heilmeier, A. Wischnewski, L. Hermansdorfer, J. Betz, M. Lienkamp, B. Lohmann
"Minimum Curvature Trajectory Planning and Control for an Autonomous Racecar" Vehicle System Dynamics, vol. 58, no. 10, pp. 1497–1527, Jun. 2019, (PDF)