静脉行人模拟(omnet ++/sumo) [英] Pedestrian Simulation in veins (omnet++/sumo)

查看:249
本文介绍了静脉行人模拟(omnet ++/sumo)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用omnet ++中的sumo运行行人模拟.为了简化操作(我是初学者),我决定使用带有静脉的 Erlangen 示例,并通过几个行人对其进行扩展.我在相扑中添加了行人并运行它.它工作得很好: 您可以在这张图片中看到行人和汽车

I'm trying to run a pedestrian simulation from sumo in omnet++. To keep it easy (i am a beginner) I decided to use the Erlangen example provided with veins and extend it with a couple of pedestrians. I added the pedestrians in sumo and ran it. It works perfectly fine: You can see the pedestrians and cars in this picture

接下来,我试图在omnet ++中运行整个程序.我也设法做到了,但没有显示行人.只是汽车.我阅读了以下两个主题:

Next I was trying to run the whole thing in omnet++. I also managed to do that but the pedestrians were not shown. Just the cars. I read these two topics:

  • Communication between a car and a pedestrian in Veins
  • Veins Multiple Applications in multiples Vehicle types

并将这些行添加到示例的 omnetpp.ini 中:

and added these lines into the omnetpp.ini of the example:

*.manager.moduleType = "vtype0=org.car2x.veins.nodes.Car ped_pedestrian=org.car2x.veins.nodes.Pedestrian"
*.manager.moduleName = "vtype0=carNode ped_pedestrian=pedestrianNode"
*.manager.moduleDisplayString = "vtype0=carNode ped_pedestrian=pedestrianNode"

我还将 omnetpp.ini 中节点"的所有外观更改为"carNode",并为"pedestrianNode"创建了新条目,并复制了 Car.ned 文件并将文件名更改为 Pedestrian.ned ,并将模块名称更改为"Pedestrian".然后,我再次运行整个过程,但是除了汽车的图像(如模拟所示)变为灰色框之外,什么都没有改变.

I also changed every appearance of "node" in omnetpp.ini to "carNode" and created new entries for "pedestrianNode" and I duplicated the Car.ned file and changed the file name to Pedestrian.ned and the module name to "Pedestrian". Then I ran the whole thing again but nothing changed except that the cars' image (as shown in the simulation) changed to a grey box.

为什么不显示行人? (我错过了什么?) 我是否必须告诉静脉(或相扑)将行人位置传达给omnet ++? 为什么模拟中的汽车图标变为灰色框?

Why are the pedestrians not shown? (Did I miss something?) Do I have to tell veins (or sumo) to communicate pedestrian positions to omnet++? Why did the icon of the cars in the simulation change to a grey box?

这是我添加/修改的文件:

Here are the files that I added/modified:

  • omnetpp.ini
  • Pedestrian.ned

我研究了 TraCI定义,并调试了[静脉源代码].我发现这些行完成订阅的代码:

I researched the TraCI definition and debugged the [source code of veins]. I found these lines of code where subscriptions are done:

{
    // subscribe to list of departed and arrived vehicles, as well as simulation time
    simtime_t beginTime = 0;
    simtime_t endTime = SimTime::getMaxTime();
    std::string objectId = "";
    uint8_t variableNumber = 7;
    uint8_t variable1 = VAR_DEPARTED_VEHICLES_IDS;
    uint8_t variable2 = VAR_ARRIVED_VEHICLES_IDS;
    uint8_t variable3 = commandInterface->getTimeStepCmd();
    uint8_t variable4 = VAR_TELEPORT_STARTING_VEHICLES_IDS;
    uint8_t variable5 = VAR_TELEPORT_ENDING_VEHICLES_IDS;
    uint8_t variable6 = VAR_PARKING_STARTING_VEHICLES_IDS;
    uint8_t variable7 = VAR_PARKING_ENDING_VEHICLES_IDS;
    TraCIBuffer buf = connection->query(CMD_SUBSCRIBE_SIM_VARIABLE, TraCIBuffer() << beginTime << endTime << objectId << variableNumber << variable1 << variable2 << variable3 << variable4 << variable5 << variable6 << variable7);
    processSubcriptionResult(buf);
    ASSERT(buf.eof());
}

{
    // subscribe to list of vehicle ids
    simtime_t beginTime = 0;
    simtime_t endTime = SimTime::getMaxTime();
    std::string objectId = "";
    uint8_t variableNumber = 1;
    uint8_t variable1 = ID_LIST;
    TraCIBuffer buf = connection->query(CMD_SUBSCRIBE_VEHICLE_VARIABLE, TraCIBuffer() << beginTime << endTime << objectId << variableNumber << variable1);
    processSubcriptionResult(buf);
    ASSERT(buf.eof());
}

我将其与相扑Wiki上的TraCI文档进行了比较:
*模拟订阅的第一块: https://sumo.dlr.de/wiki/TraCI/Simulation_Value_Retrieval
*车辆订阅的第二个代码块: https://sumo.dlr.de/wiki/TraCI/Vehicle_Value_Retrieval

I compared that to the TraCI documentation on the sumo wiki:
* the first block for simulation subscriptions: https://sumo.dlr.de/wiki/TraCI/Simulation_Value_Retrieval
* the second block of code for vehicle subscription: https://sumo.dlr.de/wiki/TraCI/Vehicle_Value_Retrieval

在我看来,行人不包括在其中,因为人员/行人具有不同的api( https://sumo.dlr.de/wiki/TraCI/Person_Value_Retrieval )(未在订阅页面上列出)( https://sumo.dlr.de/wiki/TraCI/Object_Variable_Subscription ).

It seems to me that pedestrians are not included there since the persons/pedestrians have a different api (https://sumo.dlr.de/wiki/TraCI/Person_Value_Retrieval) which is not listed on the subscription page (https://sumo.dlr.de/wiki/TraCI/Object_Variable_Subscription).

在完成人员订阅的静脉源代码中是否缺少某些内容?

Is there something I missed in the source code of veins where person subscription is done?

甚至可以在TraCI中订阅人吗?

Is it even possible to subscribe to persons in TraCI?

推荐答案

您绝对正确.从Veins 5a1开始,Veins不支持行人(SUMO说法中的 Persons ),这意味着用户需要编写其他代码.

You are absolutely right. As of Veins 5a1, Pedestrians (Persons in SUMO parlance) are not supported by Veins out of the box, meaning additional code needs to be written by the user.

对于内部项目,我们只是克隆了代码处理工具订阅,在适当的地方替换了类和变量名

For internal projects we have simply cloned the code handling vehicle subscriptions, substituting class and variable names where appropriate

(即,CMD_SUBSCRIBE_PERSON_VARIABLE=0xde表示ID_LIST,然后为每个新用户订阅VAR_POSITION等,然后通过调用addModulenextPosition对这些变量的变化做出反应).

(i.e., CMD_SUBSCRIBE_PERSON_VARIABLE=0xde for ID_LIST, then subscribing to VAR_POSITION, etc. for every new person, and reacting to changes in these variables by calling addModule and nextPosition).

这篇关于静脉行人模拟(omnet ++/sumo)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆