cityflow-project / CityFlow

A Multi-Agent Reinforcement Learning Environment for Large Scale City Traffic Scenario
https://cityflow-project.github.io
Apache License 2.0
784 stars 171 forks source link

Error occurred when drawing #178

Closed BackMountainDevil closed 8 months ago

BackMountainDevil commented 8 months ago

firefox F12 console

Uncaught TypeError: trafficLightsG[tlEdge][j] is undefined
    drawStep http://localhost:8000/script.js:697
    <anonymous> http://localhost:8000/script.js:271
    EventListener.handleEvent* http://localhost:8000/script.js:258

wired things is that I can press button ] to continue to draw, but got more same errore as before

cityflow doc not show the meaning of file format of replay. I think that will help to debug

161 not help very much. my replayLog_hz.txt fileSize is 104MB.

BackMountainDevil commented 8 months ago

replay-hz.zip

BackMountainDevil commented 8 months ago

final reason: I use multiprocessing and use the same config file. Thus many processes save replay into the same log file, that leads to the render problem.

detail:

错误提示太少,找网页模拟器js源代码加更多输出

// 正常输出,根据代码推测,第一个是路名,后面的是灯的状态
tlLog: 
Array(4) [ "road_4_4_3", "r", "r", "g" ]
       tlEdge: road_4_4_3 j: 0 tlStatus: 
Array(3) [ "r", "r", "g" ]
tlLog: 
Array(4) [ "road_4_4_3", "r", "r", "g" ]
       tlEdge: road_4_4_3 j: 1 tlStatus: 
Array(3) [ "r", "r", "g" ]
tlLog: 
Array(4) [ "road_4_4_3", "r", "r", "g" ]
       tlEdge: road_4_4_3 j: 2 tlStatus: 
Array(3) [ "r", "r", "g" ]

// 异常步的输出,和前面不一样,前面的长度都是4,这个异常的输出长度为10。如果前面推测的第一个后面都是状态,说明这里出现了分割错误,或者在生成回放时发生了错误,在回放文件搜索 2308.8894999999998 -1.5707963267948966 flow_4050_0 就能在L40找到这一行,说明一行代表一个时间步
tlLog: 
Array(10) [ "road_5_1_2", "r", "r", "g798.0", "2308.8894999999998", "-1.5707963267948966", "flow_4050_0", "0", "5.0", "2.0" ]
       tlEdge: road_5_1_2 j: 3 tlStatus: 
Array(9) [ "r", "r", "g798.0", "2308.8894999999998", "-1.5707963267948966", "flow_4050_0", "0", "5.0", "2.0" ]

// 错误原因,trafficLightsG是个很长的对象,road_5_1_2 对应的数据有3条(编号0~2),所以当j=3时,就会出现undefined
TypeError: trafficLightsG[tlEdge][j] is undefined
josemanuelsannav commented 7 months ago

Hi man, im having some problems trying to use CityFlow , have you ever had the error : cannot open roadnet file loading roadnet file error! load config failed!

I would be very grateful if you could help me

BackMountainDevil commented 7 months ago

you should post at other issue.

for this err. reasons I tested:

  1. config file format err(most this)
  2. file missing

so advise post your config file content