Skip to main content

Generative Autonomous Vehicle Testing Environment for Unknown Unsafe Events Discovery


Website • Paper • Examples • Community

PyPI python PyPI version License GitHub issues

About

TeraSim is an open-source traffic simulation platform designed for naturalistic and adversarial testing of autonomous vehicles (AVs). It enables high-speed, AI-driven testing environment generation to expose AVs to both routine and rare, high-risk driving conditions.

Developed with researchers, AV developers, and regulators in mind, TeraSim is designed to better support ISO 21448 (SOTIF) and ISO 34502 compliance, providing a scalable, automated, and unbiased AV evaluation framework.

Built upon the open-source traffic simulation software SUMO (Simulation of Urban MObility), TeraSim extends its capabilities to provide specialized features for autonomous vehicle testing.

🎥 Demo Video

TeraSim Demo Video

TeraSim is built upon a series of foundational academic works in autonomous vehicle testing:

  • NDE (Paper | Code): Learning naturalistic driving environment with statistical realism. Yan, X., Zou, Z., Feng, S., et al. Nature Communications 14, 2037 (2023).

  • NADE (Paper | Code): Intelligent driving intelligence test for autonomous vehicles with naturalistic and adversarial environment. Feng, S., Yan, X., Sun, H. et al. Nature Communications 12, 748 (2021).

  • D2RL (Paper | Code): Dense reinforcement learning for safety validation of autonomous vehicles. Feng, S., Sun, H., Yan, X., et al. Nature 615, 620–627 (2023).


🌟 Key Features

✅ Generative Driving Environment Testing
→ Adaptive and interactive environments replace static, manually designed scenarios.
→ Automatically uncovers unknown unsafe events, enhancing AV safety validation.
→ Scalable and efficient, reducing manual effort while expanding test coverage.

✅ Naturalistic & Adversarial Driving Environments (NADE)
→ Real-world traffic behavior modeling based on large-scale naturalistic driving data.
→ Injects corner cases (e.g., jaywalking pedestrians, sudden lane changes) to rigorously test AV safety.

✅ Scalable & Automated AV Testing
→ AI-driven naturalistic and adversarial driving environment accelerates AV validation by 1,000x - 100,000x compared to real-world testing.
→ Dynamically adapts test cases to urban, highway, and mixed-traffic conditions.

✅ Seamless Integration with Third-Party Simulators
→ Works with CARLA, Autoware, and more.
→ API-driven design enables plug-and-play simulation for integration with third-party simulators.

✅ City-Scale AV Testing with TeraSim-Macro
→ Extends simulations from single intersections to entire cities, supporting policy-level AV impact analysis.

✅ Multimodal Inputs & AI-Assisted Environment Creation
→ TeraSim-GPT enables language-driven environment customization.
→ Define test cases in natural language: "Create a left-turn driving environment at a busy intersection."


🛠️ System Architecture

TeraSim is modular, allowing users to customize and extend simulations easily.

Architecture

📌 Core Components:

  • TeraSim: Base simulation engine for generating AV test environments.
  • TeraSim-NDE-NADE: Realistic & adversarial driving environments for safety evaluation.
    • Vehicle Adversities (e.g., aggressive cut-ins, emergency braking).
    • VRU Adversities (e.g., jaywalking pedestrians, erratic cyclists).
  • TeraSim-Service: RESTful API service built with FastAPI for seamless integration with popular simulators like CARLA and AWSim. Enables standardized communication and control.
  • TeraSim-Macro (coming soon): Enables mesoscopic city-scale AV testing.
  • TeraSim-Data-Zoo (coming soon): Repository for real-world driving data (Waymo, NuScenes, NuPlan).
  • TeraSim-GPT (coming soon): AI-powered multimodal user input handling for environment customization.

📌 Plug-and-Play Compatibility:
✅ SUMO-based microsimulation
✅ CARLA & Autoware integration
✅ Real-world dataset support


🔧 Installation

Currently, TeraSim is under active development. Please install it from source using poetry (required) and Anaconda (optional).

conda create -n terasim python=3.10
conda activate terasim
git clone https://github.com/mcity/TeraSim.git
cd TeraSim
poetry install

🚀 Why TeraSim?

🔍 Uncover Hidden AV Risks
→ Dynamically generates realistic and adversarial traffic environments, identifying corner cases.

⚡ Automated & Scalable
→ Uses AI to generate simulations across cities, with 1000x faster testing efficiency than real-world methods.

🔗 Seamless Integration
→ Plugin-based design works with existing AV stacks & third-party simulators.

📢 Open-Source & Extensible
→ Encourages industry collaboration for safer, more reliable AV deployment.


Metadata

Release files for terasim 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for terasim 0.1.0
File Size Uploaded Provenance Actions
terasim-0.1.0.tar.gz 44.8 kB Without provenance Details for terasim-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for terasim 0.1.0
File Interpreter ABI Platform Actions
terasim-0.1.0-py3-none-any.whl Python 3 none any Details for terasim-0.1.0-py3-none-any.whl

Total release size: 105.3 kB

Release files / terasim-0.1.0.tar.gz

Download URL terasim-0.1.0.tar.gz
Size 44.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dd0ea832c10c0e4a1e2a85a4e3ece409a30574ca52326cea4f61e209ecffa197
BLAKE2b-256 checksum
How to use checksums
75fc0a58315f4d74e43ea227d2daa234549a9b0c5224aa73670bc3a6dd83a05c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.14 Linux/5.15.167.4-microsoft-standard-WSL2

Release files / terasim-0.1.0-py3-none-any.whl

Download URL terasim-0.1.0-py3-none-any.whl
Size 60.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6f489aa554b4df219659529ce23ee6a34cedbb3efccdf221330da414cce9cda
BLAKE2b-256 checksum
How to use checksums
b656d94ced00aa061c41c4a3479e5e6182337d5129455ae0744c9290dd8e343c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.14 Linux/5.15.167.4-microsoft-standard-WSL2

Security for terasim 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page