EN | CN
Note
This is the official codebase for Course AU7043 in Shanghai Jiao Tong University under branch AU7043.
tactics2d is an open-source Python library that provides diverse and challenging traffic scenarios for the development and evaluation of reinforcement learning-based decision-making models in autonomous driving. tactics2d stands out with the following key features:
- Compatibility
- π¦ Trajectory dataset -- Enables seamless importation of various real-world trajectory datasets, including Argoverse, Dragon Lake Parking (DLP), INTERACTION, LevelX Series (HighD, InD, RounD, ExiD), NuPlan, and Waymo Open Motion Dataset (WOMD), encompassing both trajectory parsing and map information.
- π Map format -- Enables parsing and conversion of commonly used open map formats like OpenDRIVE, Lanelet2-style OpenStreetMap (OSM), and SUMO roadnet.
- Customizability
- π Traffic participants -- Supports the creation of new traffic participant classes with customizable physical attributes, physics dynamics/kinematics models, and behavior models.
- π§ Road elements -- Support the definition of new road elements, with a focus on regulatory aspects.
- Diversity
- π£οΈ Traffic scenarios -- Features an extensive range of built-in Gym-style traffic scenarios, including highway, lane-merging, unsignalized/signalized intersection, roundabout, parking, and racing.
- π² Traffic participants -- Features a variety of built-in traffic participants with realistic physics parameters, detailed further here.
- π· Sensors -- Provides bird's-eye-view (BEV) semantic segmentation RGB image and single-line LiDAR point cloud for model input.
- Visualization -- Offers a user-friendly visualization tool for real-time rendering of traffic scenarios and participants, along with the capability to record and replay traffic scenarios.
- Reliability -- Over 85% code is covered by unit tests and integration tests.
For further information on tactics2d, please refer to our comprehensive documentation, and a detailed comparison with other similar libraries is available here.
We have a Discord Community for support. Feel free to ask questions. Posting in Github Issues and PRs are also welcome.
We have conducted testing for the execution and construction of tactics2d on the following platforms:
Note: The matrix below reflects versions covered by the
test_modulesCI workflow.
| System | 3.8 | 3.9 | 3.10 | 3.11 | 3.12 | 3.13 |
|---|---|---|---|---|---|---|
| Ubuntu 18.04 | β | - | - | - | - | - |
| Ubuntu 20.04 | β | β | - | - | - | - |
| Ubuntu 22.04 | β | β | β | β | β | β |
| Ubuntu 24.04 | β | β | β | β | β | β |
| Windows | - | - | β | β | β | β |
| macOS | β | β | β | β | β | β |
We strongly recommend using conda to manage the Python environment. If you don't have conda installed, you can download it from here.
# create a new conda environment
conda create -n tactics2d python=3.9
conda activate tactics2dYou can simply install tactics2d from PyPI with the following command.
pip install tactics2dYou can also install tactics2d from its source on GitHub. This way is recommended if you want to run the sample code or contribute to the development of tactics2d. Please note that you should have GCC installed on your operating system before installing tactics2d.
# clone the repository with submodules but ignore the large files (mainly the NuPlan's map data)
# please download NuPlan's map data from its official website and put it in the `tactics2d/data/map/NuPlan` directory
git clone --recurse-submodules git@github.com:WoodOxen/tactics2d.git
cd tactics2d
pip install -v .If no errors occur, you should have installed tactics2d successfully.
According to the licenses of the trajectory datasets, we cannot distribute the original datasets with tactics2d. You need to download the datasets from their official websites. Currently, tactics2d supports the following datasets:
- Argoverse 2
- Dragon Lake Parking (DLP)
- HighD
- InD
- RounD
- ExiD
- INTERACTION
- NuPlan
- Waymo Open Motion Dataset v1.2 (WOMD)
You can put the downloaded files at whatever location you like. In the parser, you can specify the path to the dataset.
After the installation, you can run the tutorial jupyter notebooks to get started with tactics2d.
To run train_parking_demo.ipynb, which is a simplified version of our work in this paper, you need to pull an extra module rllib:
git submodule update --init --recursiveWe have built a complete CI pipeline for tactics2d. The samples under tests are good samples for you to get familiar with the interfaces. To run the samples, you can use the following command:
pip install pytest
pytest tests/[test_file_name]::[test_function_name]tactics2d supports the parsing of various real-world trajectory datasets, including Argoverse, Dragon Lake Parking (DLP), INTERACTION, LevelX Series (highD, inD, rounD, ExiD), NuPlan, and Waymo Open Motion Dataset (WOMD). For more demos, please refer to the documentation.
| HighD (Location 3) | ExiD (Location 6) |
|---|---|
|
|
| InD (Location 4) | Argoverse |
|---|---|
|
|
| INTERACTION | WOMD |
|---|---|
|
|
| RounD (Location 0) | INTERACTION |
|---|---|
|
|
| DLP | Self-generated |
|---|---|
|
Coming soon |
If you find tactics2d useful, please cite this in your publication.
@article{li2024tactics2d,
title={Tactics2D: A Highly Modular and Extensible Simulator for Driving Decision-Making},
author={Li, Yueyuan and Zhang, Songan and Jiang, Mingyang and Chen, Xingyuan and Yang, Jing and Qian, Yeqiang and Wang, Chunxiang and Yang, Ming},
journal={IEEE Transactions on Intelligent Vehicles},
year={2024},
publisher={IEEE}
}You are welcome to raise pull request and update your publication based on Tactics2D.
Jiang, Mingyang*, Li, Yueyuan*, Zhang, Songan, et al. "HOPE: A Reinforcement Learning-based Hybrid Policy Path Planner for Diverse Parking Scenarios." IEEE Transactions on Intelligent Transportation Systems (2025). (*Co-first author) | Code | Demo









