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

Installation

Installing from source

git clone https://gitlab.com/cps_public/opendrive2lanelet.git
python setup.py install

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

Using the library in your own scripts

from lxml import etree
from opendrive2lanelet.opendriveparser.parser import parse_opendrive
from opendrive2lanelet.network import Network
from opendrive2lanelet.io.extended_file_writer import ExtendedCommonRoadFileWriter

# 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
commonroad_writer = ExtendedCommonRoadFileWriter(scenario, source="OpenDRIVE 2 Lanelet Converter"
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

Benjamin Orthen (current maintainer)
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.0.0.tar.gz (45.7 kB view details)

Uploaded Source

Built Distributions

opendrive2lanelet-1.0.0-py3-none-any.whl (74.5 kB view details)

Uploaded Python 3

opendrive2lanelet-1.0-py3-none-any.whl (71.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opendrive2lanelet-1.0.0.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.2

File hashes

Hashes for opendrive2lanelet-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9acd33df774812379e76bde8cac558f425d7b66cb227f0f72ea9aaa863e91eb9
MD5 99b3c9343e8c5d7dc35ef4b1863b2238
BLAKE2b-256 b56a3be7d60445ef5719478a9b771ef88c6c2eba29803027865099a15d1d5ebf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opendrive2lanelet-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 74.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.2

File hashes

Hashes for opendrive2lanelet-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 148b372f855018bbbb8b0689d37c6ae903701c9c320e2aa75d21b4f869795de9
MD5 0a35175cd05c8873c511678730afbbb2
BLAKE2b-256 cc60c6d24d9a246a2c9a683ec3ac2ddc39597b863660218fe1928c29e4913533

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opendrive2lanelet-1.0-py3-none-any.whl
  • Upload date:
  • Size: 71.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.2

File hashes

Hashes for opendrive2lanelet-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5bd02b1cd3a06cb165c066a316fba59338da8e0548668cf1997cb4917fd02755
MD5 0346a4507fc6dd2d7e3cf75655938818
BLAKE2b-256 2b4555fd69735d051c0c98a1a9f71472ad64fb26f5bb05d6c0bb8a3a39f5ffb5

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