Skip to content

Commit

Permalink
[Fix] Provider removes social agents at inappropriate time (#1886)
Browse files Browse the repository at this point in the history
* Fix issue where provider would remove social agents

* Fix type error.
  • Loading branch information
Gamenot authored Mar 1, 2023
1 parent 4095f3f commit ef3cdab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Copy and pasting the git commit messages is __NOT__ enough.
### Deprecated
### Fixed
- Missing neighborhood vehicle ids are now added to the `highway-v1` formatted observations.
- Stopped agent providers from removing social agents when they have no actor.
- Using `trip` in sstudio traffic generation no longer causes a durouter error.
### Removed
### Security
Expand Down
11 changes: 4 additions & 7 deletions smarts/core/agents_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import logging
import weakref
import warnings
from functools import lru_cache
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple

Expand Down Expand Up @@ -125,14 +126,10 @@ def perform_agent_actions(self, agent_actions: Dict[str, Any]):
self._remove_actors_without_actions(agent_actions)
agents_without_actors = agent_actions.keys() - self._my_agent_actors.keys()
if agents_without_actors:
self._log.error(
"actions specified for an agent without an actor: %s. Cleaning up social agents.",
agents_without_actors,
warnings.warn(
"actions specified for an agent without an actor: %s."
% agents_without_actors,
)
orphaned_social_agents = (
self._agent_manager.social_agent_ids & agents_without_actors
)
self._agent_manager.teardown_social_agents(orphaned_social_agents)

agent_manager = self._agent_manager
vehicle_index = self._vehicle_index
Expand Down

0 comments on commit ef3cdab

Please sign in to comment.