简体   繁体   English

omn​​et ++ / veins:某些sumo / traci命令似乎未实现

[英]omnet++/veins : some sumo/traci commands seem to be not implemented

I would like to use some sumo/traci commands that seem to be not implemented in omnet++/veins, such as : 我想使用一些omnet ++ / veins中似乎未实现的sumo / traci命令,例如:

  • traffic light commands setRedYellowGreenState(tlsID, state) for example 例如,交通信号灯命令setRedYellowGreenState(tlsID,state)
  • junction command 连接命令
  • and other commands 和其他命令

What is the simplest way to be able to use these commands from omnet++/veins? 能够从omnet ++ / veins使用这些命令的最简单方法是什么?

Thank you very much for the help. 非常感谢你的帮助。 Regards :) 问候 :)

You can find the existing client source code for interacting with SUMO in TraCICommandInterface.cc, for example to set a TL program : 您可以在TraCICommandInterface.cc中找到用于与SUMO交互的现有客户端源代码,例如,设置TL程序

TraCIBuffer buf = connection->query(CMD_SET_TL_VARIABLE, TraCIBuffer()
  << static_cast<uint8_t>(TL_PROGRAM) 
  << trafficLightId 
  << static_cast<uint8_t>(TYPE_STRING)
  << program
);

The corresponding server source code can be found in TraCIServerAPI_TLS.cpp, for example to set a TL program : 可以在TraCIServerAPI_TLS.cpp中找到相应的服务器源代码,例如以设置TL程序

// variable & id
int variable = inputStorage.readUnsignedByte();
std::string id = inputStorage.readString();
// [...] case TL_PROGRAM:
server.readTypeCheckingString(inputStorage, subID)

vars.switchTo(tlsControl, subID);

By investigating how the server is prepared to interact with the client (and how the client is already interacting with the server) you should be able to extend the client according to your wishes. 通过研究服务器如何准备与客户端交互(以及客户端如何与服务器交互),您应该能够根据自己的意愿扩展客户端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM