Open qichaow opened 2 years ago
The TraCI API already permits this (retrieving detector information as well as remote-control of signal states and phase). https://sumo.dlr.de/docs/Simulation/Traffic_Lights.html#controlling_traffic_lights_via_traci Hard-ware-in-the-loop-control has already been built via this interface for various controllers.
Which additional API methods would be useful for NEMA-in-the-loop?
The existing TraCI APIs are nice for stage-based control. I was imagine being able to set NEMA phase states by giving something like phase 2 and 6 are green or phase 1 is yellow while phase 5 is green.
The detector information would be nice to be retrieved in the form of "phase x,y,z are called." A potential example is "0,1,1,0,0,1,0,0" meaning phase 2, 3, and 6 are being called.
Both functions could be achieved with calling existing functions in NEMAController.h/cpp with some small edits.
We are doing this with standard Traci library, but something like @qichaow describes would be nice
in line with the existing NEMA-traci methods, how about trafficlight.setNemaPhase(tlsID, xyz) and trafficlight.getNemaDetectors(tlsID) ?
though I'm not sure what xyz should be. Something like ("2g6g", "1y5g") ?
trafficlight.setNemaPhase(tlsID,xyz) would be nice. trafficlight.getNemaDetectors(tlsID) can be called trafficlight.getNemaPhaseCalls(tlsID).
I planned to work on it tonight. Just want to put a note here and have something to refer to when submit the pull request. Let me know if you guys want to do it instead.
Add support to use external controllers to control the NEMA type controller and feed detector information back to external controllers via TraCI.