Skip to content

Commit 49a97af

Browse files
committed
update server by adding GetBestPlannerAction
1 parent 5ad6460 commit 49a97af

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

server.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ def GetPlayerActions(self, state: pb2.State):
5555
through_pass=True,
5656
simple_pass=True,
5757
short_dribble=True,
58-
long_dribble=False,
58+
long_dribble=True,
5959
simple_shoot=True,
6060
simple_dribble=True,
61-
server_side_decision=True,
62-
cross=True)))
61+
cross=True,
62+
server_side_decision=False
63+
)))
6364
else:
6465
actions.append(pb2.PlayerAction(helios_basic_move=pb2.HeliosBasicMove()))
6566
else:
@@ -161,18 +162,11 @@ def SendByeCommand(self, register_response: pb2.RegisterResponse, context):
161162
return res
162163

163164
def GetBestPlannerAction(self, pairs: pb2.BestPlannerActionRequest, context):
164-
logger.error(f"GetBestPlannerAction cycle:{pairs.state.world_model.cycle} pairs:{len(pairs.pairs)} unum:{pairs.state.register_response.uniform_number}")
165+
logger.debug(f"GetBestPlannerAction cycle:{pairs.state.world_model.cycle} pairs:{len(pairs.pairs)} unum:{pairs.state.register_response.uniform_number}")
165166
pairs_list: list[int, pb2.RpcActionState] = [(k, v) for k, v in pairs.pairs.items()]
166167
pairs_list.sort(key=lambda x: x[0])
167-
168-
# for p in pairs_list:
169-
# pair: pb2.RpcActionStatePair = p[1]
170-
# logger.info(f"i:{p[0]} p:{pair.action.parent_index} {p[1].action.description} to {p[1].action.target_unum} in ({round(p[1].action.target_point.x, 2)},{round(p[1].action.target_point.y, 2)}) e:{round(p[1].evaluation,2)}")
171-
172168
best_action = max(pairs_list, key=lambda x: -1000 if x[1].action.parent_index != -1 else x[1].predict_state.ball_position.x)
173-
174-
logger.error(f"Best action: {best_action[0]} {best_action[1].action.description} to {best_action[1].action.target_unum} in ({round(best_action[1].action.target_point.x, 2)},{round(best_action[1].action.target_point.y, 2)}) e:{round(best_action[1].evaluation,2)}")
175-
169+
logger.debug(f"Best action: {best_action[0]} {best_action[1].action.description} to {best_action[1].action.target_unum} in ({round(best_action[1].action.target_point.x, 2)},{round(best_action[1].action.target_point.y, 2)}) e:{round(best_action[1].evaluation,2)}")
176170
res = pb2.BestPlannerActionResponse(index=best_action[0])
177171
return res
178172

0 commit comments

Comments
 (0)