-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from CLSFramework/develop_sadra
Update documentation structure and content, adjust sidebar positions,…
- Loading branch information
Showing
9 changed files
with
206 additions
and
27 deletions.
There are no files selected for viewing
143 changes: 143 additions & 0 deletions
143
docs/2-sampleserver/2-sample-go-base-code-gRPC/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# Sample Go Base Code (gRPC) | ||
|
||
[](https://clsframework.github.io/docs/introduction/) | ||
[](https://opensource.org/licenses/MIT) | ||
|
||
This repository contains a sample decision-making server for the RoboCup 2D Soccer Simulation, which allows you to create a team by using Go. This server is compatible with the [Cross Language Soccer Framework](https://arxiv.org/pdf/2406.05621). This server is written in Golang and uses gRPC to communicate with the [proxy](https://github.com/CLSFramework/soccer-simulation-proxy). | ||
|
||
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. | ||
|
||
For more information, please refer to the [documentation](https://clsframework.github.io/). | ||
|
||
You can find more information about the services and messages in the [IDL section](../../3-idl/protobuf.md). | ||
|
||
## Quick start | ||
|
||
### Preparation | ||
|
||
Install the pre-requisites using the command below: | ||
|
||
``` Bash | ||
sudo apt-get install fuse #Used to run AppImages | ||
``` | ||
|
||
Clone this repository & install the required Golang libraries (such as gRPC). Don't forget to activate your virtual environment! | ||
|
||
``` Bash | ||
git clone #add repo link | ||
cd sample-playmaker-server-go-grpc | ||
|
||
go mod tidy # Install the required Golang libraries | ||
|
||
|
||
./generate.sh # Generate the gRPC files | ||
``` | ||
|
||
To download RoboCup Soccer 2D Server using the commands below: | ||
|
||
``` Bash | ||
pushd scripts | ||
sh download-rcssserver.sh # Download the soccer simulation server | ||
popd | ||
``` | ||
|
||
Next, download the soccer proxy, which uses C++ to read and pre-processes state data and passes them to the Golang server (this project) for decision-making. | ||
|
||
``` Bash | ||
pushd scripts | ||
sh download-proxy.sh #install C++ proxy | ||
popd | ||
``` | ||
|
||
Finally, to watch the game, download the monitor from [the original repository](https://github.com/rcsoccersim/rcssmonitor/releases) in order to view the games. | ||
|
||
### Running a game | ||
|
||
This section assumes you have installed the server & proxy using the scripts (as mentioned above) | ||
We must first run a RoboCup Server, in order to host the game: | ||
|
||
``` Bash | ||
cd scripts/rcssserver | ||
./rcssserver | ||
``` | ||
|
||
Then we must run the proxy & the decisionmaking server: | ||
|
||
``` Bash | ||
./start-team.sh | ||
``` | ||
|
||
### Options | ||
|
||
- `-t team_name`: Specify the team name. | ||
- `--rpc-port PORT`: Specify the RPC port (default: 50051). | ||
- `-d`: Enable debug mode. | ||
|
||
|
||
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! | ||
|
||
### Tutorial Video (English) | ||
|
||
[](https://www.youtube.com/watch?v=hH-5rkhiQHg) | ||
|
||
### Tutorial Video (Persian) | ||
|
||
[](https://www.youtube.com/watch?v=97YDEumcVWU&t=0s) | ||
|
||
## How to change the code | ||
|
||
The `server.go` file contains the logic in 3 main functions: | ||
`GetPlayerActions` receives a game state, and returns a list of actions for a player for for that cycle. | ||
The actions we can output are equivalent to the Helios Base (Proxy), which are abstracted into multiple levels. | ||
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/). | ||
|
||
Similarly, you can change `GetCoachActions` which is responsible for coach communication & substitutions. | ||
|
||
You can also use `GetTrainerActions` to move the players & the ball to make repeatable scenarios (when the server is in trainer mode). | ||
|
||
## Why & How it works | ||
|
||
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. | ||
Due to the popularity of Golang we decided to create a Golang platform which would be equivalent to Agent 2D. | ||
However, using Golang alone was too slow as preprocessing sensor information & tasks such as localization took too long. | ||
|
||
For this reason we have split up the code into two segments: | ||
The data processing section in proxy, which creates a World Model (state), and passes it to Golang 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. | ||
|
||
```mermaid | ||
sequenceDiagram | ||
participant SS as SoccerSimulationServer | ||
participant SP as SoccerSimulationProxy | ||
participant PM as PlayMakerServer | ||
Note over SS,PM: Run | ||
SP->>SS: Connect | ||
SS->>SP: OK, Unum | ||
SP->>PM: Register | ||
PM->>SP: OK, ClientID | ||
SS->>SP: Observation | ||
Note over SP: Convert observation to State | ||
SP->>PM: State | ||
PM->>SP: Actions | ||
Note over SP: Convert Actions to Low-Level Commands | ||
SP->>SS: Commands | ||
``` | ||
|
||
 | ||
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. | ||
|
||
## Configuration | ||
|
||
### RoboCup Server configuration | ||
|
||
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. | ||
|
||
### Modifying Proxy & Running proxy and server seperately | ||
|
||
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 `go run server.go` in this repo's directory. It is highly recommended to launch the Golang server before the proxy. | ||
|
||
You can modify the rpc port by adding the argument `--rpc-port [VALUE]`, where the default is 50051. | ||
|
||
## Citation | ||
|
||
- [Cross Language Soccer Framework](https://arxiv.org/pdf/2406.05621) | ||
- Zare, N., Sayareh, A., Sadraii, A., Firouzkouhi, A. and Soares, A., 2024. Cross Language Soccer Framework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
--- | ||
sidebar_position: 3 | ||
sidebar_position: 4 | ||
title: IDL | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
sidebar_position: 4 | ||
sidebar_position: 5 | ||
title: Soccer Simulation Proxy | ||
--- | ||
# Soccer Simulation Proxy | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
--- | ||
sidebar_position: 5 | ||
sidebar_position: 6 | ||
title: Soccer Simulation | ||
--- | ||
|
||
To use the **CLSFramework**, you need two additional components: | ||
|
||
- **Soccer Simulation Server** | ||
- This is the core server [`rcssserver`](/docs/5-soccersimulation/0-server/index.md) that connects the agents and runs the simulation. | ||
|
||
- **Monitor** | ||
- A monitor is used to visualize the game. You can use either[`rcssmonitor`](/docs/5-soccersimulation/1-monitor/index.md) or [`soccerwindow2`](/docs/5-soccersimulation/2-soccerwindow/index.md) for this purpose. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
--- | ||
sidebar_position: 2 | ||
sidebar_position: 3 | ||
title: Base Codes | ||
--- | ||
|
||
In this section, we will cover the Playmaker servers. | ||
Playmaker servers are the decision-making servers that control the agents in the RoboCup Soccer 2D simulation environment. You can choose one of the sample servers provided in this documentation or create your own server [from scratch](/docs/proxy/develop-playmaker). | ||
|
||
## Sample Playmaker Servers | ||
|
||
- Sample Playmaker Servers in Python by using gRPC [GitHub](https://github.com/CLSFramework/sample-playmaker-server-python-grpc) [Docs](/docs/sampleserver/sample-python-base-code-gRPC/) | ||
- Sample Playmaker Servers in Python by using Thrift [GitHub](https://github.com/CLSFramework/sample-playmaker-server-python-thrift) | ||
- Sample Playmaker Servers in C# by using gRPC [GitHub](https://github.com/CLSFramework/playmaker-server-csharp) | ||
- Sample Playmaker Servers in NodeJs by using gRPC [GitHub](https://github.com/CLSFramework/playmaker-server-nodejs) | ||
In this section, we will cover the Base Codes that developed by the CLSFramework. | ||
|
||
## Base Code | ||
|
||
- PY2D Base Code in Python by using gRPC [GitHub](https://github.com/CLSFramework/py2d) | ||
- Starter Base Code in Python by using Thrift [GitHub](https://github.com/CLSFramework/starter-playmaker-server-python-thrift) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
--- | ||
sidebar_position: 6 | ||
sidebar_position: 7 | ||
title: Tutorial Videos | ||
--- | ||
|
||
In this section, we will cover the tutorial videos that developed for the CLSFramework. | ||
|
||
## Tutorial Videos | ||
There are 2 languages available for the tutorial videos. You can watch the tutorial videos in [English](/docs/ToturialVideos/english.md) or [Persian](/docs/ToturialVideos/persian.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters