Creating an Agent

This section provides an overview of how to use the adf-core-python library.

Creating a New Agent

To create a new agent, run the following command:

adf-core-python

When executed, an interactive prompt like the one below will be displayed:

Your agent team name: my-agent
Creating a new agent team with name: my-agent

Note

The agent team name will be used as the directory name for the agent. Hereafter, the agent team name will be referred to as <your_team_name>.

After entering, an agent template like the one below will be created in the current directory.

.
└── my-agent
    ├── config
       ├── development.json
       ├── launcher.yaml
       └── module.yaml
    ├── main.py
    └── src
        └── my-agent
            ├── __init__.py
            └── module
                ├── __init__.py
                └── complex
                    ├── __init__.py
                    ├── sample_human_detector.py
                    ├── sample_road_detector.py
                    └── sample_search.py

Running the Simulation

Open two terminals.

Open one terminal and start the simulation server with the following command:

# Terminal A
cd WORKING_DIR/rcrs-server/scripts
./start-comprun.sh -m ../maps/tutorial_fire_brigade_only/map -c ../maps/tutorial_fire_brigade_only/config

Then, open another terminal and start the agent:

# Terminal B
cd WORKING_DIR/<your_team_name>
python main.py

When the agent starts successfully, it will connect to the simulation server, participate in the simulation, and start moving. If you want to stop it midway, press Ctrl + C (or Command + C on MacOS) in each command line.

Warning

After stopping the simulation server, run ./kill.sh as there may be remaining processes.