Skip to content

Commit 098ddc2

Browse files
authored
Merge pull request #30 from CLSFramework/develop
Develop
2 parents ae81de6 + 36a9f84 commit 098ddc2

13 files changed

+345
-29
lines changed

ChangeLog.md

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,68 @@
11
# ChangeLog
22

3+
## [1.0.4] - 2024-10-8
4+
5+
### Added
6+
- self.effort and wm.see_time are added
7+
8+
### Fixed
9+
-
10+
11+
### Changed
12+
-
13+
14+
### Developer
15+
- [SoroushMazloum](https://github.com/SoroushMazloum)
16+
17+
18+
## [1.0.3] - 2024-10-7
19+
20+
### Added
21+
- penalty_kick_state has been added to the proxy in the WorldModel message.
22+
23+
### Fixed
24+
-
25+
26+
### Changed
27+
-
28+
29+
### Developer
30+
- [SadraKhanjari](https://github.com/SK2iP)
31+
- [SoroushMazloum](https://github.com/SoroushMazloum)
32+
33+
34+
## [1.0.2] - 2024-09-15
35+
36+
### Added
37+
- ignore_doforcekick and ignore_doHeardPassRecieve has been added to the proxy in the actions message.
38+
- now users can decide to do the doForceKick and doHeardPassRecieve or not
39+
40+
### Fixed
41+
- now state only generate once per cycle
42+
43+
### Changed
44+
-
45+
46+
### Developer
47+
- [NaderZare](https://github.com/naderzare)
48+
- [SadraKhanjari](https://github.com/SK2iP)
49+
350
## [1.0.1] - 2024-09-15
451

552
### Added
653
- catch_time has been added to the proxy in the self message.
54+
- kickable_opponent_existance and kickable_teammate_existance has been added to the proxy in the worldmodel message.
55+
- bhv_doforceKick action has been added as a message and to the actions message.
756

857
### Fixed
958
-
1059

1160
### Changed
1261
-
1362

14-
### Engineers
15-
- [SoroushMazloum](https://github.com/)
63+
### Developer
64+
- [SoroushMazloum](https://github.com/SoroushMazloum)
65+
- [SadraKhanjari](https://github.com/SK2iP)
1666

1767
## [1.0.0] - 2024-09-15
1868

@@ -27,7 +77,7 @@
2777
### Changed
2878
- changed chain_action messages name to planner
2979

30-
### Engineers
80+
### Developer
3181
- [NaderZare](https://github.com/naderzare)
3282
- [SadraKhanjari](https://github.com/SK2iP)
3383

idl/grpc/service.proto

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// version 1
1+
// version 1.4
22

33
syntax = "proto3";
44

@@ -102,6 +102,16 @@ enum CardType {
102102
RED = 2;
103103
}
104104

105+
message PenaltyKickState {
106+
Side on_field_side = 1;
107+
Side current_taker_side = 2;
108+
int32 our_taker_counter = 3;
109+
int32 their_taker_counter = 4;
110+
int32 our_score = 5;
111+
int32 their_score = 6;
112+
bool is_kick_taker = 7;
113+
}
114+
105115
message Player {
106116
RpcVector2D position = 1;
107117
RpcVector2D seen_position = 2;
@@ -175,6 +185,8 @@ message Self {
175185
float recovery = 37;
176186
float stamina_capacity = 38;
177187
CardType card = 39;
188+
int32 catch_time = 40;
189+
float effort = 41;
178190
}
179191

180192
enum InterceptActionType {
@@ -282,6 +294,10 @@ message WorldModel {
282294
double their_defense_line_x = 33;
283295
double our_defense_player_line_x = 34;
284296
double their_defense_player_line_x = 35;
297+
bool kickable_teammate_existance = 36;
298+
bool kickable_opponent_existance = 37;
299+
PenaltyKickState penalty_kick_state = 38;
300+
int32 see_time = 39;
285301
}
286302

287303
message State {
@@ -799,6 +815,10 @@ message HeliosPenalty {}
799815

800816
message HeliosCommunicaion {}
801817

818+
message bhv_doForceKick {}
819+
820+
message bhv_doHeardPassRecieve {}
821+
802822
message PlayerAction {
803823
oneof action {
804824
Dash dash = 1;
@@ -865,13 +885,17 @@ message PlayerAction {
865885
HeliosSetPlay helios_set_play = 62;
866886
HeliosPenalty helios_penalty = 63;
867887
HeliosCommunicaion helios_communication = 64;
888+
bhv_doForceKick bhv_do_force_kick = 65;
889+
bhv_doHeardPassRecieve bhv_do_heard_pass_recieve = 66;
868890

869891
}
870892
}
871893

872894
message PlayerActions {
873895
repeated PlayerAction actions = 1;
874896
bool ignore_preprocess = 2;
897+
bool ignore_doforcekick = 3;
898+
bool ignore_doHeardPassRecieve = 4;
875899
}
876900

877901
message ChangePlayerType {
@@ -1299,4 +1323,4 @@ service Game {
12991323
rpc Register(RegisterRequest) returns (RegisterResponse) {}
13001324
rpc SendByeCommand(RegisterResponse) returns (Empty) {}
13011325
rpc GetBestPlannerAction(BestPlannerActionRequest) returns (BestPlannerActionResponse) {}
1302-
}
1326+
}

idl/thrift/soccer_service.thrift

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// version 1
1+
// version 1.4
22

33
namespace cpp soccer
44
namespace py soccer
@@ -105,6 +105,16 @@ enum CardType {
105105
RED = 2
106106
}
107107

108+
struct PenaltyKickState {
109+
1: Side on_field_side,
110+
2: Side current_taker_side,
111+
3: i32 our_taker_counter,
112+
4: i32 their_taker_counter,
113+
5: i32 our_score,
114+
6: i32 their_score,
115+
7: bool is_kick_taker
116+
}
117+
108118
struct Player {
109119
1: RpcVector2D position,
110120
2: RpcVector2D seen_position,
@@ -177,7 +187,9 @@ struct Self {
177187
36: double kick_rate,
178188
37: double recovery,
179189
38: double stamina_capacity,
180-
39: CardType card
190+
39: CardType card,
191+
40: i32 catch_time,
192+
41: double effort
181193
}
182194

183195
enum InterceptActionType {
@@ -284,7 +296,11 @@ struct WorldModel {
284296
32: double our_defense_line_x,
285297
33: double their_defense_line_x,
286298
34: double our_defense_player_line_x,
287-
35: double their_defense_player_line_x
299+
35: double their_defense_player_line_x,
300+
36: bool kickable_teammate_existance,
301+
37: bool kickable_opponent_existance,
302+
38: PenaltyKickState penalty_kick_state,
303+
39: i32 see_time
288304
}
289305

290306
struct State {
@@ -765,6 +781,10 @@ struct HeliosPenalty {}
765781

766782
struct HeliosCommunicaion {}
767783

784+
struct bhv_doForceKick {}
785+
786+
struct bhv_doHeardPassRecieve {}
787+
768788
struct PlayerAction {
769789
1: optional Dash dash,
770790
2: optional Turn turn,
@@ -829,12 +849,16 @@ struct PlayerAction {
829849
61: optional HeliosBasicMove helios_basic_move,
830850
62: optional HeliosSetPlay helios_set_play,
831851
63: optional HeliosPenalty helios_penalty,
832-
64: optional HeliosCommunicaion helios_communication
852+
64: optional HeliosCommunicaion helios_communication,
853+
65: optional bhv_doForceKick bhv_do_force_kick,
854+
66: optional bhv_doHeardPassRecieve bhv_do_heard_pass_recieve
833855
}
834856

835857
struct PlayerActions {
836858
1: list<PlayerAction> actions,
837-
2: bool ignore_preprocess
859+
2: bool ignore_preprocess,
860+
3: bool ignore_doforcekick,
861+
4: bool ignore_doHeardPassRecieve
838862
}
839863

840864
struct ChangePlayerType {

src/grpc-client/grpc_client_player.cpp

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ void GrpcClientPlayer::getActions()
109109
{
110110
auto agent = M_agent;
111111
bool pre_process = checkPreprocess(agent);
112+
bool do_forceKick = checkdoForceKick(agent);
113+
bool do_heardPassReceive = checkdoHeardPassReceive(agent);
112114
State state = generateState();
113115
state.set_need_preprocess(pre_process);
114116
protos::RegisterResponse* response = new protos::RegisterResponse(*M_register_response);
@@ -134,6 +136,26 @@ void GrpcClientPlayer::getActions()
134136
}
135137
}
136138

139+
if (do_forceKick && !actions.ignore_doforcekick())
140+
{
141+
if (doForceKick(agent))
142+
{
143+
rcsc::dlog.addText( rcsc::Logger::TEAM,
144+
__FILE__": doForceKick done" );
145+
return;
146+
}
147+
}
148+
149+
if (do_heardPassReceive && !actions.ignore_doheardpassrecieve())
150+
{
151+
if (doHeardPassReceive(agent))
152+
{
153+
rcsc::dlog.addText( rcsc::Logger::TEAM,
154+
__FILE__": doHeardPassReceive done" );
155+
return;
156+
}
157+
}
158+
137159
for (int i = 0; i < actions.actions_size(); i++)
138160
{
139161
auto action = actions.actions(i);
@@ -376,6 +398,10 @@ void GrpcClientPlayer::getActions()
376398
.execute(agent);
377399
agent->debugClient().addMessage("Neck_TurnToBallAndPlayer");
378400
}
401+
else
402+
{
403+
agent->debugClient().addMessage("Neck_TurnToBallAndPlayer null player");
404+
}
379405
}
380406
else if (action.action_case() == PlayerAction::kNeckTurnToBallOrScan) {
381407
const auto &neckTurnToBallOrScan = action.neck_turn_to_ball_or_scan();
@@ -416,6 +442,10 @@ void GrpcClientPlayer::getActions()
416442
.execute(agent);
417443
agent->debugClient().addMessage("Neck_TurnToPlayerOrScan");
418444
}
445+
else
446+
{
447+
agent->debugClient().addMessage("Neck_TurnToPlayerOrScan null player");
448+
}
419449
}
420450
else if (action.action_case() == PlayerAction::kNeckTurnToPoint) {
421451
const auto &neckTurnToPoint = action.neck_turn_to_point();
@@ -490,6 +520,28 @@ void GrpcClientPlayer::getActions()
490520
sample_communication->execute(agent);
491521
agent->debugClient().addMessage("sample_communication - execute");
492522
}
523+
else if (action.action_case() == PlayerAction::kBhvDoForceKick)
524+
{
525+
if(doForceKick(agent))
526+
{
527+
agent->debugClient().addMessage("doForceKick");
528+
}
529+
else
530+
{
531+
agent->debugClient().addMessage("doForceKick - false");
532+
}
533+
}
534+
else if (action.action_case() == PlayerAction::kBhvDoHeardPassRecieve)
535+
{
536+
if(doHeardPassReceive(agent))
537+
{
538+
agent->debugClient().addMessage("doHeardPassReceive");
539+
}
540+
else
541+
{
542+
agent->debugClient().addMessage("doHeardPassReceive - false");
543+
}
544+
}
493545
else if (action.action_case() == PlayerAction::kHeliosOffensivePlanner) {
494546
FieldEvaluator::ConstPtr field_evaluator = FieldEvaluator::ConstPtr(new SampleFieldEvaluator);
495547
CompositeActionGenerator *g = new CompositeActionGenerator();
@@ -785,14 +837,20 @@ void GrpcClientPlayer::addSayMessage(protos::Say sayMessage) const
785837
}
786838
}
787839

788-
State GrpcClientPlayer::generateState() const
840+
protos::State GrpcClientPlayer::generateState()
789841
{
790842
const rcsc::WorldModel &wm = M_agent->world();
843+
if (M_state_update_time == wm.time())
844+
{
845+
return M_state;
846+
}
847+
M_state_update_time = wm.time();
791848
WorldModel *worldModel = StateGenerator::convertWorldModel(wm);
792849
addHomePosition(worldModel);
793-
State state;
850+
protos::State state;
794851
state.set_allocated_world_model(worldModel);
795-
return state;
852+
M_state = state;
853+
return M_state;
796854
}
797855

798856
void GrpcClientPlayer::addHomePosition(protos::WorldModel *res) const

src/grpc-client/grpc_client_player.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class GrpcClientPlayer : public GrpcClient, public RpcPlayerClient
2020
bool GetBestPlannerAction();
2121
void convertResultPairToRpcActionStatePair( google::protobuf::Map<int32_t, protos::RpcActionState> * map);
2222
void addSayMessage(protos::Say sayMessage) const;
23-
State generateState() const;
23+
State generateState();
2424
void addHomePosition(protos::WorldModel *world_model) const;
25+
private:
26+
rcsc::GameTime M_state_update_time;
27+
protos::State M_state;
2528
};

0 commit comments

Comments
 (0)