LucasAlegre / sumo-rl

Reinforcement Learning environments for Traffic Signal Control with SUMO. Compatible with Gymnasium, PettingZoo, and popular RL libraries.
https://lucasalegre.github.io/sumo-rl
MIT License
746 stars 201 forks source link

change 4*4 grid to 8*8 grid, can't work. #180

Closed FanFan2021 closed 11 months ago

FanFan2021 commented 11 months ago

Hi Lucas,

Happy New Year!

I want to extend grid 44 to grid 88. I generated grid 88 environment, then I changed the file path in ql_44grid.py and ran it. However, I got an empty list instead of signal ids from the following code in env.py self.ts_ids = list(conn.trafficlight.getIDList())

I'm wondering if this problem comes from an error in generating the 8x8 grid environment, or perhaps I've overlooked a crucial step. Do you have any ideas on what might cause this problem?

Thank you so much, I am looking forward to your reply.

LucasAlegre commented 11 months ago

Hi @FanFan2021 ,

Happy new year!

You have to create traffic lights on your .net for it to work. Sumo-rl expects the network to have traffic lights that it can control.

FanFan2021 commented 11 months ago

Hi Lucas,

I use the following command to generate net.xml: netgenerate --grid --grid.x-number=8 --grid.y-number=8 --grid.x-length=20 --grid.y-length=20 --tls.guess=True --output-file=grid8x8.net.xml

Then generate rou.xml: python tools/randomTrips.py -n grid8x8.net.xml --route-file "./grid8x8/grid8x8_${i}.rou.xml"

Finally, just change your grid4x4.sumocfg to grid8x8.sumocfg

But I still got empty list from self.ts_ids = list(conn.trafficlight.getIDList())

Did I create traffic lights on .net correctly?