1、完成网络的搭建:

搭建一个简单的十字路口场景:

1)定义结点:新建intersection.node.xml,内容如下:

NOTE1:结点属性type="traffic_light" 意味着车辆和行人在此遵守信号灯指引,而type="unregulated"意味着车辆和行人在此不改变运动状态,即可能出现碰撞。

<nodes><node id="node1" x="600" y="0" type="priority"/><node id="node2" x="0" y="600" type="priority"/><node id="node3" x="600" y="600" type="traffic_light"/><node id="node4" x="1200" y="600" type="priority"/><node id="node5" x="600" y="1200" type="priority"/><node id="node8" x="300" y="300" type="priority"/><node id="node9" x="300" y="600" type="unregulated"/><node id="node10" x="300" y="900" type="priority"/>
</nodes>

2) 定义边:新建intersection.edge.xml,内容如下:

NOTE2:修改edge的车道lane,index="0"为最右侧车道,添加属性allow="pedestrian" 或者 添加edge属性:sidewalkWidth="1" 自动添加一个allow="pedestrian"的lane,宽度等于1。

<edges><edge id="1to3" from="node1" to="node3" priority="4" numLanes="3" speed="15"><lane index="0" allow="pedestrian"/></edge><edge id="3to1" from="node3" to="node1" priority="4" numLanes="3" speed="15"><lane index="0" allow="pedestrian"/></edge><edge id="2to9" from="node2" to="node9" priority="4" numLanes="3" speed="15"><lane index="0" allow="pedestrian"/></edge><edge id="9to2" from="node9" to="node2" priority="4" numLanes="3" speed="15"><lane index="0" allow="pedestrian"/></edge><edge id="9to3" from="node9" to="node3" priority="4" numLanes="3" speed="15"><lane index="0" allow="pedestrian"/></edge><edge id="3to9" from="node3" to="node9" priority="4" numLanes="3" speed="15"><lane index="0" allow="pedestrian"/></edge><edge id="4to3" from="node4" to="node3" priority="4" numLanes="3" speed="15"><lane index="0" allow="pedestrian"/></edge><edge id="3to4" from="node3" to="node4" priority="4" numLanes="3" speed="15"><lane index="0" allow="pedestrian"/></edge><edge id="5to3" from="node5" to="node3" priority="4" numLanes="3" speed="15"><lane index="0" allow="pedestrian"/></edge><edge id="3to5" from="node3" to="node5" priority="4" numLanes="3" speed="15"><lane index="0" allow="pedestrian"/></edge><edge id="8to9" from="node8" to="node9" priority="4" numLanes="1" speed="15"></edge><edge id="9to8" from="node9" to="node8" priority="4" numLanes="1" speed="15"></edge><edge id="9to10" from="node9" to="node10" priority="4" numLanes="1" speed="15"></edge><edge id="10to9" from="node10" to="node9" priority="4" numLanes="1" speed="15"></edge>
</edges>

3)在路口添加人行道:新建intersection.con.xml,内容如下:

NOTE3:node为设置人行道的结点,edge表示人行道横跨的道路。
NOTE4:在结点上添加crossing,结点必须与将要设置人行道的路段有连接。

<connections>
<crossing node="node3" edges="1to3 3to1" priority="true"/>
<crossing node="node3" edges="9to3 3to9" priority="true"/>
<crossing node="node3" edges="4to3 3to4" priority="true"/>
<crossing node="node3" edges="5to3 3to5" priority="true"/>
</connections>

3)生成网络:

打开sumo文件夹中的\bin\start-command-line.bat,使用指令:

netconvert --node-files=intersection.node.xml --edge-files=intersection.edge.xml --connection-files=intersection.con.xml --output-file=intersection.net.xml

生成intersection.net.xml文件。

2、在路网中加入车流和人流:

1)新建intersection.rou.xml,内容如下:

NOTE5:这里都是定义的vType,到veins中再指定相应的模块。

<?xml version="1.0" encoding="UTF-8"?>
<routes><route id="route0" edges="2to9 9to3 3to4"/><route id="route1" edges="4to3 3to9 9to2"/><route id="route2" edges="1to3 3to5"/><route id="route3" edges="5to3 3to1"/><route id="route4" edges="8to9 9to3 3to5"/><route id="route5" edges="10to9 9to8"/><vType id="vtype0" accel="2.6" decel="4.5" sigma="0.5" length="4" width = "2" minGap="2.5" maxSpeed="14" color="1,1,0"/><vType id="vtype1" accel="2.6" decel="4.5" sigma="0.5" length="0.21" width = "0.48" minGap="2.5" maxSpeed="1.39" color="0,1,1"/><flow id="flow0" type="vtype0" route="route0" begin="0" period="3" number="10"/>    <flow id="flow1" type="vtype0" route="route1" begin="0" period="3" number="10"/>    <flow id="flow2" type="vtype0" route="route2" begin="0" period="3" number="10"/>    <flow id="flow3" type="vtype0" route="route3" begin="0" period="3" number="10"/><flow id="flow4" type="vtype1" route="route4" begin="0" period="3" number="10" departPos="250"/><flow id="flow5" type="vtype1" route="route5" begin="0" period="3" number="10" departPos="240"/>
</routes>

2)新建intersection.sumo.cfg,内容如下:

<configuration><input><net-file value="D:/sumo/abcBeaconRateAdapt/intersection.net.xml"/><route-files value="D:/sumo/abcBeaconRateAdapt/intersection.rou.xml"/></input><time><begin value="0"/><end value="1000"/><step-length value="0.1"/></time><reports><print-options value="false"/></reports><gui_only><start value="true"/></gui_only>
</configuration>

3)验证网络和车流:

打开sumo\bin\sumo-gui.exe模拟车流,正确则进行下一步:

3、在Veins中模拟

1)导入文件:

复制intersection.net.xml、intersection.rou.xml、intersection.sumo.cfg三个文件放入omnetpp中veins项目下相应位置,新建intersection.launchd.xml,内容如下:

<?xml version="1.0"?>
<!-- debug config -->
<launch><copy file="intersection.net.xml" /><copy file="intersection.rou.xml" /><copy file="intersection.sumo.cfg" type="config" />
</launch>

修改omnetpp.ini文件中的配置来更改配置文件:

*.manager.launchConfig = xmldoc("intersection.launchd.xml") 

如果在导入文件后运行出现如下错误:

注释.ini文件中的:

*.obstacles.obstacles = xmldoc("config.xml", "//AnalogueModel[@type='SimpleObstacleShadowing']/obstacles")

如果还出错,备注config.xml中的:

2)指定行人和车的不同模块 :

在omnetpp.ini文件中添加配置为人和车分配不同的模块类型、模块名和显示的图片(在images\veins\node中)。为了方(tou)便(lan),这里Human模块和node模块一样,改了个名字。

NOTE6:这里的两个vtype对应intersection.rou.xml中的两个vtype。

*.manager.moduleType = "vtype0=org.car2x.veins.nodes.Car vtype1=org.car2x.veins.nodes.Human"
*.manager.moduleName = "vtype0=node vtype1=human"
*.manager.moduleDisplayString = "vtype0='i=veins/node/car;is=vs' vtype1='i=veins/node/pedestrian;is=vs'"

3)添加人模块的配置(所有node配置先给human来一份):

这里应用层用了"MyVeinsApp",这个类是vines自带的,继承自BaseWaveApplLayer,比较空,很适合用来自己定义应用层。当然,如果给Human模块定义不一样的应用层,也可以继承BaseWaveApplLayer,方法是一样的。如果两个模块的结构不一样,其中可有一些难搞的地方,可能以后会再说。

*.human[*].applType = "MyVeinsApp"
*.human[*].appl.headerLength = 80 bit
*.human[*].appl.sendBeacons = false
*.human[*].appl.dataOnSch = false
*.human[*].appl.beaconInterval = 1s*.human[*].veinsmobilityType.debug = true
*.human[*].veinsmobility.x = 0
*.human[*].veinsmobility.y = 0
*.human[*].veinsmobility.z = 1.895
*.human[*0].veinsmobility.accidentCount = 0
*.human[*0].veinsmobility.accidentStart = 75s
*.human[*0].veinsmobility.accidentDuration = 50s*.human[*].appl.dataOnSch = true

运行Veins:

当人和车相撞时,可能出错,因为在定义结点时,左边的十字路口定义为了无规则,如果不需要碰撞也定义成"traffic_light"就行了。在sumo中模拟时,相撞的车辆会被从场景中移除:

以上即本次全部内容,感谢看到最后,希望对你有帮助。

omnet++,veins,sumo使用多应用层实现车辆和行人的模拟相关推荐

  1. 【OMNET+Veins+SUMO】【视频】车联网仿真框架搭建指南

    1.简介 针对车联网方向的研究方向的童鞋,在OMNET搭建基本的仿真平台,需要安装两个插件Veins和SUMO.仿真软件OMNET的基本安装和使用本文不多赘述,前面的博文有介绍.下面重点说明一下Vei ...

  2. OMNET++/Veins VANET仿真:SUMO场景生成

    场景对于车载自组织网络(VANET)的仿真来说至关重要,因为VANET是一种特殊的Ad-Hoc网络,其特殊性主要变现在应用场景上. 传统的Ad-Hoc网络,比如sensor network,其仿真场景 ...

  3. omnet、sumo、veins环境搭建笔记

    sumo 参考:SUMO简单使用教程 - 知乎 三者配合,参考:Veins.OMNeT++.SUMO仿真实验_sunaxp的博客-CSDN博客 omnet 新建项目,参考:Omnet++创建第一个程序 ...

  4. MacOS搭建OMNeTpp+Veins+SUMO车联网仿真平台

    1.查询Veins支持的OMNeT及SUMO版本 http://veins.car2x.org/download/ 如下图所示,Veins5.0-alpha2最高支持SUMO1.2.0及OMNeT++ ...

  5. ADAS车辆在行人安全方面得分很低

    ADAS车辆在行人安全方面得分很低 ADAS vehicles score poorly on pedestrian safety 对于热衷于自动驾驶汽车(AV)的狂热者来说,一个现在病毒性的视频片段 ...

  6. 如何用点云对车辆和行人进行识别分类?这是MIT学生的总结

    本文来自AI新媒体量子位(QbitAI) 本文作者是MIT的大二学生Michael Gump(阿甘),内容为他在无人车公司Voyage的工作总结.本文还得到Voyage首席执行官Oliver Came ...

  7. 警告标志:警告车辆、行人注意危险地点的标志

    警告标志:警告车辆.行人注意危险地点的标志. 警1 十字交叉 警2 T形交叉 警3 T形交叉 警4 T形交叉 警5 Y形交叉 警6 环形交叉 警7 向左急弯路 警8 向右急弯路 警9 反向弯路 警10 ...

  8. 【高空无人机视角下的路口车辆与行人检测跟踪与轨迹刻画】

    [高空无人机视角下的路口车辆与行人检测跟踪与轨迹刻画] 背景需求 可参考的方法 1. opencv + python 实现目标跟踪的方法: 主要代码 ① main.py ② items.py 检测效果 ...

  9. 车辆和行人区的排水沟建筑材料英国UKCA认证—EN 1433

    英国UKCA认证的简介: 根据英国建筑产品法规要求,2023年1月1日期起,所有进入英国的建筑产品需要符合相关法规和标准.英国脱欧后,UKCA(英国符合性评定)标志是拟进入英国市场(英格兰,威尔士和苏 ...

最新文章

  1. Hadoop - MapReduce MRAppMaster-剖析
  2. css3运动后留下轨迹尾巴_球磨机的工作原理及机内运动轨迹分析
  3. 第十二周项目一-实现复数类中的运算符重载(3)
  4. 科技情报研究所工资_我们所说的情报是什么?
  5. 数据思维,让决策更精准
  6. 逻辑运算符(LogicalOperator)
  7. Silverlight 2动态创建矩形对象(附完整源代码)
  8. Java String 对象,你真的了解了吗?| CSDN 博文精选
  9. win7 更新android sdk,大神为你详解win7系统android sdk manager无法更新的处理对策
  10. 安卓网络操作全解:发起请求,解析响应
  11. Laravel Blade 模板用法
  12. GUID和UUID、CLSID、IID 区别及联系
  13. 萤石云官方Demo下载并二次开发 QT5.12.10
  14. linux 安全狗 乱码,打狗棒法之:Cknife(C刀)自定义模式秒过安全狗
  15. Sparsified SGD with Memory 论文阅读
  16. solaris系统的crontab定时任务
  17. Python金融大数据风控建模实战
  18. qq对计算机程序的更改,解决电脑总弹出“是否允许程序对计算机进行更改”
  19. 计算机维修工实操,计算机维修工(三级)操作技能练习题.pdf
  20. 作为一名大数据工程师你需要掌握Spark深度学习

热门文章

  1. dx/dy=1/y’求其二阶导
  2. 学习人工智能需要哪些必备的数学基础?
  3. 7、Spring AOP使用
  4. SS7网络中的短消息服务(SMS): 使用模块化设备优化利润
  5. document.getElementByTagName的用法
  6. Android权限申请之动态申请权限
  7. 食物链(带权并查集)
  8. 数据、数据库、数据库管理系统、数据库系统的概念
  9. 网络嗅探 精华版(全)
  10. 常用的排序算法-快速记忆