Skip to content

Commit b1fc5d3

Browse files
committed
Update protobuf documentation with version and fixed Mermaid symbols
1 parent 82db5fd commit b1fc5d3

File tree

1 file changed

+102
-85
lines changed

1 file changed

+102
-85
lines changed

docs/3-idl/protobuf.md

Lines changed: 102 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -368,28 +368,28 @@
368368
<a name="protos-Ball"></a>
369369

370370
### Ball
371-
371+
Ball is the message that represents the ball in the soccer simulation.
372372

373373

374374
| Field | Type | Label | Description |
375375
| ----- | ---- | ----- | ----------- |
376-
| position | [RpcVector2D](#protos-RpcVector2D) | | |
377-
| relative_position | [RpcVector2D](#protos-RpcVector2D) | | |
378-
| seen_position | [RpcVector2D](#protos-RpcVector2D) | | |
379-
| heard_position | [RpcVector2D](#protos-RpcVector2D) | | |
380-
| velocity | [RpcVector2D](#protos-RpcVector2D) | | |
381-
| seen_velocity | [RpcVector2D](#protos-RpcVector2D) | | |
382-
| heard_velocity | [RpcVector2D](#protos-RpcVector2D) | | |
383-
| pos_count | [int32](#int32) | | |
384-
| seen_pos_count | [int32](#int32) | | |
385-
| heard_pos_count | [int32](#int32) | | |
386-
| vel_count | [int32](#int32) | | |
387-
| seen_vel_count | [int32](#int32) | | |
388-
| heard_vel_count | [int32](#int32) | | |
389-
| lost_count | [int32](#int32) | | |
376+
| position | [RpcVector2D](#protos-RpcVector2D) | | The position of the ball. |
377+
| relative_position | [RpcVector2D](#protos-RpcVector2D) | | The relative position of the ball to the agent who is sending the message. |
378+
| seen_position | [RpcVector2D](#protos-RpcVector2D) | | The position of the ball that the agent has seen. |
379+
| heard_position | [RpcVector2D](#protos-RpcVector2D) | | The position of the ball that the agent has heard. |
380+
| velocity | [RpcVector2D](#protos-RpcVector2D) | | The velocity of the ball. |
381+
| seen_velocity | [RpcVector2D](#protos-RpcVector2D) | | The velocity of the ball that the agent has seen. |
382+
| heard_velocity | [RpcVector2D](#protos-RpcVector2D) | | The velocity of the ball that the agent has heard. |
383+
| pos_count | [int32](#int32) | | How many cycles ago the agent has seen or heard the ball. |
384+
| seen_pos_count | [int32](#int32) | | How many cycles ago the agent has seen the ball. |
385+
| heard_pos_count | [int32](#int32) | | How many cycles ago the agent has heard the ball. |
386+
| vel_count | [int32](#int32) | | How many cycles ago the agent has seen or heard the velocity of the ball. |
387+
| seen_vel_count | [int32](#int32) | | How many cycles ago the agent has seen the velocity of the ball. |
388+
| heard_vel_count | [int32](#int32) | | How many cycles ago the agent has heard the velocity of the ball. |
389+
| lost_count | [int32](#int32) | | How many cycles ago the agent has lost the ball. |
390390
| ghost_count | [int32](#int32) | | |
391-
| dist_from_self | [float](#float) | | |
392-
| angle_from_self | [float](#float) | | |
391+
| dist_from_self | [float](#float) | | The distance of the ball from the agent who is sending the message. |
392+
| angle_from_self | [float](#float) | | The angle of the ball from the agent who is sending the message. |
393393

394394

395395

@@ -1635,41 +1635,42 @@ todo min/max_angle
16351635
<a name="protos-Player"></a>
16361636

16371637
### Player
1638-
1638+
Player is the message that represents a player in the soccer simulation.
1639+
To get type information of the player, you can use the type_id field and player type information.
16391640

16401641

16411642
| Field | Type | Label | Description |
16421643
| ----- | ---- | ----- | ----------- |
1643-
| position | [RpcVector2D](#protos-RpcVector2D) | | |
1644-
| seen_position | [RpcVector2D](#protos-RpcVector2D) | | |
1645-
| heard_position | [RpcVector2D](#protos-RpcVector2D) | | |
1646-
| velocity | [RpcVector2D](#protos-RpcVector2D) | | |
1647-
| seen_velocity | [RpcVector2D](#protos-RpcVector2D) | | |
1648-
| pos_count | [int32](#int32) | | |
1649-
| seen_pos_count | [int32](#int32) | | |
1650-
| heard_pos_count | [int32](#int32) | | |
1651-
| vel_count | [int32](#int32) | | |
1652-
| seen_vel_count | [int32](#int32) | | |
1653-
| ghost_count | [int32](#int32) | | |
1654-
| dist_from_self | [float](#float) | | |
1655-
| angle_from_self | [float](#float) | | |
1656-
| id | [int32](#int32) | | |
1657-
| side | [Side](#protos-Side) | | |
1658-
| uniform_number | [int32](#int32) | | |
1659-
| uniform_number_count | [int32](#int32) | | |
1660-
| is_goalie | [bool](#bool) | | |
1661-
| body_direction | [float](#float) | | |
1662-
| body_direction_count | [int32](#int32) | | |
1663-
| face_direction | [float](#float) | | |
1664-
| face_direction_count | [int32](#int32) | | |
1665-
| point_to_direction | [float](#float) | | |
1666-
| point_to_direction_count | [int32](#int32) | | |
1667-
| is_kicking | [bool](#bool) | | |
1668-
| dist_from_ball | [float](#float) | | |
1669-
| angle_from_ball | [float](#float) | | |
1670-
| ball_reach_steps | [int32](#int32) | | |
1671-
| is_tackling | [bool](#bool) | | |
1672-
| type_id | [int32](#int32) | | |
1644+
| position | [RpcVector2D](#protos-RpcVector2D) | | The position of the player. |
1645+
| seen_position | [RpcVector2D](#protos-RpcVector2D) | | The position of the player that the agent has seen. |
1646+
| heard_position | [RpcVector2D](#protos-RpcVector2D) | | The position of the player that the agent has heard. |
1647+
| velocity | [RpcVector2D](#protos-RpcVector2D) | | The velocity of the player. |
1648+
| seen_velocity | [RpcVector2D](#protos-RpcVector2D) | | The velocity of the player that the agent has seen. |
1649+
| pos_count | [int32](#int32) | | How many cycles ago the agent has seen or heard the player. |
1650+
| seen_pos_count | [int32](#int32) | | How many cycles ago the agent has seen the player. |
1651+
| heard_pos_count | [int32](#int32) | | How many cycles ago the agent has heard the player. |
1652+
| vel_count | [int32](#int32) | | How many cycles ago the agent has seen or heard the velocity of the player. |
1653+
| seen_vel_count | [int32](#int32) | | How many cycles ago the agent has seen the velocity of the player. |
1654+
| ghost_count | [int32](#int32) | | How many cycles ago the agent has lost the player. |
1655+
| dist_from_self | [float](#float) | | The distance of the player from the agent who is sending the message. |
1656+
| angle_from_self | [float](#float) | | The angle of the player from the agent who is sending the message. |
1657+
| id | [int32](#int32) | | The unique identifier of the player. |
1658+
| side | [Side](#protos-Side) | | The side of the player. It can be LEFT or RIGHT or UNKNOWN if the side is not known. |
1659+
| uniform_number | [int32](#int32) | | The uniform number of the player. |
1660+
| uniform_number_count | [int32](#int32) | | How many cycles ago the agent has seen the uniform number of the player. |
1661+
| is_goalie | [bool](#bool) | | Whether the player is a goalie or not. |
1662+
| body_direction | [float](#float) | | The body direction of the player. |
1663+
| body_direction_count | [int32](#int32) | | How many cycles ago the agent has seen the body direction of the player. |
1664+
| face_direction | [float](#float) | | The face direction of the player. In soccer simulation 2D, face direction is the direction that the player is looking at. |
1665+
| face_direction_count | [int32](#int32) | | How many cycles ago the agent has seen the face direction of the player. |
1666+
| point_to_direction | [float](#float) | | The direction that the player is pointing to. |
1667+
| point_to_direction_count | [int32](#int32) | | How many cycles ago the agent has seen the point to direction of the player. |
1668+
| is_kicking | [bool](#bool) | | Whether the player is kicking or not. |
1669+
| dist_from_ball | [float](#float) | | The distance of the player from the ball. |
1670+
| angle_from_ball | [float](#float) | | The angle of the player from the ball. |
1671+
| ball_reach_steps | [int32](#int32) | | How many cycles the player needs to reach the ball. |
1672+
| is_tackling | [bool](#bool) | | Whether the player is tackling or not. |
1673+
| type_id | [int32](#int32) | | The type identifier of the player. |
16731674

16741675

16751676

@@ -1910,15 +1911,17 @@ todo min/max_angle
19101911
<a name="protos-RegisterRequest"></a>
19111912

19121913
### RegisterRequest
1913-
1914+
RegisterRequest is the message that the client sends to the server to register itself.
1915+
The client should send this message to the server to register itself.
1916+
The server will respond with a RegisterResponse message.
19141917

19151918

19161919
| Field | Type | Label | Description |
19171920
| ----- | ---- | ----- | ----------- |
1918-
| agent_type | [AgentType](#protos-AgentType) | | |
1919-
| team_name | [string](#string) | | |
1920-
| uniform_number | [int32](#int32) | | |
1921-
| rpc_version | [int32](#int32) | | |
1921+
| agent_type | [AgentType](#protos-AgentType) | | The type of the agent. It can be PlayerT, CoachT, or TrainerT. |
1922+
| team_name | [string](#string) | | The name of the team that the agent belongs to. |
1923+
| uniform_number | [int32](#int32) | | The uniform number of the agent. |
1924+
| rpc_version | [int32](#int32) | | The version of the RPC protocol that the client supports. |
19221925

19231926

19241927

@@ -1928,16 +1931,18 @@ todo min/max_angle
19281931
<a name="protos-RegisterResponse"></a>
19291932

19301933
### RegisterResponse
1931-
1934+
RegisterResponse is the message that the server sends to the client in response to a RegisterRequest message.
1935+
The server will respond with this message after receiving a RegisterRequest message.
1936+
The client should use the information in this message to identify itself to the server.
19321937

19331938

19341939
| Field | Type | Label | Description |
19351940
| ----- | ---- | ----- | ----------- |
1936-
| client_id | [int32](#int32) | | |
1937-
| agent_type | [AgentType](#protos-AgentType) | | |
1938-
| team_name | [string](#string) | | |
1939-
| uniform_number | [int32](#int32) | | |
1940-
| rpc_server_language_type | [RpcServerLanguageType](#protos-RpcServerLanguageType) | | |
1941+
| client_id | [int32](#int32) | | The unique identifier assigned to the client by the server. |
1942+
| agent_type | [AgentType](#protos-AgentType) | | The type of the agent. It can be PlayerT, CoachT, or TrainerT. |
1943+
| team_name | [string](#string) | | The name of the team that the agent belongs to. |
1944+
| uniform_number | [int32](#int32) | | The uniform number of the agent. |
1945+
| rpc_server_language_type | [RpcServerLanguageType](#protos-RpcServerLanguageType) | | The language that the server is implemented in. |
19411946

19421947

19431948

@@ -2014,15 +2019,17 @@ todo min/max_angle
20142019
<a name="protos-RpcVector2D"></a>
20152020

20162021
### RpcVector2D
2017-
2022+
RpcVector2D represents a 2D vector with additional properties.
2023+
If you want to have access to geometric operations, you can use Vector2D class in [pyrusgeom package](https://github.com/Cyrus2D/PyrusGeom)
2024+
To use this class, you need to install pyrusgeom package, import Vector2D class and create a Vector2D object with x and y values.
20182025

20192026

20202027
| Field | Type | Label | Description |
20212028
| ----- | ---- | ----- | ----------- |
2022-
| x | [float](#float) | | |
2023-
| y | [float](#float) | | |
2024-
| dist | [float](#float) | | |
2025-
| angle | [float](#float) | | |
2029+
| x | [float](#float) | | The x-coordinate of the vector. |
2030+
| y | [float](#float) | | The y-coordinate of the vector. |
2031+
| dist | [float](#float) | | The distance magnitude of the vector. |
2032+
| angle | [float](#float) | | The angle of the vector in degrees. In soccer simulation 2D environment, the 0 degree is opponent&#39;s goal, and the angle increases in the counter-clock direction. So, if your team is in left side, -90 degree is up, 0 degree is right (opponent gole), 90 degree is down. |
20262033

20272034

20282035

@@ -2936,29 +2943,39 @@ For more information, see the documentation at [link](https://link.com).
29362943
### Game
29372944
The Game service provides various RPC methods for interacting with a soccer simulation.
29382945

2939-
Methods:
2940-
- GetPlayerActions(State): Retrieves actions available to a player based on the current state.
2941-
- GetCoachActions(State): Retrieves actions available to a coach based on the current state.
2942-
- GetTrainerActions(State): Retrieves actions available to a trainer based on the current state.
2943-
- SendInitMessage(InitMessage): Sends an initialization message to the server.
2944-
- SendServerParams(ServerParam): Sends server parameters to the server.
2945-
- SendPlayerParams(PlayerParam): Sends player parameters to the server.
2946-
- SendPlayerType(PlayerType): Sends player type information to the server. (Note: Should be PlayerTypes)
2947-
- Register(RegisterRequest): Registers a new entity and returns a registration response.
2948-
- SendByeCommand(RegisterResponse): Sends a bye command to the server.
2949-
- GetBestPlannerAction(BestPlannerActionRequest): Retrieves the best planner action based on the request.
29502946
```mermaid
29512947
sequenceDiagram
2952-
participant Alice
2953-
participant Bob
2954-
Alice->>John: Hello John, how are you?
2955-
loop HealthCheck
2956-
John->>John: Fight against hypochondria
2957-
end
2958-
Note right of John: Rational thoughts <br/>prevail!
2959-
John-->>Alice: Great!
2960-
John->>Bob: How about you?
2961-
Bob-->>John: Jolly good!
2948+
participant SS as SoccerSimulationServer
2949+
participant SP as SoccerSimulationProxy
2950+
participant PM as PlayMakerServer
2951+
Note over SS,PM: Run
2952+
SP->>SS: Connect
2953+
SS->>SP: OK, Unum
2954+
SS->>SP: ServerParam
2955+
SS->>SP: PlayerParam
2956+
SS->>SP: PlayerType (0)
2957+
SS->>SP: PlayerType (1)
2958+
SS->>SP: PlayerType (17)
2959+
SP->>PM: Register(RegisterRequest)
2960+
PM->>SP: RegisterResponse
2961+
SP->>PM: SendInitMessage(InitMessage)
2962+
PM->>SP: Empty
2963+
SP->>PM: SendServerParams(ServerParam)
2964+
PM->>SP: Empty
2965+
SP->>PM: SendPlayerParams(PlayerParam)
2966+
PM->>SP: Empty
2967+
SP->>PM: SendPlayerType(PlayerType(0))
2968+
PM->>SP: Empty
2969+
SP->>PM: SendPlayerType(PlayerType(1))
2970+
PM->>SP: Empty
2971+
SP->>PM: SendPlayerType(PlayerType(17))
2972+
PM->>SP: Empty
2973+
SS->>SP: Observation
2974+
Note over SP: Convert observation to State
2975+
SP->>PM: GetPlayerActions(State)
2976+
PM->>SP: PlayerActions
2977+
Note over SP: Convert Actions to Low-Level Commands
2978+
SP->>SS: Commands
29622979
```
29632980

29642981
| Method Name | Request Type | Response Type | Description |

0 commit comments

Comments
 (0)