Skip to content

Commit 850b1a0

Browse files
committed
update idls
1 parent ddbeb89 commit 850b1a0

File tree

2 files changed

+272
-31
lines changed

2 files changed

+272
-31
lines changed

idl/grpc/service.proto

Lines changed: 265 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ message HeliosShoot {}
861861
* The offensive planner is responsible for making decisions about the offensive actions of the agent by creating a tree of actions,
862862
finding the best chain of actions, and executing the first action in the chain, when the agent is ball owner.
863863
* The best action is an action with best incomming predicted state.
864-
* The best predicted state is the state that has the best evalution value by using this formula: value = ball.x + max(0.0, 40.0 - ball.dist(opponent goal center))
864+
* The best predicted state is the state that has the best evaluation value by using this formula: value = ball.x + max(0.0, 40.0 - ball.dist(opponent goal center))
865865
* Due to the complexity of the not simple actions, the agent can not calculate the best action in the first layer of the tree. So, the agent can use the simple actions in the first layer of the tree.
866866
* To create the tree, the planner create all possible edges (actions) and create the next state of the agent by using each action.
867867
Then the planner starts to create the next layer of the tree by using the next state of the agent. The planner continues to create the tree until
@@ -939,16 +939,51 @@ message HeliosOffensivePlanner {
939939
The difault value is 4. So, if you do not set this value, the agent will create the tree with 4 depth. Due to the default value of rpc, 0 means the default value. */
940940
int32 max_nodes = 12; /** The maximum number of nodes in the tree. The agent will create the tree with this number of nodes.
941941
The difault value is 500. So, if you do not set this value, the agent will create the tree with 500 nodes. Due to the default value of rpc, 0 means the default value. */
942-
PlannerEvalution evalution = 13; /** The evalution methods to evaluate the actions[predicted states] in the tree. */
942+
PlannerEvaluation evaluation = 13; /** The evaluation methods to evaluate the actions[predicted states] in the tree. */
943943
}
944944

945945
/**
946-
* PlannerEvalution is the message that represents the evalution methods to evaluate the actions[predicted states] in the tree.
946+
* PlannerEvaluation is the message that represents the evaluation methods to evaluate the actions[predicted states] in the tree.
947947
* Using this method causes the predicted state eval to be decreased based on the distance or reach steps of the opponent players to the position of the ball in the predicted state.
948948
* Each variable in the message is a list of float values.
949949
* For example, if you want to decrease the predicted state eval if the distance of the opponent player to the ball is less than 5,
950950
You can set the negetive_effect_by_distance variable with the value of [-9.0, -8.5, -7.2, -6.1, -3.8]. It means the predicted state eval will be decreased by 9.0 if the distance is less than 1,
951951
8.5 if the distance is less than 2, 7.2 if the distance is less than 3, 6.1 if the distance is less than 4, 3.8 if the distance is less than 5.
952+
Example in python grpc:
953+
```python
954+
actions = []
955+
opponent_effector = pb2.OpponentEffector(
956+
negetive_effect_by_distance=[-50, -45, -40, -30, -20, -15, -10, -5, -2, -1, -0.5, -0.1],
957+
negetive_effect_by_distance_based_on_first_layer=False,
958+
negetive_effect_by_reach_steps=[],
959+
negetive_effect_by_reach_steps_based_on_first_layer=False
960+
)
961+
planner_evaluation_effector = pb2.PlannerEvaluationEffector(
962+
opponent_effector=opponent_effector,
963+
# teammate_effector= ...
964+
# action_type_effector= ...
965+
)
966+
planner_evaluation = pb2.PlannerEvaluation(
967+
effectors=planner_evaluation_effector,
968+
)
969+
helios_offensive_planner = pb2.HeliosOffensivePlanner(
970+
lead_pass=True,
971+
direct_pass=False,
972+
through_pass=True,
973+
simple_pass=True,
974+
short_dribble=True,
975+
long_dribble=True,
976+
simple_shoot=True,
977+
simple_dribble=False,
978+
cross=True,
979+
server_side_decision=False,
980+
max_depth=5,
981+
max_nodes=800,
982+
evalution=planner_evaluation
983+
)
984+
actions.append(pb2.PlayerAction(helios_offensive_planner=helios_offensive_planner))
985+
return pb2.PlayerActions(actions=actions)
986+
```
952987
*/
953988
message OpponentEffector {
954989
repeated float negetive_effect_by_distance = 1; /** The list of float values that represents the negetive effect of the distance of the opponent player to the ball in the predicted state.
@@ -961,10 +996,48 @@ message OpponentEffector {
961996
}
962997

963998
/**
964-
* ActionTypeEfector is the message that represents coefficients of the action types in the tree to calculate the predicted state evalution.
999+
* ActionTypeEffector is the message that represents coefficients of the action types in the tree to calculate the predicted state evaluation.
9651000
* Each number should start from 0.0. For example, if evaluation of an action-state is 10, the action is direct pass, and value of direct_pass is 0.5, so the final evaluation of the action-state will be 5.
1001+
example in python grpc:
1002+
```python
1003+
actions = []
1004+
action_type_effector = pb2.ActionTypeEffector(
1005+
direct_pass=2.0,
1006+
lead_pass=1.5,
1007+
through_pass=1.0,
1008+
short_dribble=1.0,
1009+
long_dribble=1.0,
1010+
cross=1.0,
1011+
hold=1.0
1012+
)
1013+
planner_evaluation_effector = pb2.PlannerEvaluationEffector(
1014+
# opponent_effector= ...
1015+
# teammate_effector= ...
1016+
action_type_effector= action_type_effector
1017+
)
1018+
planner_evaluation = pb2.PlannerEvaluation(
1019+
effectors=planner_evaluation_effector,
1020+
)
1021+
helios_offensive_planner = pb2.HeliosOffensivePlanner(
1022+
lead_pass=True,
1023+
direct_pass=False,
1024+
through_pass=True,
1025+
simple_pass=True,
1026+
short_dribble=True,
1027+
long_dribble=True,
1028+
simple_shoot=True,
1029+
simple_dribble=False,
1030+
cross=True,
1031+
server_side_decision=False,
1032+
max_depth=5,
1033+
max_nodes=800,
1034+
evalution=planner_evaluation
1035+
)
1036+
actions.append(pb2.PlayerAction(helios_offensive_planner=helios_offensive_planner))
1037+
return pb2.PlayerActions(actions=actions)
1038+
```
9661039
*/
967-
message ActionTypeEfector {
1040+
message ActionTypeEffector {
9681041
float direct_pass = 1; /** The coefficient of the direct pass action. */
9691042
float lead_pass = 2; /** The coefficient of the lead pass action. */
9701043
float through_pass = 3; /** The coefficient of the through pass action. */
@@ -975,9 +1048,42 @@ message ActionTypeEfector {
9751048
}
9761049

9771050
/**
978-
* TeammateEffector is the message that represents the coefficients of the teammates in the tree to calculate the predicted state evalution.
1051+
* TeammateEffector is the message that represents the coefficients of the teammates in the tree to calculate the predicted state evaluation.
9791052
* Each number should start from 0.0. For example, if evaluation of an action-state is 10, the action is direct pass to player 5,
9801053
and value of player 5 is 0.5, so the final evaluation of the action-state will be 5.
1054+
example in python grpc:
1055+
```python
1056+
actions = []
1057+
teammate_effector = pb2.TeammateEffector(
1058+
coefficients={2: 1.2, 5: 1.6}, # if action target is player 2, multiply by 1.2.
1059+
apply_based_on_first_layer=False
1060+
)
1061+
planner_evaluation_effector = pb2.PlannerEvaluationEffector(
1062+
# opponent_effector= ...
1063+
teammate_effector= teammate_effector
1064+
# action_type_effector= ...
1065+
)
1066+
planner_evaluation = pb2.PlannerEvaluation(
1067+
effectors=planner_evaluation_effector,
1068+
)
1069+
helios_offensive_planner = pb2.HeliosOffensivePlanner(
1070+
lead_pass=True,
1071+
direct_pass=False,
1072+
through_pass=True,
1073+
simple_pass=True,
1074+
short_dribble=True,
1075+
long_dribble=True,
1076+
simple_shoot=True,
1077+
simple_dribble=False,
1078+
cross=True,
1079+
server_side_decision=False,
1080+
max_depth=5,
1081+
max_nodes=800,
1082+
evalution=planner_evaluation
1083+
)
1084+
actions.append(pb2.PlayerAction(helios_offensive_planner=helios_offensive_planner))
1085+
return pb2.PlayerActions(actions=actions)
1086+
```
9811087
*/
9821088
message TeammateEffector {
9831089
map<int32, float> coefficients = 1; /** The map of the coefficients of the teammates. The key of the map is the uniform number of the teammate, and the value is the coefficient of the teammate.
@@ -987,25 +1093,104 @@ message TeammateEffector {
9871093
}
9881094

9891095
/**
990-
* PlannerEvaluationEfector is the message that represents the effectors of the planner evaluation methods.
991-
* The proxy agent will update the predicted state evalution based on the effectors.
1096+
* PlannerEvaluationEffector is the message that represents the effectors of the planner evaluation methods.
1097+
* The proxy agent will update the predicted state evaluation based on the effectors.
1098+
example in python grpc:
1099+
```python
1100+
actions = []
1101+
teammate_effector = pb2.TeammateEffector(
1102+
coefficients={2: 1.2, 5: 1.6}, # if action target is player 2, multiply by 1.2.
1103+
apply_based_on_first_layer=False
1104+
)
1105+
action_type_effector = pb2.ActionTypeEffector(
1106+
direct_pass=2.0,
1107+
lead_pass=1.5,
1108+
through_pass=1.0,
1109+
short_dribble=1.0,
1110+
long_dribble=1.0,
1111+
cross=1.0,
1112+
hold=1.0
1113+
)
1114+
opponent_effector = pb2.OpponentEffector(
1115+
negetive_effect_by_distance=[-50, -45, -40, -30, -20, -15, -10, -5, -2, -1, -0.5, -0.1],
1116+
negetive_effect_by_distance_based_on_first_layer=False,
1117+
negetive_effect_by_reach_steps=[],
1118+
negetive_effect_by_reach_steps_based_on_first_layer=False
1119+
)
1120+
planner_evaluation_effector = pb2.PlannerEvaluationEffector(
1121+
opponent_effector= opponent_effector,
1122+
teammate_effector= teammate_effector,
1123+
action_type_effector= action_type_effector
1124+
)
1125+
planner_evaluation = pb2.PlannerEvaluation(
1126+
effectors=planner_evaluation_effector,
1127+
)
1128+
helios_offensive_planner = pb2.HeliosOffensivePlanner(
1129+
lead_pass=True,
1130+
direct_pass=False,
1131+
through_pass=True,
1132+
simple_pass=True,
1133+
short_dribble=True,
1134+
long_dribble=True,
1135+
simple_shoot=True,
1136+
simple_dribble=False,
1137+
cross=True,
1138+
server_side_decision=False,
1139+
max_depth=5,
1140+
max_nodes=800,
1141+
evalution=planner_evaluation
1142+
)
1143+
actions.append(pb2.PlayerAction(helios_offensive_planner=helios_offensive_planner))
1144+
return pb2.PlayerActions(actions=actions)
1145+
```
9921146
*/
993-
message PlannerEvaluationEfector {
994-
oneof efector {
995-
OpponentEffector opponent_effector = 1; /** The effector of the opponent players. You can set the negetive effect of the distance or reach steps of the opponent players to the ball in the predicted state.
996-
By using this effector, the proxy agent will decrease the predicted state evalution based on the distance or reach steps of the opponent players to the ball in the predicted state. */
997-
ActionTypeEfector action_type_effector = 2; /** The effector of the action types. You can set the coefficients of the action types in the tree to calculate the predicted state evalution.
998-
By using this effector, the proxy agent will update the predicted state evalution based on the coefficients of the action types in the tree. */
999-
TeammateEffector teammate_effector = 3; /** The effector of the teammates. You can set the coefficients of the teammates in the tree to calculate the predicted state evalution.
1000-
By using this effector, the proxy agent will update the predicted state evalution based on the coefficients of the teammates in the tree. */
1001-
}
1147+
message PlannerEvaluationEffector {
1148+
OpponentEffector opponent_effector = 1; /** The effector of the opponent players. You can set the negetive effect of the distance or reach steps of the opponent players to the ball in the predicted state.
1149+
By using this effector, the proxy agent will decrease the predicted state evaluation based on the distance or reach steps of the opponent players to the ball in the predicted state. */
1150+
ActionTypeEffector action_type_effector = 2; /** The effector of the action types. You can set the coefficients of the action types in the tree to calculate the predicted state evaluation.
1151+
By using this effector, the proxy agent will update the predicted state evaluation based on the coefficients of the action types in the tree. */
1152+
TeammateEffector teammate_effector = 3; /** The effector of the teammates. You can set the coefficients of the teammates in the tree to calculate the predicted state evaluation.
1153+
By using this effector, the proxy agent will update the predicted state evaluation based on the coefficients of the teammates in the tree. */
10021154
}
10031155

10041156
/**
10051157
* HeliosFieldEvaluator is the message that represents the field evaluator of the proxy agent to evaluate each node (predicted state) in the planner tree.
10061158
* If you dont set the field evaluator, the proxy agent will use the default field evaluator (HeliosFieldEvaluator) to evaluate each node in the planner tree.
10071159
* This field evaluator calculate the value of the predicted state by using this formula:
10081160
value = x_coefficient * (ball.x + 52.5) + ball_dist_to_goal_coefficient * max(0.0, effective_max_ball_dist_to_goal - ball.dist(opponent goal center))
1161+
example in python grpc:
1162+
```python
1163+
actions = []
1164+
helios_field_evaluator = pb2.HeliosFieldEvaluator(
1165+
x_coefficient=2.1,
1166+
ball_dist_to_goal_coefficient=1.8,
1167+
effective_max_ball_dist_to_goal=50.0
1168+
)
1169+
field_evaluator = pb2.PlannerFieldEvaluator(
1170+
helios_field_evaluator=helios_field_evaluator,
1171+
# matrix_field_evaluator=...
1172+
)
1173+
planner_evaluation = pb2.PlannerEvaluation(
1174+
field_evaluators=field_evaluator
1175+
)
1176+
helios_offensive_planner = pb2.HeliosOffensivePlanner(
1177+
lead_pass=True,
1178+
direct_pass=False,
1179+
through_pass=True,
1180+
simple_pass=True,
1181+
short_dribble=True,
1182+
long_dribble=True,
1183+
simple_shoot=True,
1184+
simple_dribble=False,
1185+
cross=True,
1186+
server_side_decision=False,
1187+
max_depth=5,
1188+
max_nodes=800,
1189+
evalution=planner_evaluation
1190+
)
1191+
actions.append(pb2.PlayerAction(helios_offensive_planner=helios_offensive_planner))
1192+
return pb2.PlayerActions(actions=actions)
1193+
```
10091194
*/
10101195
message HeliosFieldEvaluator {
10111196
float x_coefficient = 1; // The coefficient of the x-coordinate of the ball in the predicted state. The default value is 1.
@@ -1017,20 +1202,76 @@ message MatrixFieldEvaluatorY {
10171202
repeated float evals = 1;
10181203
}
10191204

1205+
/**
1206+
* MatrixFieldEvaluator is the message that represents the matrix field evaluator of the proxy agent to evaluate each node (predicted state) in the planner tree.
1207+
* If you dont set the field evaluator, the proxy agent will use the default field evaluator (HeliosFieldEvaluator) to evaluate each node in the planner tree.
1208+
* This field evaluator calculate the value of the predicted state by using a matrix of float values.
1209+
* ---------------------
1210+
* | 10 | 20 | 30 | 40 |
1211+
* | 15 | 25 | 35 | 45 |
1212+
* | 10 | 20 | 30 | 40 |
1213+
* ---------------------
1214+
* In this example matrix, the value of each point in the opponent pernaly area is 45.
1215+
* example in python grpc:
1216+
```python
1217+
actions = []
1218+
matrix_field_evaluator = pb2.MatrixFieldEvaluator(
1219+
evals=[
1220+
pb2.MatrixFieldEvaluatorY(evals=[10, 15, 10]),
1221+
pb2.MatrixFieldEvaluatorY(evals=[20, 25, 20]),
1222+
pb2.MatrixFieldEvaluatorY(evals=[30, 35, 30]),
1223+
pb2.MatrixFieldEvaluatorY(evals=[40, 45, 40]),
1224+
]
1225+
)
1226+
field_evaluator = pb2.PlannerFieldEvaluator(
1227+
# helios_field_evaluator=...
1228+
matrix_field_evaluator=matrix_field_evaluator
1229+
)
1230+
planner_evaluation = pb2.PlannerEvaluation(
1231+
field_evaluators=field_evaluator
1232+
)
1233+
helios_offensive_planner = pb2.HeliosOffensivePlanner(
1234+
lead_pass=True,
1235+
direct_pass=False,
1236+
through_pass=True,
1237+
simple_pass=True,
1238+
short_dribble=True,
1239+
long_dribble=True,
1240+
simple_shoot=True,
1241+
simple_dribble=False,
1242+
cross=True,
1243+
server_side_decision=False,
1244+
max_depth=5,
1245+
max_nodes=800,
1246+
evalution=planner_evaluation
1247+
)
1248+
actions.append(pb2.PlayerAction(helios_offensive_planner=helios_offensive_planner))
1249+
return pb2.PlayerActions(actions=actions)
1250+
```
1251+
*/
10201252
message MatrixFieldEvaluator {
10211253
repeated MatrixFieldEvaluatorY evals = 1;
10221254
}
10231255

1256+
/**
1257+
* PlannerFieldEvaluator is the message that represents the field evaluator of the proxy agent to evaluate each node (predicted state) in the planner tree.
1258+
* If you dont set the field evaluator, the proxy agent will use the default field evaluator (HeliosFieldEvaluator) to evaluate each node in the planner tree.
1259+
* This field evaluator calculate the value of the predicted state by using helios_field_evaluator or/and matrix_field_evaluator.
1260+
* Note: if you just use the matrix_field_evaluator, value of all target in each square of the matrix should be the same, so it causes that the player choosing hold ball action instead of dribble in that area.
1261+
* To avoid this issue, you can use the helios_field_evaluator with the matrix_field_evaluator together.
1262+
*/
10241263
message PlannerFieldEvaluator {
1025-
oneof field_evaluator {
1026-
HeliosFieldEvaluator helios_field_evaluator = 1;
1027-
MatrixFieldEvaluator matrix_field_evaluator = 2;
1028-
}
1264+
HeliosFieldEvaluator helios_field_evaluator = 1;
1265+
MatrixFieldEvaluator matrix_field_evaluator = 2;
10291266
}
10301267

1031-
message PlannerEvalution {
1032-
repeated PlannerEvaluationEfector effectors = 1;
1033-
repeated PlannerFieldEvaluator field_evaluators = 2;
1268+
/**
1269+
* PlannerEvaluation is the message that represents the evaluation methods to evaluate the actions[predicted states] in the tree.
1270+
* Using this method causes the predicted state eval to be calculated based on field evaluators and effected by effectors.
1271+
*/
1272+
message PlannerEvaluation {
1273+
PlannerEvaluationEffector effectors = 1;
1274+
PlannerFieldEvaluator field_evaluators = 2;
10341275
}
10351276

10361277
message HeliosBasicOffensive {}

0 commit comments

Comments
 (0)