LucasAlegre/sumo-rl

Issue when running a custom environment

Mehdi-Inane opened this issue · 4 comments

Hello,

I am running your sarsa_resco.py code with a custom environment, representing downtown Athens so around 30-40 traffic lights. When I added the custom environment to the simulation, I get the following error, right after the first actions are decided :
Error: Invalid empty condition ''06.45UPS, TraCI: 1568ms, vehicles TOT 242 ACT 242 BUF 608
Quitting (on error).
Traceback (most recent call last):
File "/mnt/c/users/inane/Downloads/sumo-rl/experiments/sarsa_resco.py", line 181, in
fire.Fire(run)
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/fire/core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/fire/core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "/mnt/c/users/inane/Downloads/sumo-rl/experiments/sarsa_resco.py", line 171, in run
next_obs, r, done,terminated, info = env.step(actions=actions)
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/pettingzoo/utils/conversions.py", line 191, in step
self.aec_env.step(actions[agent])
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/pettingzoo/utils/wrappers/order_enforcing.py", line 81, in step
super().step(action)
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/pettingzoo/utils/wrappers/base.py", line 116, in step
self.env.step(action)
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/pettingzoo/utils/wrappers/assert_out_of_bounds.py", line 29, in step
super().step(action)
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/pettingzoo/utils/wrappers/base.py", line 116, in step
self.env.step(action)
File "/mnt/c/users/inane/Downloads/sumo-rl/sumo_rl/environment/env.py", line 587, in step
self.env._run_steps()
File "/mnt/c/users/inane/Downloads/sumo-rl/sumo_rl/environment/env.py", line 328, in _run_steps
self._sumo_step()
File "/mnt/c/users/inane/Downloads/sumo-rl/sumo_rl/environment/env.py", line 403, in _sumo_step
self.sumo.simulationStep()
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/traci/connection.py", line 366, in simulationStep
result = self._sendCmd(tc.CMD_SIMSTEP, None, None, "D", step)
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/traci/connection.py", line 228, in _sendCmd
return self._sendExact()
File "/home/mehdi_inane/anaconda3/lib/python3.9/site-packages/traci/connection.py", line 137, in _sendExact
raise FatalTraCIError("connection closed by SUMO")
traci.exceptions.FatalTraCIError: connection closed by SUMO

Do you have an idea of where this error came from ? I have a code for a single agent but it works just fine with the parameters I have.

Unfortunately, this error message from Traci is not very informative :/ Would you mind sharing the code?

The code is the same as yours, the only thing I added is a definition for my environment in resco_envs.py : def athens100(parallel = True, **kwargs):
sumo_path = '../../../OneDrive/Bureau/DQN-ITSCwPD/env/custom_env/data/SUMO_1/'
kwargs.update(
{
"net_file": sumo_path + "updated_net.xml",
"route_file": sumo_path + "duaroutes_filtered_sorted.rou.alt.xml",
"begin_time": 0,
"num_seconds": 3600,
}
)
if parallel:
return parallel_env(**kwargs)
else:
return env(**kwargs)
and I have attached the net and route files in the following link https://we.tl/t-wAjHaHZXrs
I am then running the sarsa_resco.py code, the reset works but as soon as the step function is executed, some issue arise with tracI when simulationStep is called.

Hi @Mehdi-Inane

Does your simulation run without errors when you ran it without sumo-rl?

Without any tracI interfacing the simulation runs on the SUMO GUI, and also while interfacing with tracI when I control a single traffic light. I could not find a way to debug this : I tried tracking the actions done by the traffic lights and all of them are valid, and I haven't found a bug of this sort on other forums. Did you already have a problem similar to this when running sumo-rl on large traffic scenarios ?