Skip to content

Commit cd5eaa3

Browse files
committed
Merge branch 'develop_sadra'
2 parents cc84b0b + 729fcd9 commit cd5eaa3

File tree

8 files changed

+327
-139
lines changed

8 files changed

+327
-139
lines changed

docs/0-introduction/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Developing a base code for each language is a time-consuming task that requires
5454

5555
To overcome these challenges, the CLSFramework can denoise information, create models, and send them to the PlayMaker-Server. The PlayMaker-Server can be developed in any language supported by gRPC and is responsible for making decisions and sending actions to the SoccerSimulationProxy, which then sends the actions to the RCSSServer. This approach simplifies the development process and allows for more efficient implementation of the required functionalities.
5656

57-
## Work floW
57+
## Workflow
5858

5959
```mermaid
6060
sequenceDiagram

docs/2-sampleserver/sample-python-base-code/index.md renamed to docs/2-sampleserver/0-sample-python-base-code-gRPC/index.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,18 @@ Then we must run the proxy & the decisionmaking server:
6666
./start-team.sh
6767
```
6868

69+
### Options
70+
71+
- `-t team_name`: Specify the team name.
72+
- `--rpc-port PORT`: Specify the RPC port (default: 50051).
73+
- `-d`: Enable debug mode.
74+
75+
6976
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!
7077

7178
### Tutorial Video (English)
7279

73-
TDB
80+
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/hH-5rkhiQHg/0.jpg)](https://www.youtube.com/watch?v=hH-5rkhiQHg)
7481

7582
### Tutorial Video (Persian)
7683

@@ -132,4 +139,4 @@ You can modify the rpc port by adding the argument `--rpc-port [VALUE]`, where t
132139
## Citation
133140

134141
- [Cross Language Soccer Framework](https://arxiv.org/pdf/2406.05621)
135-
- Zare, N., Sayareh, A., Sadraii, A., Firouzkouhi, A. and Soares, A., 2024. Cross Language Soccer Framework: An Open Source Framework for the RoboCup 2D Soccer Simulation. arXiv preprint arXiv:2406.05621.
142+
- Zare, N., Sayareh, A., Sadraii, A., Firouzkouhi, A. and Soares, A., 2024. Cross Language Soccer Framework: An Open Source Framework for the RoboCup 2D Soccer Simulation. arXiv preprint arXiv:2406.05621.
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Sample Python Base Code (thrift)
2+
3+
[![Documentation Status](https://readthedocs.org/projects/clsframework/badge/?version=latest)](https://clsframework.github.io/docs/introduction/)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
6+
This repository contains a sample decision-making server for the RoboCup 2D Soccer Simulation, which allows you to create a team by using Python. This server is compatible with the [Cross Language Soccer Framework](https://arxiv.org/pdf/2406.05621). This server is written in Python and uses thrift to communicate with the [proxy](https://github.com/CLSFramework/soccer-simulation-proxy).
7+
8+
The Soccer Simulation Server sends the observations to the proxy, which processes the data, create state message and sends it to the decision-making server. The decision-making server then sends the actions to the proxy, and then the proxy convert actions to the server commands and sends them to the server.
9+
10+
For more information, please refer to the [documentation](https://clsframework.github.io/).
11+
12+
## Quick start
13+
14+
### Preparation
15+
16+
Install the pre-requisites using the command below:
17+
18+
``` Bash
19+
sudo apt-get install fuse #Used to run AppImages
20+
```
21+
22+
Clone this repository & install the required python libraries (such as thrift). Don't forget to activate your virtual environment!
23+
24+
``` Bash
25+
git clone https://github.com/CLSFramework/sample-playmaker-server-python-thrift.git
26+
cd sample-playmaker-server-python-thrift
27+
# Activate venv/anaconda before this step!
28+
pip install -r requirements.txt
29+
30+
./generate.sh # Generate the thrift files
31+
```
32+
33+
To download RoboCup Soccer 2D Server using the commands below:
34+
35+
``` Bash
36+
pushd scripts
37+
sh download-rcssserver.sh # Download the soccer simulation server
38+
popd
39+
```
40+
41+
Next, download the soccer proxy, which uses C++ to read and pre-processes state data and passes them to the Python server (this project) for decision-making.
42+
43+
``` Bash
44+
pushd scripts
45+
sh download-proxy.sh #install C++ proxy
46+
popd
47+
```
48+
49+
Finally, to watch the game, download the monitor from [the original repository](https://github.com/rcsoccersim/rcssmonitor/releases) in order to view the games.
50+
51+
### Running a game
52+
53+
This section assumes you have installed the server & proxy using the scripts (as mentioned above)
54+
We must first run a RoboCup Server, in order to host the game:
55+
56+
``` Bash
57+
cd scripts/rcssserver
58+
./rcssserver
59+
```
60+
61+
Then we must run the proxy & the decisionmaking server:
62+
63+
``` Bash
64+
./start-team.sh
65+
```
66+
67+
### Options
68+
69+
- `-t team_name`: Specify the team name.
70+
- `--rpc-port PORT`: Specify the RPC port (default: 50051).
71+
- `-d`: Enable debug mode.
72+
73+
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!
74+
75+
### Tutorial Video (English)
76+
77+
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/hH-5rkhiQHg/0.jpg)](https://www.youtube.com/watch?v=hH-5rkhiQHg)
78+
79+
### Tutorial Video (Persian)
80+
81+
[![IMAGE ALT TEXT HERE](https://img.youtube.com/vi/97YDEumcVWU/0.jpg)](https://www.youtube.com/watch?v=97YDEumcVWU&t=0s)
82+
83+
## How to change the code
84+
85+
The `server.py` file contains the logic in 3 main functions:
86+
`GetPlayerActions` receives a game state, and returns a list of actions for a player for for that cycle.
87+
The actions we can output are equivalent to the Helios Base (Proxy), which are abstracted into multiple levels.
88+
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/).
89+
90+
Similarly, you can change `GetCoachActions` which is responsible for coach communication & substitutions.
91+
92+
You can also use `GetTrainerActions` to move the players & the ball to make repeatable scenarios (when the server is in trainer mode).
93+
94+
## Why & How it works
95+
96+
Originally the RoboCup 2D Soccer Simulation teams used C++, as the main code base (Agent2D aka Helios Base) was written in this language due to its performance.
97+
Due to the popularity of python in Machine Learning & AI spaces we decided to create a python platform which would be equivalent to Agent 2D.
98+
However, using python alone was too slow as preprocessing sensor information & tasks such as localization took too long.
99+
100+
For this reason we have split up the code into two segments:
101+
The data processing section in proxy, which creates a World Model (state), and passes it to python for planning to occur. This repository uses thrift to pass along the World Model, but there is a sister-repo which is compatible with thrift.
102+
103+
```mermaid
104+
sequenceDiagram
105+
participant SS as SoccerSimulationServer
106+
participant SP as SoccerSimulationProxy
107+
participant PM as PlayMakerServer
108+
Note over SS,PM: Run
109+
SP->>SS: Connect
110+
SS->>SP: OK, Unum
111+
SP->>PM: Register
112+
PM->>SP: OK, ClientID
113+
SS->>SP: Observation
114+
Note over SP: Convert observation to State
115+
SP->>PM: State
116+
PM->>SP: Actions
117+
Note over SP: Convert Actions to Low-Level Commands
118+
SP->>SS: Commands
119+
```
120+
121+
![cls](https://github.com/user-attachments/assets/4daee216-1479-4acd-88f2-9e772b8c7837)
122+
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.
123+
124+
## Configuration
125+
126+
### RoboCup Server configuration
127+
128+
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.
129+
130+
### Modifying Proxy & Running proxy and server seperately
131+
132+
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 thrift` in the bin folder of the proxy, and run the thrift server with `python3 server.py` in this repo's directory. It is highly recommended to launch the python server before the proxy.
133+
134+
You can modify the rpc port by adding the argument `--rpc-port [VALUE]`, where the default is 50051.
135+
136+
## Citation
137+
138+
- [Cross Language Soccer Framework](https://arxiv.org/pdf/2406.05621)
139+
- Zare, N., Sayareh, A., Sadraii, A., Firouzkouhi, A. and Soares, A., 2024. Cross Language Soccer Framework: An Open Source Framework for the RoboCup 2D Soccer Simulation. arXiv preprint arXiv:2406.05621.

docs/4-proxy/app-image.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/4-proxy/build.md

Lines changed: 0 additions & 94 deletions
This file was deleted.

docs/4-proxy/develop-playmaker.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
sidebar_position: 4
3-
---
4-
51
# Develop a New Playmaker Server
62

73
To develop a Playmaker server, you need to creat a gRPC or Thrift server that receives data from the Soccer Simulation Proxy and sends actions back to it. This way, you can focus on developing your team's strategy and AI algorithms without worrying about the server's complexity.

0 commit comments

Comments
 (0)