huawei-noah / SMARTS

Scalable Multi-Agent RL Training School for Autonomous Driving

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Help Request] TraCI could not connect

DOPEMANdd opened this issue · comments

High Level Description

Traceback (most recent call last):
  File "train_ppo.py", line 81, in <module>
    state, dones = env.reset(), {"__all__": False}
  File "/data/zhangdi/anaconda3/envs/smart/lib/python3.8/site-packages/gymnasium/wrappers/order_enforcing.py", line 61, in reset
    return self.env.reset(**kwargs)
  File "/data/zhangdi/anaconda3/envs/smart/lib/python3.8/site-packages/gymnasium/core.py", line 453, in reset
    return self.env.reset(seed=seed, options=options)
  File "/data/zhangdi/smart_master/SMARTS/smarts/env/gymnasium/hiway_env_v1.py", line 348, in reset
    observations = self._smarts.reset(
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 471, in reset
    raise first_exception
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 464, in reset
    return self._reset(scenario, start_time)
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 501, in _reset
    self.setup(scenario)
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 539, in setup
    provider_state = self._setup_providers(self._scenario)
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 1230, in _setup_providers
    new_provider_state = self._handle_provider(provider, provider_error)
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 1265, in _handle_provider
    provider_state, recovered = provider.recover(
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/sumo_traffic_simulation.py", line 462, in recover
    raise error
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 1228, in _setup_providers
    new_provider_state = provider.setup(scenario)
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/sumo_traffic_simulation.py", line 324, in setup
    self._initialize_traci_conn()
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/sumo_traffic_simulation.py", line 239, in _initialize_traci_conn
    self._traci_conn.setOrder(0)
TypeError: 'NoneType' object is not callable
Exception ignored in: <function SafeBulletClient.__del__ at 0x7fd4b995cd30>
Traceback (most recent call last):
  File "/data/zhangdi/smart_master/SMARTS/smarts/core/utils/pybullet.py", line 52, in __del__
  File "/data/zhangdi/anaconda3/envs/smart/lib/python3.8/site-packages/pybullet_utils/bullet_client.py", line 43, in __del__
TypeError: catching classes that do not inherit from BaseException is not allowed

Version

v1.4.0

Operating System

No response

Problems

No response

Hello @DOPEMANdd, some progress. I have been looking deeper into the errors provided.

Error 1

I need a bit more information to address this bug.

File "/data/zhangdi/smart_master/SMARTS/smarts/core/sumo_traffic_simulation.py", line 239, in _initialize_traci_conn
self._traci_conn.setOrder(0)
TypeError: 'NoneType' object is not callable

Current patch

  • SMARTS will terminate with a better description if the TraCI or SUMO versions are incompatible.
  • engine.ini now allows configuration of how many times to retry the TraCI connection.
    • The [traffic] traci_retries .ini configuration or SMARTS_TRAFFIC_TRACI_RETRIES environment variable can be configured for more connection attempts if necessary.
  • If SMARTS cannot acquire a TraCI server it will be clear about it.

Error 2

I have included changes in this patch to make this error go away.

Exception ignored in: <function SafeBulletClient.del at 0x7fd4b995cd30>
Traceback (most recent call last):
File "/data/zhangdi/smart_master/SMARTS/smarts/core/utils/pybullet.py", line 52, in del
File "/data/zhangdi/anaconda3/envs/smart/lib/python3.8/site-packages/pybullet_utils/bullet_client.py", line 43, in del
TypeError: catching classes that do not inherit from BaseException is not allowed

Current patch

  • SafeBulletClient.__del__() now wraps the BulletClient.__del__() to prevent the bad error handling from escaping the method call.