About Modules#

How to Specify Modules#

To specify a module, write its name and path in module.yaml.

For example, write it 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 PathPlanning and Clustering modules used by the SampleSearch module are specified.

How to Load Modules#

When loading another module within a module, write it 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 Module Types#

The following modules are provided in adf-core-python.

Class

Role

TacticsFireBrigade

Module invocation for the fire brigade (cannot be changed during competition)

TacticsPoliceForce

Module invocation for the police force (cannot be changed during competition)

TacticsAmbulanceTeam

Module invocation for the ambulance team (cannot be changed during competition)

BuildingDetector

Selecting the fire brigade’s activity target

RoadDetector

Selecting the police force’s activity target

HumanDetector

Selecting the ambulance team’s activity target

Search

Selecting activity targets for information search

PathPlanning

Path planning

DynamicClustering

Clustering in which clusters change as the simulation progresses

StaticClustering

Clustering in which clusters are determined at the start of the simulation

ExtAction

Determining the agent’s behavior after the activity target is decided

MessageCoordinator

Distributing messages to channels, which are the paths used to send messages (information) by communication

ChannelSubscriber

Selecting channels that receive messages via communication

If you create a module for a role other than those listed above, inherit from AbstractModule.