Skip to main content

Coupling CommonRoad and OpenTrafficSim.

Project description

CommonRoad - OpenTrafficSim Interface

PyPI pyversions PyPI version fury.io PyPI download week PyPI download month PyPI license

Interface between CommonRoad and the traffic simulator OpenTrafficSim (OTS).

It allows you to simulate CommonRoad scenarios with different abstraction levels (i.e. resimulation, delay, demand, infrastructure, random) in OTS and get the results as CommonRoad scenarios.

Quick Start

Installation

The interface is available on PyPI and can easily be installed:

$ pip install commonroad-ots

Additionally, a working java installation is required to execute OTS. For Ubuntu you can use:

$ apt-get update && apt-get install -y default-jdk

OTS itself is distributed as a python package and included as a dependency of this package. Therefore, no separate installation is necessary.

Example Usage

The following example shows how to resimulate a given CommonRoad scenario:

from pathlib import Path
from commonroad.common.file_reader import CommonRoadFileReader
from commonroad_ots.conversion.main import Conversion
from commonroad_ots.abstractions.abstraction_level import AbstractionLevel
from commonroad_ots.abstractions.simulation_execution import SimulationExecutor

# Load recorded scenario
scenario_path = Path("/path/to/commonroad/scenario.xml")
scenario_rec, _ = CommonRoadFileReader(scenario_path).open()

# Setup and execute simulation
executor = SimulationExecutor(scenario_rec, AbstractionLevel.RESIMULATION, False, dict(), 1234, False, False)
scenario_new, _, _, _, _ = executor.execute()

Documentation

The full documentation of the API and introductory examples can be found at cps.pages.gitlab.lrz.de/commonroad/cr-ots-interface.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

commonroad_ots-2025.1.tar.gz (40.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

commonroad_ots-2025.1-py3-none-any.whl (52.4 kB view details)

Uploaded Python 3

File details

Details for the file commonroad_ots-2025.1.tar.gz.

File metadata

  • Download URL: commonroad_ots-2025.1.tar.gz
  • Upload date:
  • Size: 40.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.18 Linux/5.15.0-87-generic

File hashes

Hashes for commonroad_ots-2025.1.tar.gz
Algorithm Hash digest
SHA256 aaa9a85441824471ca1151a828027c1805cdf2f499d183e1acd3a7693faef171
MD5 fc79c8f3caf5465aeb654252abd5f381
BLAKE2b-256 f9a8c21b4d489476eb5670295cce26e77c19d4d89a3c3dada15ab76b57c47a06

See more details on using hashes here.

File details

Details for the file commonroad_ots-2025.1-py3-none-any.whl.

File metadata

  • Download URL: commonroad_ots-2025.1-py3-none-any.whl
  • Upload date:
  • Size: 52.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.18 Linux/5.15.0-87-generic

File hashes

Hashes for commonroad_ots-2025.1-py3-none-any.whl
Algorithm Hash digest
SHA256 34a7c10008c9977d204da0569d06f050703872d9faa1a4a971c73d10a87624cd
MD5 6b7772b726884f9eedfe282406174fc5
BLAKE2b-256 29ea2bb251991330d4196be9f35b0b6b700f8831b25d054382adde0d0d049d52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page