我是靠谱客的博主 甜甜蚂蚁,这篇文章主要介绍SUMO仿真高级进阶系列一:利用OpenStreetMap生成地图一、利用OpenStreetMap得到osm文件二、利用JOSM软件,根据自身需要进行微调三、加入交通灯四、生成道路模型文件五、用sumo-gui查看生成的道路地图原创文章,转载请注明!,现在分享给大家,希望可以做个参考。

在快速入门系列中,贯穿始终例子的道路模型是我们自定义map生成的,为了更接近实际又减少工作量,我们可以用OpenStreetMap来生成地图。


一、利用OpenStreetMap得到osm文件

官方提供了用命令行的方式获得osm文件,具体见如下链接:Downloading a Rectangular Area Using the command line

这里我们直接来到OpenStreetMap的官网:OpenStreetMap

手动选择一个区域,输出osm文件。



二、利用JOSM软件,根据自身需要进行微调

JOSM官网:http://josm.openstreetmap.de/



三、加入交通灯

在JOSM中可以读到交通节点的id,点击交通灯所在位置,例如下图圈出的红点位置交通灯的id为1480362569


获取所有交通灯所在位置id后,编写tls-controlled-nodes.nod.xml文件

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<nodes> <node id="2305552583" type="traffic_light"/> <node id="700709793" type="traffic_light"/> <node id="2156292510" type="traffic_light"/> <node id="1480362569" type="traffic_light"/> <node id="700709810" type="traffic_light"/> <node id="1480382895" type="traffic_light"/> <node id="1480382720" type="traffic_light"/> <node id="700709830" type="traffic_light"/> <node id="700709776" type="traffic_light"/> <node id="700709782" type="traffic_light"/> <node id="1480382607" type="traffic_light"/> <node id="1230462135" type="traffic_light"/> <node id="1230462067" type="traffic_light"/> <node id="2025035363" type="traffic_light"/> <node id="2025035353" type="traffic_light"/> <node id="667356834" type="traffic_light"/> <node id="2025035359" type="traffic_light"/> <node id="2024934554" type="traffic_light"/> <node id="1480362632" type="traffic_light"/> <node id="667356797" type="traffic_light"/> <node id="1480382611" type="traffic_light"/> <node id="1480362529" type="traffic_light"/> <node id="868610539" type="traffic_light"/> <node id="2305421779" type="traffic_light"/> <node id="2305421769" type="traffic_light"/> <node id="1477404082" type="traffic_light"/> <node id="2305421783" type="traffic_light"/> <node id="1477404020" type="traffic_light"/> <node id="2025062497" type="traffic_light"/> <node id="2025062397" type="traffic_light"/> <node id="2305552331" type="traffic_light"/> </nodes>


四、生成道路模型文件

首先将osm文件转换成sumo的道路模型文件:

复制代码
1
netconvert --osm-files map.osm.xml -o map.net.xml

在地图中加入交通灯:

复制代码
1
2
3
4
5
# 1. Import the OSM file to SUMO, discarding TLS information. netconvert --osm-files map.osm.xml --output-file map-without-tls.net.xml --osm.discard-tls # 2. Set traffic light information. netconvert --sumo-net-file map-without-tls.net.xml --node-files tls-controlled-nodes.nod.xml --output-file map-with-tls.net.xml

五、用sumo-gui查看生成的道路地图




原创文章,转载请注明!

最后

以上就是甜甜蚂蚁最近收集整理的关于SUMO仿真高级进阶系列一:利用OpenStreetMap生成地图一、利用OpenStreetMap得到osm文件二、利用JOSM软件,根据自身需要进行微调三、加入交通灯四、生成道路模型文件五、用sumo-gui查看生成的道路地图原创文章,转载请注明!的全部内容,更多相关SUMO仿真高级进阶系列一:利用OpenStreetMap生成地图一、利用OpenStreetMap得到osm文件二、利用JOSM软件,根据自身需要进行微调三、加入交通灯四、生成道路模型文件五、用sumo-gui查看生成内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(76)

评论列表共有 0 条评论

立即
投稿
返回
顶部