About Modules
How to specify modules
To specify a module, write the module name and path in module.yaml.
For example, write as follows:
SampleSearch:
PathPlanning: src.<your_team_name>.module.complex.sample_search.SampleSearch
Clustering: src.<your_team_name>.module.complex.sample_search.SampleClustering
In this case, the modules PathPlanning
and Clustering
used in the SampleSearch
module are specified.
How to load modules
To load other modules within a module, write as follows:
from adf_core_python.core.agent.module.module_manager import ModuleManager
class SampleSearch(Search):
def __init__(
self,
agent_info: AgentInfo,
world_info: WorldInfo,
scenario_info: ScenarioInfo,
module_manager: ModuleManager,
develop_data: DevelopData,
) -> None:
super().__init__(
agent_info, world_info, scenario_info, module_manager, develop_data
)
# クラスタリングモジュールの取得
self._clustering: Clustering = cast(
# モジュールの型を指定
Clustering,
# モジュールの取得
module_manager.get_module(
# モジュールの名前
"DefaultSearch.Clustering",
# 上記のモジュールの名前が指定されていない場合のデフォルトのモジュールのパス
"adf_core_python.implement.module.algorithm.k_means_clustering.KMeansClustering",
),
)
# パスプランニングモジュールの取得
self._path_planning: PathPlanning = cast(
# モジュールの型を指定
PathPlanning,
# モジュールの取得
module_manager.get_module(
# モジュールの名前
"DefaultSearch.PathPlanning",
# 上記のモジュールの名前が指定されていない場合のデフォルトのモジュールのパス
"adf_core_python.implement.module.algorithm.a_star_path_planning.AStarPathPlanning",
),
)
# モジュールの登録(これをしないと、モジュール内のシミュレーション環境の情報が更新されません)
self.register_sub_module(self._clustering)
self.register_sub_module(self._path_planning)
About the types of modules
The following modules are provided in adf-core-python.
Class |
Role |
---|---|
TacticsFireBrigade |
Module call for fire brigade (cannot be changed in competition) |
TacticsPoliceForce |
Module call for police force (cannot be changed in competition) |
TacticsAmbulanceTeam |
Module call for ambulance team (cannot be changed in competition) |
BuildingDetector |
Selection of activity target for fire brigade |
RoadDetector |
Selection of activity target for police force |
HumanDetector |
Selection of activity target for ambulance team |
Search |
Selection of activity target for information search |
PathPlanning |
Path Planning |
DynamicClustering |
Clustering that changes as the simulation progresses |
StaticClustering |
Clustering that is determined at the start of the simulation |
ExtAction |
Determination of agent actions after selecting the activity target |
MessageCoordinator |
Distribution of messages to channels, which are the routes for sending messages (information) via communication |
ChannelSubscriber |
Selection of channels to receive messages via communication |
When creating a module with a role other than the above, inherit AbstractModule
.