我正在尝试在 omnet++ 中运行相扑行人模拟。为了保持简单(我是初学者)我决定使用Erlangen示例提供了静脉并用几个行人扩展它。我添加了相扑中的行人并运行它。它工作得很好:你可以看到这张照片中的行人和汽车
接下来我尝试在 omnet++ 中运行整个过程。我也设法做到了这一点,但没有显示行人。只是汽车。我读了这两个主题:
- Veins 中汽车和行人之间的通信
- 静脉 多种车辆类型的多种应用
并将这些行添加到omnetpp.ini示例的:
*.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”。然后我再次运行整个过程,但除了汽车的图像(如模拟所示)变为灰色框之外,没有任何变化。
为什么没有显示行人? (我错过了什么?)
我是否必须告诉静脉(或相扑)将行人位置传达给 omnet++?
为什么模拟中的汽车图标变成了灰色方框?
以下是我添加/修改的文件:
Edit:
我研究了TraCI 定义并调试了【静脉源代码】。我发现这些行完成订阅的代码:
{
// 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());
}
我将其与相扑维基上的 TraCI 文档进行了比较:
* 模拟订阅的第一个区块:https://sumo.dlr.de/wiki/TraCI/Simulation_Value_Retrieval
* 车辆订阅的第二段代码: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).
我在进行个人订阅的静脉源代码中遗漏了什么吗?
甚至可以订阅 TraCI 中的人员吗?