Coder Social home page Coder Social logo

icolwell-as / opendrive2lanelet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from usdot-fhwa-stol/opendrive2lanelet

0.0 0.0 0.0 1.14 MB

Automatic Conversion of Road Networks from OpenDRIVE to Lanelets

Home Page: https://gitlab.lrz.de/tum-cps/opendrive2lanelet

License: GNU General Public License v3.0

Python 99.68% Dockerfile 0.06% Shell 0.25%

opendrive2lanelet's Introduction

This repository is a forked from the https://gitlab.lrz.de/tum-cps/opendrive2lanelet/tree/master/opendrive2lanelet.

opendrive2lanelet2convertor usage

docker build -t opendrive2lanelet2convertor .
docker run --rm -it -v [$ path to the folder containing xodr maps]:/root/opendrive2lanelet/map opendrive2lanelet2convertor

After the process exit the .osm file with the same name should apear in the folder containing xodr maps.

Important notices

  • Speed limit unit is hard coded as mph

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

opendrive2lanelet's People

Contributors

afrye-leidos avatar mishkamn avatar msmcconnell avatar pcguglielmino-zz avatar smaierhofer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.