简体   繁体   中英

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 :

  • traffic light commands setRedYellowGreenState(tlsID, state) for example
  • junction command
  • and other commands

What is the simplest way to be able to use these commands from 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 :

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 :

// 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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