Skip to main content

Parser and converter from OpenDRIVE to lanelets

Project description

OpenDRIVE 2 Lanelet - Converter

We provide the code for an OpenDRIVE (www.opendrive.org) to lanelets (www.mrt.kit.edu/software/liblanelet) converter, which has been introduced in our paper: M. Althoff, S. Urban, and M. Koschi, "Automatic Conversion of Road Networks from OpenDRIVE to Lanelets," in Proc. of the IEEE International Conference on Service Operations and Logistics, and Informatics, 2018.

Documentation Status PyPI version Supported python versions License

Installation

Installing from source

git clone https://gitlab.lrz.de/cps/opendrive2lanelet.git
cd opendrive2lanelet
python setup.py install

Public source (only released versions): https://gitlab.lrz.de/tum-cps/opendrive2lanelet.git

Using pip:

pip install opendrive2lanelet

Optionally, for using the gui packages:

pip install opendrive2lanelet[GUI]

Example OpenDRIVE Files

Download example files from: http://opendrive.org/download.html

Usage

Using our provided GUI

Start the GUI with opendrive2lanelet-gui

GUI screenshot

Converting a file with the command line

Execute opendrive2lanelet-convert input_file.xodr -o output_file.xml

If you want to visualize the Commonroad file, use the opendrive2lanelet-visualize command.

Using the library in your own scripts

from lxml import etree
from opendrive2lanelet.opendriveparser.parser import parse_opendrive
from opendrive2lanelet.network import Network
from from commonroad.common.file_writer import CommonRoadFileWriter

# Import, parse and convert OpenDRIVE file
with open("{}/opendrive-1.xodr".format(os.path.dirname(os.path.realpath(__file__))), "r") as fi:
	open_drive = parse_opendrive(etree.parse(fi).getroot())

road_network = Network()
road_network.load_opendrive(open_drive)

scenario = road_network.export_commonroad_scenario()
# Write CommonRoad scenario to file
from commonroad.common.file_writer import CommonRoadFileWriter
commonroad_writer = CommonRoadFileWriter(
            scenario=scenario,
            planning_problem_set=None,
            author="",
            affiliation="",
            source="OpenDRIVE 2 Lanelet Converter",
            tags="",
        )
with open("{}/opendrive-1.xml".format(os.path.dirname(os.path.realpath(__file__))), "w") as fh:
	commonroad_writer.write_scenario_to_file_io(file_io=fh)

Just parsing the OpenDrive .xodr file

from lxml import etree
from opendrive2lanelet.opendriveparser.parser import parse_opendrive

with open("input_opendrive.xodr", 'r') as fh:
	open_drive = parse_opendrive(etree.parse(fh).getroot())

# Now do stuff with the data
for road in open_drive.roads:
	print("Road ID: {}".format(road.id))

Documentation

The documentation is published on Read the Docs.

To generate the documentation from source, first install the necessary dependencies with pip:

pip install -r docs_requirements.txt

Then you can run

cd docs && make html

for example.

Known Problems

  • When trying to use the gui.py under Wayland, the following error occurs:
    This application failed to start because it could not find or load the Qt platform plugin "wayland" in "".
    Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
    Reinstalling the application may fix this problem.
    
    Set the platform to xcb using this command: export QT_QPA_PLATFORM="xcb"

Authors

Sebastian Maierhofer (current maintainer) Benjamin Orthen
Stefan Urban

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

opendrive2lanelet-1.1.2.tar.gz (52.8 kB view details)

Uploaded Source

Built Distribution

opendrive2lanelet-1.1.2-py3-none-any.whl (85.9 kB view details)

Uploaded Python 3

File details

Details for the file opendrive2lanelet-1.1.2.tar.gz.

File metadata

  • Download URL: opendrive2lanelet-1.1.2.tar.gz
  • Upload date:
  • Size: 52.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7

File hashes

Hashes for opendrive2lanelet-1.1.2.tar.gz
Algorithm Hash digest
SHA256 d27cdbaac011dd1fab60e8858afa2dd62be1d24bc6710ec9d31bce1d66f43881
MD5 d928cbc13c93800f597b98c4f9a6a62b
BLAKE2b-256 829159afbe143d346cc1071d3456ad1db9ec12d4ccf4914171c3541f482a4e35

See more details on using hashes here.

File details

Details for the file opendrive2lanelet-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: opendrive2lanelet-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 85.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7

File hashes

Hashes for opendrive2lanelet-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6880adf21e1bb34e6525a33a86b91bcced7019cbd334f197dd4b6990685cb18b
MD5 057d354b614f00f075a96ecbc06fc57c
BLAKE2b-256 c8038d78825bc8a05e184e4a4f479d3bdb5e41f0c66913e4f5270ba241d24c16

See more details on using hashes here.

Supported by

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