Skip to content

Commit 4b58b97

Browse files
committed
update readme
1 parent 68b6a83 commit 4b58b97

File tree

1 file changed

+69
-16
lines changed

1 file changed

+69
-16
lines changed

README.md

Lines changed: 69 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,125 @@
1-
# Quick start
2-
## Installation
1+
# CLSF Sample Python Base Code (gRPC)
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 gRPC 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+
316
Install the pre-requisites using the command below:
17+
418
``` Bash
519
sudo apt-get install fuse #Used to run AppImages
620
```
21+
722
Clone this repository & install the required python libraries (such as gRPC). Don't forget to activate your virtual environment!
23+
824
``` Bash
925
git clone https://github.com/CLSFramework/sample-playmaker-server-python-grpc.git
1026
cd sample-playmaker-server-python-grpc
1127
# Activate venv/anaconda before this step!
1228
pip install -r requirements.txt
29+
30+
./generate.sh # Generate the gRPC files
1331
```
14-
To download RoboCup Soccer 2D Platform using the commands below:
32+
33+
To download RoboCup Soccer 2D Server using the commands below:
34+
1535
``` Bash
1636
pushd scripts
17-
sh download-rcssserver.sh #install RoboCup Server
37+
sh download-rcssserver.sh # Download the soccer simulation server
1838
popd
1939
```
20-
Next, install 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.
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+
2143
``` Bash
2244
pushd scripts
2345
sh download-proxy.sh #install C++ proxy
2446
popd
2547
```
26-
Finally, download the monitor from [the original repository](https://github.com/rcsoccersim/rcssmonitor/releases) in order to view the games.
27-
## Running a game
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+
2853
This section assumes you have installed the server & proxy using the scripts (as mentioned above)
2954
We must first run a RoboCup Server, in order to host the game:
55+
3056
``` Bash
3157
cd scripts/rcssserver
3258
./rcssserver
3359
```
60+
3461
Then we must run the proxy & the decisionmaking server:
62+
3563
``` Bash
3664
./start-team.sh
3765
```
66+
3867
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!
3968

40-
# How to change the code
69+
## How to change the code
70+
4171
The `server.py` file contains the logic in 3 main functions:
4272
`GetPlayerActions` receives a game state, and returns a list of actions for a player for for that cycle.
43-
The actions we can output are equivalent to the Helios Base, which are abstracted into multiple levels.
44-
You can use actions such as `DoDash`, `DoTurn`, `DoKick` which directly apply force, or use actions such as `GoToPoint`, `SmartKick`, `Shoot` or more.
73+
The actions we can output are equivalent to the Helios Base (Proxy), which are abstracted into multiple levels.
74+
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/).
4575

4676
Similarly, you can change `GetCoachActions` which is responsible for coach communication & substitutions.
4777

4878
You can also use `GetTrainerActions` to move the players & the ball to make repeatable scenarios (when the server is in trainer mode).
49-
# Why & How it works
79+
80+
## Why & How it works
81+
5082
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.
5183
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.
5284
However, using python alone was too slow as preprocessing sensor information & tasks such as localization took too long.
5385

5486
For this reason we have split up the code into two segments:
5587
The data processing section in proxy, which creates a World Model (state), and passes it to python for planning to occur. This repository uses gRPC to pass along the World Model, but there is a sister-repo which is compatible with thrift.
5688

89+
```mermaid
90+
sequenceDiagram
91+
participant SS as SoccerSimulationServer
92+
participant SP as SoccerSimulationProxy
93+
participant PM as PlayMakerServer
94+
Note over SS,PM: Run
95+
SP->>SS: Connect
96+
SS->>SP: OK, Unum
97+
SP->>PM: Register
98+
PM->>SP: OK, ClientID
99+
SS->>SP: Observation
100+
Note over SP: Convert observation to State
101+
SP->>PM: State
102+
PM->>SP: Actions
103+
Note over SP: Convert Actions to Low-Level Commands
104+
SP->>SS: Commands
105+
```
106+
57107
![cls](https://github.com/user-attachments/assets/4daee216-1479-4acd-88f2-9e772b8c7837)
58108
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.
59109

60-
# Configuration
61-
## RoboCup Server configuration
110+
## Configuration
111+
112+
### RoboCup Server configuration
113+
62114
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.
63115

64-
## Modifying Proxy & Running proxy and server seperately
116+
### Modifying Proxy & Running proxy and server seperately
117+
65118
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.
66119

67-
You can modify the rpc port by adding the argument `--rpc-port [VALUE]`, where the default is 50051.
120+
You can modify the rpc port by adding the argument `--rpc-port [VALUE]`, where the default is 50051.
68121

69-
# Citation
122+
## Citation
70123

71124
- [Cross Language Soccer Framework](https://arxiv.org/pdf/2406.05621)
72125
- 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.

0 commit comments

Comments
 (0)