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.
Installation
Installing from source
git clone https://gitlab.lrz.de/tum-cps/opendrive2lanelet.git
cd opendrive2lanelet
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
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:
Set the platform to xcb using this command: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.
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
Built Distribution
File details
Details for the file opendrive2lanelet-1.1.0.tar.gz
.
File metadata
- Download URL: opendrive2lanelet-1.1.0.tar.gz
- Upload date:
- Size: 54.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cf26641a822833acedd1ea82a1be183237c468c5849ebab7fb5be9e4d4f2cb5 |
|
MD5 | 8a893b5b7f090a045d3331bc75428b7a |
|
BLAKE2b-256 | 4915d55581f60927f85f124dba20269df87364eac303f49d80df8dac10b5ce2f |
File details
Details for the file opendrive2lanelet-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: opendrive2lanelet-1.1.0-py3-none-any.whl
- Upload date:
- Size: 85.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2758e65f9469b24ab16b86fc2a629325bac13979dcf6c85d667d938cdd57b6fb |
|
MD5 | 17a4d79a9bd39364d37a91cf4e4ebb69 |
|
BLAKE2b-256 | 1f6ec711dfdf2d39d11d791823b3a2f22d6966ecaf0ccfb131aace66fc8b8a14 |