eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.51k stars 1.42k forks source link

Adding hardware-in-the-loop support for the NEMA type controller #9912

Open qichaow opened 2 years ago

qichaow commented 2 years ago

Add support to use external controllers to control the NEMA type controller and feed detector information back to external controllers via TraCI.

namdre commented 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?

qichaow commented 2 years ago

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.

mschrader15 commented 2 years ago

We are doing this with standard Traci library, but something like @qichaow describes would be nice

namdre commented 2 years ago

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") ?

qichaow commented 2 years ago

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.