You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PY2D Soccer Simulation Base Code is a base code for RoboCup 2D Soccer Simulation teams, which is written in Python.
13
13
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.
14
14
This base code uses `Helios Base` as a proxy to communicate with the RoboCup 2D Soccer Simulation server.
@@ -18,14 +18,16 @@ For more information, please refer to the [documentation](https://clsframework.g
18
18
19
19
You can find more information about the services and messages in the [IDL section](../../3-idl/protobuf.md).
20
20
21
+
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.
22
+
21
23
## Quick start
22
24
23
25
### Preparation
24
26
25
27
Install the pre-requisites using the command below:
26
28
27
29
```Bash
28
-
sudo apt-get install fuse #Used to run AppImages
30
+
sudo apt-get install fuse #Used to run AppImages (Proxy, Monitor and RoboCup Server)
29
31
```
30
32
31
33
Clone this repository & install the required python libraries (such as gRPC). Don't forget to activate your virtual environment!
@@ -59,49 +61,102 @@ Finally, to watch the game, download the monitor from [the original repository](
59
61
60
62
### Running a game
61
63
62
-
This section assumes you have installed the server & proxy using the scripts (as mentioned above)
64
+
This section assumes you have installed the server & proxy using the scripts (as mentioned above).
65
+
66
+
To run a game, you must first run the RoboCup Soccer Server, then your team and opponent team, and finally the monitor.
67
+
63
68
We must first run a RoboCup Server, in order to host the game:
64
69
70
+
| Running the RoboCup Soccer Server
71
+
65
72
```Bash
66
73
cd scripts/rcssserver
67
74
./rcssserver
68
75
```
69
76
70
-
Then we must run the proxy & the decisionmaking server:
77
+
| Running your team
78
+
79
+
We must run the proxy, and rpc server, you can run `start.py` or `start.sh` to run both the proxy and the server.
71
80
72
81
```Bash
73
-
./start.sh
74
-
// or
75
82
python3 start.py
83
+
// or
84
+
./start.sh
76
85
```
77
86
78
-
### Options
87
+
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.
79
88
80
-
-`-t team_name`: Specify the team name.
81
-
-`--rpc-port PORT`: Specify the RPC port (default: 50051).
82
-
-`-d`: Enable debug mode.
89
+
| Running the opponent team
83
90
91
+
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:
84
92
85
-
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!
93
+
```Bash
94
+
cd CYRUS_SS2D_RC2023_D4_BIN/bin
95
+
./start.sh
96
+
```
86
97
87
-
### Tutorial Video (English)
98
+
| Running the monitor
88
99
89
-
[](https://www.youtube.com/watch?v=hH-5rkhiQHg)
100
+
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!
90
101
91
-
### Tutorial Video (Persian)
102
+
### start.py Arguments
92
103
93
-
[](https://www.youtube.com/watch?v=97YDEumcVWU&t=0s)
104
+
##### Team and Name Customization
94
105
95
-
## How to change the code
106
+
| Argument | Short | Description | Default Value |
|`--team_name`|`-t`| The name of the team. |`CLS`|
109
+
|`--use-random-name`|| Use a randomly generated team name. |`False`|
96
110
97
-
The `server.py` file contains the logic in 3 main functions:
98
-
`GetPlayerActions` receives a game state, and returns a list of actions for a player for for that cycle.
99
-
The actions we can output are equivalent to the Helios Base (Proxy), which are abstracted into multiple levels.
100
-
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
+
---
112
+
113
+
##### RPC Server Configuration
114
+
115
+
| Argument | Short | Description | Default Value |
|`--rpc-port`|| The port used by the RPC server. |`50051`|
118
+
|`--use-random-rpc-port`|| Use a randomly assigned port for the RPC server. |`False`|
119
+
|`--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`|
120
+
|`--auto-close-rpc-server`|| Automatically close the RPC server after finishing agent processing. |`False`|
121
+
122
+
---
101
123
102
-
Similarly, you can change `GetCoachActions` which is responsible for coach communication & substitutions.
124
+
##### RoboCup Soccer Server Configuration
103
125
104
-
You can also use `GetTrainerActions` to move the players & the ball to make repeatable scenarios (when the server is in trainer mode).
126
+
| Argument | Short | Description | Default Value |
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.
135
189
136
-
## Configuration
190
+
## Other Solutions To Run The Base Code
191
+
192
+
TODO
193
+
194
+
## Create Binary
195
+
196
+
TODO
197
+
198
+
## Test Performance by using AutoTest
137
199
138
-
### RoboCup Server configuration
200
+
TODO
139
201
140
-
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.
202
+
## How to improve the performance of the team
141
203
142
-
### Modifying Proxy & Running proxy and server seperately
204
+
TODO
143
205
144
-
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.
206
+
## Documentation
145
207
146
-
You can modify the rpc port by adding the argument `--rpc-port [VALUE]`, where the default is 50051.
0 commit comments