Skip to content

CommonRoad/commonroad-ots-interface

Repository files navigation

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.

About

CommonRoad OpenTrafficSim interface.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages