Skip to content

Commit

Permalink
Fix the teleport issue for BM (huawei-noah#442)
Browse files Browse the repository at this point in the history
* Fix the teleport issue for BM

* Put traffic.destroy after agent_manger.destroy
  • Loading branch information
iman512003 authored Jan 19, 2021
1 parent a24b5c4 commit 96b1119
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions smarts/core/smarts.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ def destroy(self):
self._visdom.teardown()

self._agent_manager.destroy()
self._traffic_sim.destroy()
self._bullet_client.disconnect()

super().destroy()
Expand Down
9 changes: 3 additions & 6 deletions smarts/core/sumo_traffic_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ def __init__(
self._to_be_teleported = dict()
self._reserved_areas = dict()

atexit.register(self._destroy)

def __repr__(self):
return f"""SumoTrafficSim(
_scenario={repr(self._scenario)},
Expand All @@ -108,11 +106,10 @@ def __repr__(self):
def __str__(self):
return repr(self)

def _destroy(self):
if atexit:
atexit.unregister(self._destroy)

def destroy(self):
self._close_traci_and_pipes()
if not self._is_setup:
return
self._sumo_proc.terminate()
self._sumo_proc.wait()

Expand Down

0 comments on commit 96b1119

Please sign in to comment.