Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Generate Thrift Code

on:
push:
branches:
- main

jobs:
generate:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install Thrift
run: |
sudo apt-get install -y thrift-compiler
python3 -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run generate.sh
run: |
chmod +x ./generate.sh
./generate.sh

- name: Check for changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add soccer/*
if ! git diff --cached --quiet; then
git commit -m "Automated update: Generated Thrift classes"
else
echo "No changes detected, skipping commit."
fi

- name: Push changes
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ soccer/__pycache__/
scripts/proxy
scripts/rcssserver
__pycache__/
logs/
2 changes: 1 addition & 1 deletion generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

thrift --gen py -out ./ ./idl/*.thrift

python type_generator.py
python3 type_generator.py
66 changes: 62 additions & 4 deletions idl/soccer_service.thrift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// version 1.6
// version 1.7

namespace cpp soccer
namespace py soccer
Expand Down Expand Up @@ -761,6 +761,58 @@ struct HeliosGoalieKick {}

struct HeliosShoot {}

struct OpponentEffector {
1: list<double> negetive_effect_by_distance,
2: bool negetive_effect_by_distance_based_on_first_layer,
3: list<double> negetive_effect_by_reach_steps,
4: bool negetive_effect_by_reach_steps_based_on_first_layer
}

struct ActionTypeEffector {
1: double direct_pass,
2: double lead_pass,
3: double through_pass,
4: double short_dribble,
5: double long_dribble,
6: double cross,
7: double hold
}

struct TeammateEffector {
1: map<i32, double> coefficients,
2: bool apply_based_on_first_layer
}

struct PlannerEvaluationEffector {
1: optional OpponentEffector opponent_effector,
2: optional ActionTypeEffector action_type_effector,
3: optional TeammateEffector teammate_effector
}

struct HeliosFieldEvaluator {
1: double x_coefficient,
2: double ball_dist_to_goal_coefficient,
3: double effective_max_ball_dist_to_goal
}

struct MatrixFieldEvaluatorY {
1: list<double> evals
}

struct MatrixFieldEvaluator {
1: list<MatrixFieldEvaluatorY> evals
}

struct PlannerFieldEvaluator {
1: optional HeliosFieldEvaluator helios_field_evaluator,
2: optional MatrixFieldEvaluator matrix_field_evaluator
}

struct PlannerEvaluation {
1: PlannerEvaluationEffector effectors,
2: PlannerFieldEvaluator field_evaluators
}

struct HeliosOffensivePlanner {
1: bool direct_pass,
2: bool lead_pass,
Expand All @@ -771,7 +823,10 @@ struct HeliosOffensivePlanner {
7: bool simple_pass,
8: bool simple_dribble,
9: bool simple_shoot
10: bool server_side_decision
10: bool server_side_decision,
11: i32 max_depth,
12: i32 max_nodes,
13: PlannerEvaluation evaluation
}

struct HeliosBasicOffensive {}
Expand Down Expand Up @@ -861,7 +916,9 @@ struct PlayerActions {
1: list<PlayerAction> actions,
2: bool ignore_preprocess,
3: bool ignore_doforcekick,
4: bool ignore_doHeardPassRecieve
4: bool ignore_doHeardPassRecieve,
5: bool ignore_doIntention,
6: bool ignore_shootInPreprocess
}

struct ChangePlayerType {
Expand Down Expand Up @@ -1289,4 +1346,5 @@ service Game {
RegisterResponse Register(1: RegisterRequest request),
Empty SendByeCommand(1: RegisterResponse register_response),
BestPlannerActionResponse GetBestPlannerAction(1: BestPlannerActionRequest best_planner_action_request)
}
}

5 changes: 3 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def GetPlayerActions(self, state: State):
if state.world_model.myself.is_goalie:
actions.append(PlayerAction(helios_goalie=HeliosGoalie()))
elif state.world_model.myself.is_kickable:
# First action is the most important one
actions.append(PlayerAction(helios_shoot=HeliosShoot()))
actions.append(PlayerAction(helios_offensive_planner=HeliosOffensivePlanner(lead_pass=True,
direct_pass=True,
through_pass=True,
Expand All @@ -53,8 +55,7 @@ def GetPlayerActions(self, state: State):
simple_shoot=True,
simple_dribble=True,
cross=True,
server_side_decision=True)))
actions.append(PlayerAction(helios_shoot=HeliosShoot()))
server_side_decision=False)))
else:
actions.append(PlayerAction(helios_basic_move=HeliosBasicMove()))
else:
Expand Down
180 changes: 0 additions & 180 deletions soccer/Game-remote

This file was deleted.

Loading