Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions adf_core_python/core/agent/agent.py

This file was deleted.

5 changes: 3 additions & 2 deletions adf_core_python/core/agent/config/module_config.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,11 +79,12 @@ def _flatten(
dict[str, Any]
Flattened dictionary
"""
flatten_data = {}
flatten_data: dict[str, Any] = {}
for key, value in data.items():
new_key = f"{parent_key}{sep}{key}" if parent_key else key
if isinstance(value, dict):
flatten_data.update(self._flatten(value, new_key, sep=sep))
v: dict[str, Any] = value
flatten_data.update(self._flatten(v, new_key, sep=sep))
else:
flatten_data[new_key] = value
return flatten_data
7 changes: 5 additions & 2 deletions adf_core_python/core/agent/info/agent_info.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,8 +2,11 @@
from typing import Any

from rcrs_core.agents.agent import Agent
from rcrs_core.entities.entity import Entity
from rcrs_core.entities.human import Human
from rcrs_core.worldmodel.worldmodel import ChangeSet, Entity, EntityID, WorldModel
from rcrs_core.worldmodel.changeSet import ChangeSet
from rcrs_core.worldmodel.entityID import EntityID
from rcrs_core.worldmodel.worldmodel import WorldModel

from adf_core_python.core.agent.action.action import Action

Expand DownExpand Up@@ -97,7 +100,7 @@ def get_position_entity_id(self) -> EntityID:
"""
entity = self._world_model.get_entity(self.get_entity_id())
if isinstance(entity, Human):
return entity.get_position_property()
return entity.get_position()
else:
return entity.get_id()

Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,21 +111,23 @@ def think(
entity_id = agent_info.get_entity_id() # noqa: F841

target_entity_id = self._human_detector.calculate().get_target_entity_id()
action = (
self._action_transport.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action
if target_entity_id is not None:
action = (
self._action_transport.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action

target_entity_id = self._search.calculate().get_target_entity_id()
action = (
self._action_ext_move.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action
if target_entity_id is not None:
action = (
self._action_ext_move.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action

return ActionRest()
30 changes: 16 additions & 14 deletions adf_core_python/implement/tactics/default_tactics_fire_brigade.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,21 +110,23 @@ def think(
entity_id = agent_info.get_entity_id() # noqa: F841

target_entity_id = self._human_detector.calculate().get_target_entity_id()
action = (
self._action_fire_rescue.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action
if target_entity_id is not None:
action = (
self._action_fire_rescue.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action

target_entity_id = self._search.calculate().get_target_entity_id()
action = (
self._action_ext_move.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action
if target_entity_id is not None:
action = (
self._action_ext_move.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action

return ActionRest()
30 changes: 16 additions & 14 deletions adf_core_python/implement/tactics/default_tactics_police_force.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,21 +114,23 @@ def think(
entity_id = agent_info.get_entity_id() # noqa: F841

target_entity_id = self._road_detector.calculate().get_target_entity_id()
action = (
self._action_ext_clear.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action
if target_entity_id is not None:
action = (
self._action_ext_clear.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action

target_entity_id = self._search.calculate().get_target_entity_id()
action = (
self._action_ext_clear.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action
if target_entity_id is not None:
action = (
self._action_ext_clear.set_target_entity_id(target_entity_id)
.calc()
.get_action()
)
if action is not None:
return action

return ActionRest()
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pyrightconfig.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
{
"typeCheckingMode": "standard",
"exclude": ["**/site-packages"]
}