Checking in the TraCICommandInterface there are only two function for the traffic lights. The first one is setProgram
and the other one is setPhaseIndex
how can I write the get functions for them?
Asked
Active
Viewed 165 times
1

pb772
- 539
- 1
- 3
- 14
-
3StackOverflow is all about collecting good answers to (good) questions. If you were able to find a good answer yourself, feel free to add it below. – Christoph Sommer Mar 10 '17 at 08:30
1 Answers
2
In TraCICommandInterface.h: insert the following functions definitions under traffic light methods:
// Trafficlight methods
std::string getProgram();
int getPhaseIndex();
In TraCICommandInterface.cc: insert the following functions declarations:
std::string TraCICommandInterface::Trafficlight::getProgram() {
return traci->genericGetString(CMD_GET_TL_VARIABLE, trafficLightId, TL_CURRENT_PROGRAM,RESPONSE_GET_TL_VARIABLE);
}
and
int TraCICommandInterface::Trafficlight::getPhaseIndex() {
return traci->genericGetInt(CMD_GET_TL_VARIABLE, trafficLightId, TL_CURRENT_PHASE,RESPONSE_GET_TL_VARIABLE);
}

pb772
- 539
- 1
- 3
- 14