从opendrive到lanelets的解析器和转换器

opendrive2lanelet的Python项目详细描述


opendrive 2 lanelet-转换器

我们提供了一个opendrive(www.opendrive.org)到lanelets(www.mrt.kit.edu/software/liblanelet)转换器的代码,该转换器已经在我们的paper:m.althoff,s.urban和m.koschi的《从opendrive到lanelets的道路网络自动转换》中介绍过。美国电气与电子工程师协会服务运营和物流及信息学国际会议,2018年。

Documentation StatusPyPI versionSupported python versionsLicense

安装

从源安装

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

使用PIP:

pip install opendrive2lanelet

或者,对于使用gui包:

pip install opendrive2lanelet[GUI]

OpenDrive文件示例

从以下位置下载示例文件:http://opendrive.org/download.html

用法

使用我们提供的gui

使用opendrive2lanelet-gui

启动gui

GUI screenshot

使用命令行转换文件

执行opendrive2lanelet-convert input_file.xodr -o output_file.xml

如果要可视化commonroad文件,请使用opendrive2lanelet-visualize命令。

在自己的脚本中使用库

fromlxmlimportetreefromopendrive2lanelet.opendriveparser.parserimportparse_opendrivefromopendrive2lanelet.networkimportNetworkfromfromcommonroad.common.file_writerimportCommonRoadFileWriter# Import, parse and convert OpenDRIVE filewithopen("{}/opendrive-1.xodr".format(os.path.dirname(os.path.realpath(__file__))),"r")asfi: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 filefromcommonroad.common.file_writerimportCommonRoadFileWritercommonroad_writer=CommonRoadFileWriter(scenario=scenario,planning_problem_set=None,author="",affiliation="",source="OpenDRIVE 2 Lanelet Converter",tags="",)withopen("{}/opendrive-1.xml".format(os.path.dirname(os.path.realpath(__file__))),"w")asfh:commonroad_writer.write_scenario_to_file_io(file_io=fh)

只是分析opendrive.xodr文件

fromlxmlimportetreefromopendrive2lanelet.opendriveparser.parserimportparse_opendrivewithopen("input_opendrive.xodr",'r')asfh:open_drive=parse_opendrive(etree.parse(fh).getroot())# Now do stuff with the dataforroadinopen_drive.roads:print("Road ID: {}".format(road.id))

文档

文档发布在Read the Docs

要从源代码生成文档,请首先使用pip安装必要的依赖项:

pip install -r docs_requirements.txt

然后您可以运行

cd docs && make html

例如。

已知问题

  • 尝试在Wayland下使用gui.py时,会发生以下错误:
    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.
    
    使用以下命令将平台设置为xcbexport QT_QPA_PLATFORM="xcb"

作者

本杰明·奥尔森(现任维修人员)
斯特凡市区

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java为jvm使用所有可用的系统内存   java:将值应用于列、3d数组   安卓 studio中我的应用程序的java生成异常   java地图上的视图是什么意思?   java是表示棋盘最有效的方法   java如何防止jackson在反序列化中实例化新对象   有没有办法禁用在java小程序中发送SNI记录?   java如何在递归函数的每一级都有一个新的局部数组   java如何使用JDT构建调用图   utf 8 Java字符编码,ISO到utf转换   java交错两个数组   java无法将GetMethodID与JNI中的字节数组参数一起使用   使用muledomainmavenplugin发布时的java双上传   java退出或退出actionListener   java我可以在Struts 2中的隐藏字段中保留对象引用吗?   java如何让Checkstyle忽略用@Entity注释标记的类的最终方法规则?   文件io java。木卫一。FileNotFoundException错误   java根据给定的条件从ArrayList中删除对象   安卓 SetId()和java中的findviewById以编程方式发布   java在JSP中显示字符串值