Skip to content

Commit 0e47168

Browse files
committed
Update README.md to enhance clarity and add missing instructions for running the base code
1 parent e2c4d08 commit 0e47168

File tree

1 file changed

+91
-29
lines changed

1 file changed

+91
-29
lines changed

README.md

Lines changed: 91 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# PY2D Base Code
22

3-
43
[![Documentation Status](https://readthedocs.org/projects/clsframework/badge/?version=latest)](https://clsframework.github.io/docs/introduction/)
54
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
65

76
![alt text](image.png)
7+
88
PY2D Soccer Simulation Base Code is a base code for RoboCup 2D Soccer Simulation teams, which is written in Python.
99
This base code is powered by the [Cross Language Soccer Framework](https://arxiv.org/pdf/2406.05621), which allows you to create a team by using any programming language that supports gRPC or Thrift.
1010
This base code uses `Helios Base` as a proxy to communicate with the RoboCup 2D Soccer Simulation server.
@@ -14,14 +14,16 @@ For more information, please refer to the [documentation](https://clsframework.g
1414

1515
You can find more information about the services and messages in the [IDL section](../../3-idl/protobuf.md).
1616

17+
there are many different ways to run the base code, in the next section, we will explain the easiest way to run the base code.
18+
1719
## Quick start
1820

1921
### Preparation
2022

2123
Install the pre-requisites using the command below:
2224

2325
``` Bash
24-
sudo apt-get install fuse #Used to run AppImages
26+
sudo apt-get install fuse #Used to run AppImages (Proxy, Monitor and RoboCup Server)
2527
```
2628

2729
Clone this repository & install the required python libraries (such as gRPC). Don't forget to activate your virtual environment!
@@ -55,49 +57,102 @@ Finally, to watch the game, download the monitor from [the original repository](
5557

5658
### Running a game
5759

58-
This section assumes you have installed the server & proxy using the scripts (as mentioned above)
60+
This section assumes you have installed the server & proxy using the scripts (as mentioned above).
61+
62+
To run a game, you must first run the RoboCup Soccer Server, then your team and opponent team, and finally the monitor.
63+
5964
We must first run a RoboCup Server, in order to host the game:
6065

66+
| Running the RoboCup Soccer Server
67+
6168
``` Bash
6269
cd scripts/rcssserver
6370
./rcssserver
6471
```
6572

66-
Then we must run the proxy & the decisionmaking server:
73+
| Running your team
74+
75+
We must run the proxy, and rpc server, you can run `start.py` or `start.sh` to run both the proxy and the server.
6776

6877
``` Bash
69-
./start.sh
70-
// or
7178
python3 start.py
79+
// or
80+
./start.sh
7281
```
7382

74-
### Options
83+
This script, by default, will run a gRPC server on port 50051, and 12 proxy agents (11 players and 1 coach). In each cycle of the game, the soccer server sends the state of the game to the proxy, which processes the state, creates state message and sends it to the rpc server. The rpc server receives the state message, processes it, and sends the actions to the proxy. The proxy receives the actions, processes them, and sends the commands to the soccer server.
7584

76-
- `-t team_name`: Specify the team name.
77-
- `--rpc-port PORT`: Specify the RPC port (default: 50051).
78-
- `-d`: Enable debug mode.
85+
| Running the opponent team
7986

87+
You can download an opponent team binary from the [RoboCup Soccer Simulation Repository](https://archive.robocup.info/Soccer/Simulation/2D/binaries/RoboCup/) for example `CYRUS` team from [here](https://archive.robocup.info/Soccer/Simulation/2D/binaries/RoboCup/2023/Day4/CYRUS_SS2D_RC2023_D4_BIN.tar.gz). After extracting the binary, you can run the team using the command below:
8088

81-
Launch the opponent team, start the monitor app image. press <kbd>Ctrl</kbd> + <kbd>C</kbd> to connect to the server, and <kbd>Ctrl</kbd> + <kbd>K</kbd> for kick-off!
89+
``` Bash
90+
cd CYRUS_SS2D_RC2023_D4_BIN/bin
91+
./start.sh
92+
```
8293

83-
### Tutorial Video (English)
94+
| Running the monitor
8495

85-
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/hH-5rkhiQHg/0.jpg)](https://www.youtube.com/watch?v=hH-5rkhiQHg)
96+
To watch the game, you must run the rcssmonitor or soccerwindow2. press <kbd>Ctrl</kbd> + <kbd>C</kbd> to connect to the server, and <kbd>Ctrl</kbd> + <kbd>K</kbd> for kick-off!
8697

87-
### Tutorial Video (Persian)
98+
### start.py Arguments
8899

89-
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/97YDEumcVWU/0.jpg)](https://www.youtube.com/watch?v=97YDEumcVWU&t=0s)
100+
##### Team and Name Customization
101+
102+
| Argument | Short | Description | Default Value |
103+
|---------------------------|-------|------------------------------------------------------------------|-----------------|
104+
| `--team_name` | `-t` | The name of the team. | `CLS` |
105+
| `--use-random-name` | | Use a randomly generated team name. | `False` |
106+
107+
---
90108

91-
## How to change the code
109+
##### RPC Server Configuration
92110

93-
The `server.py` file contains the logic in 3 main functions:
94-
`GetPlayerActions` receives a game state, and returns a list of actions for a player for for that cycle.
95-
The actions we can output are equivalent to the Helios Base (Proxy), which are abstracted into multiple levels.
96-
You can use actions such as `DoDash`, `DoTurn`, `DoKick` which directly apply force, or use actions such as `GoToPoint`, `SmartKick`, `Shoot` or [more](https://clsframework.github.io/docs/idl/).
111+
| Argument | Short | Description | Default Value |
112+
|---------------------------|-------|------------------------------------------------------------------|-----------------|
113+
| `--rpc-port` | | The port used by the RPC server. | `50051` |
114+
| `--use-random-rpc-port` | | Use a randomly assigned port for the RPC server. | `False` |
115+
| `--use-different-rpc-port`| | Use a different port for the RPC server (useful for multi-server setups). By using this option, the script will run a rpc server for each agents| `False` |
116+
| `--auto-close-rpc-server` | | Automatically close the RPC server after finishing agent processing. | `False` |
97117

98-
Similarly, you can change `GetCoachActions` which is responsible for coach communication & substitutions.
118+
---
99119

100-
You can also use `GetTrainerActions` to move the players & the ball to make repeatable scenarios (when the server is in trainer mode).
120+
##### RoboCup Soccer Server Configuration
121+
122+
| Argument | Short | Description | Default Value |
123+
|---------------------------|-------|------------------------------------------------------------------|-----------------|
124+
| `--server-host` | | The host of the RoboCup Soccer server. | `localhost` |
125+
| `--server-port` | | The port of the RoboCup Soccer server. | `6000` |
126+
127+
---
128+
129+
##### Agent Proxies
130+
131+
| Argument | Short | Description | Default Value |
132+
|---------------------------|-------|------------------------------------------------------------------|-----------------|
133+
| `--player` | | Run a proxy for a single player agent. | `False` |
134+
| `--coach` | | Run a proxy for a single coach agent. | `False` |
135+
| `--goalie` | | Run a proxy for a single goalie agent. | `False` |
136+
| `--debug` | `-d` | Enable debug mode for the agents. | `False` |
137+
138+
---
139+
140+
##### Debug and Logging Options
141+
142+
| Argument | Short | Description | Default Value |
143+
|---------------------------|-------|------------------------------------------------------------------|-----------------|
144+
| `--disable-log-file` | | Disable logging to a file. | `False` |
145+
| `--log-dir` | | The directory where logs are stored. If not provided, logs are stored in the default directory with a timestamp. | `None` |
146+
147+
---
148+
149+
### CLSF Tutorial Video (English)
150+
151+
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/hH-5rkhiQHg/0.jpg)](https://www.youtube.com/watch?v=hH-5rkhiQHg)
152+
153+
### CLSF Tutorial Video (Persian)
154+
155+
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/97YDEumcVWU/0.jpg)](https://www.youtube.com/watch?v=97YDEumcVWU&t=0s)
101156

102157
## Why & How it works
103158

@@ -126,20 +181,27 @@ sequenceDiagram
126181
SP->>SS: Commands
127182
```
128183

129-
![cls](https://github.com/user-attachments/assets/4daee216-1479-4acd-88f2-9e772b8c7837)
130184
As seen in the figure, the proxy handles connecting to the server, receiving sensor information and creating a world-model, and finds the action to take via a remote procedure call to a decision-making server, which is this repository.
131185

132-
## Configuration
186+
## Other Solutions To Run The Base Code
187+
188+
TODO
189+
190+
## Create Binary
191+
192+
TODO
193+
194+
## Test Performance by using AutoTest
133195

134-
### RoboCup Server configuration
196+
TODO
135197

136-
You can change the configuration of the RoboCup server and change parameters such as players' stamina, game length, field length, etc. by modifying `~/.rcssserver/server.conf`. Refer to the server's documents and repo for a more detailed guide.
198+
## How to improve the performance of the team
137199

138-
### Modifying Proxy & Running proxy and server seperately
200+
TODO
139201

140-
If you want to modify the algorithms of the base (such as ball interception, shooting, localization, etc.) you must modify the code of the [proxy repo](https://github.com/CLSFramework/soccer-simulation-proxy). After re-building from source, you can run the proxy by using `./start.sh --rpc-type grpc` in the bin folder of the proxy, and run the gRPC server with `python3 server.py` in this repo's directory. It is highly recommended to launch the python server before the proxy.
202+
## Documentation
141203

142-
You can modify the rpc port by adding the argument `--rpc-port [VALUE]`, where the default is 50051.
204+
TODO
143205

144206
## Citation
145207

0 commit comments

Comments
 (0)