Skip to content
Closed

dddd #52

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
18 changes: 18 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# ChangeLog

## [1.1.2] - 2024-12-08

### Added
- ServerParams.pitch_margin
- Player.inertia_final_point, PenaltyKickState.cycle, self.get_safety_dash_power.
- bhv_goalieFreeKick added

### Fixed
-

### Changed
-

### Developers
- [SoroushMazloum](https://github.com/SoroushMazloum)

=======

## [1.1.1] - 2024-12-01

### Added
Expand Down
9 changes: 8 additions & 1 deletion idl/grpc/service.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// version 1.8
// version 1.9

syntax = "proto3";

Expand Down Expand Up @@ -135,6 +135,7 @@ message PenaltyKickState {
int32 our_score = 5;
int32 their_score = 6;
bool is_kick_taker = 7;
int32 cycle = 8;
}

/**
Expand Down Expand Up @@ -172,6 +173,7 @@ message Player {
int32 ball_reach_steps = 28; // How many cycles the player needs to reach the ball.
bool is_tackling = 29; // Whether the player is tackling or not.
int32 type_id = 30; // The type identifier of the player.
RpcVector2D inertia_final_point = 31;
}

/**
Expand Down Expand Up @@ -220,6 +222,7 @@ message Self {
CardType card = 39; // The card type of the agent. It can be NO_CARD, YELLOW, or RED.
int32 catch_time = 40; // The time when the last catch command is performed.
float effort = 41; // The effort of the agent. TODO more info
float get_safety_dash_power = 42;
}

/**
Expand Down Expand Up @@ -1296,6 +1299,8 @@ message bhv_doForceKick {}

message bhv_doHeardPassRecieve {}

message bhv_goalieFreeKick {}

message PlayerAction {
oneof action {
Dash dash = 1;
Expand Down Expand Up @@ -1366,6 +1371,7 @@ message PlayerAction {
bhv_doHeardPassRecieve bhv_do_heard_pass_recieve = 66;
HeliosBasicTackle helios_basic_tackle = 67;
Neck_OffensiveInterceptNeck neck_offensive_intercept_neck = 68;
bhv_goalieFreeKick bhv_goalie_free_kick = 69;
}
}

Expand Down Expand Up @@ -1668,6 +1674,7 @@ message ServerParam {
float goal_area_length = 224;
float center_circle_r = 225;
float goal_post_radius = 226;
float pitch_margin = 227;
}

message PlayerParam {
Expand Down
18 changes: 17 additions & 1 deletion idl/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<a name="top"></a>


## Version: 1.8
## Version: 1.9

## Table of Contents

Expand Down Expand Up @@ -156,6 +156,7 @@
- [WorldModel.TheirPlayersDictEntry](#protos-WorldModel-TheirPlayersDictEntry)
- [bhv_doForceKick](#protos-bhv_doForceKick)
- [bhv_doHeardPassRecieve](#protos-bhv_doHeardPassRecieve)
- [bhv_goalieFreeKick](#protos-bhv_goalieFreeKick)

- [AgentType](#protos-AgentType)
- [CardType](#protos-CardType)
Expand Down Expand Up @@ -1962,6 +1963,7 @@ return pb2.PlayerActions(actions=actions)
| our_score | [int32](#int32) | | |
| their_score | [int32](#int32) | | |
| is_kick_taker | [bool](#bool) | | |
| cycle | [int32](#int32) | | |



Expand Down Expand Up @@ -2110,6 +2112,7 @@ To get type information of the player, you can use the type_id field and player
| ball_reach_steps | [int32](#int32) | | How many cycles the player needs to reach the ball. |
| is_tackling | [bool](#bool) | | Whether the player is tackling or not. |
| type_id | [int32](#int32) | | The type identifier of the player. |
| inertia_final_point | [RpcVector2D](#protos-RpcVector2D) | | |



Expand Down Expand Up @@ -2192,6 +2195,7 @@ To get type information of the player, you can use the type_id field and player
| bhv_do_heard_pass_recieve | [bhv_doHeardPassRecieve](#protos-bhv_doHeardPassRecieve) | | |
| helios_basic_tackle | [HeliosBasicTackle](#protos-HeliosBasicTackle) | | |
| neck_offensive_intercept_neck | [Neck_OffensiveInterceptNeck](#protos-Neck_OffensiveInterceptNeck) | | |
| bhv_goalie_free_kick | [bhv_goalieFreeKick](#protos-bhv_goalieFreeKick) | | |



Expand Down Expand Up @@ -2565,6 +2569,7 @@ When an agent send a message to the playmaker server, self is information about
| card | [CardType](#protos-CardType) | | The card type of the agent. It can be NO_CARD, YELLOW, or RED. |
| catch_time | [int32](#int32) | | The time when the last catch command is performed. |
| effort | [float](#float) | | The effort of the agent. TODO more info |
| get_safety_dash_power | [float](#float) | | |



Expand Down Expand Up @@ -2822,6 +2827,7 @@ When an agent send a message to the playmaker server, self is information about
| goal_area_length | [float](#float) | | |
| center_circle_r | [float](#float) | | |
| goal_post_radius | [float](#float) | | |
| pitch_margin | [float](#float) | | |



Expand Down Expand Up @@ -3274,6 +3280,16 @@ WorldModel is the message that represents the world model in the soccer simulati




<a name="protos-bhv_goalieFreeKick"></a>

### bhv_goalieFreeKick









Expand Down
17 changes: 12 additions & 5 deletions idl/thrift/soccer_service.thrift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// version 1.8
// version 1.9

namespace cpp soccer
namespace py soccer
Expand Down Expand Up @@ -112,7 +112,8 @@ struct PenaltyKickState {
4: i32 their_taker_counter,
5: i32 our_score,
6: i32 their_score,
7: bool is_kick_taker
7: bool is_kick_taker,
8: i32 cycle
}

struct Player {
Expand Down Expand Up @@ -145,7 +146,8 @@ struct Player {
27: double angle_from_ball,
28: i32 ball_reach_steps,
29: bool is_tackling,
30: i32 type_id
30: i32 type_id,
31: RpcVector2D inertia_final_point
}

struct Self {
Expand Down Expand Up @@ -189,7 +191,8 @@ struct Self {
38: double stamina_capacity,
39: CardType card,
40: i32 catch_time,
41: double effort
41: double effort,
42: double get_safety_dash_power
}

enum InterceptActionType {
Expand Down Expand Up @@ -850,6 +853,8 @@ struct bhv_doForceKick {}

struct bhv_doHeardPassRecieve {}

struct bhv_goalieFreeKick {}

struct PlayerAction {
1: optional Dash dash,
2: optional Turn turn,
Expand Down Expand Up @@ -919,6 +924,7 @@ struct PlayerAction {
66: optional bhv_doHeardPassRecieve bhv_do_heard_pass_recieve,
67: optional HeliosBasicTackle helios_basic_tackle,
68: optional Neck_OffensiveInterceptNeck neck_offensive_intercept_neck
69: optional bhv_goalieFreeKick bhv_goalie_free_kick
}

struct PlayerActions {
Expand Down Expand Up @@ -1215,7 +1221,8 @@ struct ServerParam {
223: double goal_area_width,
224: double goal_area_length,
225: double center_circle_r,
226: double goal_post_radius
226: double goal_post_radius,
227: double pitch_margin
}

struct PlayerParam {
Expand Down
1 change: 1 addition & 0 deletions src/grpc-client/grpc_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ void GrpcClient::sendServerParam() const
serverParam.set_goal_area_length(SP.goalAreaLength());
serverParam.set_center_circle_r(SP.centerCircleR());
serverParam.set_goal_post_radius(SP.goalPostRadius());
serverParam.set_pitch_margin(SP.pitchMargin());
ClientContext context;
protos::Empty empty;
protos::RegisterResponse* response = new protos::RegisterResponse(*M_register_response);
Expand Down
12 changes: 12 additions & 0 deletions src/grpc-client/grpc_client_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include "planner/actgen_action_chain_length_filter.h"
#include "planner/action_chain_holder.h"
#include "planner/bhv_planned_action.h"
#include "player/bhv_goalie_free_kick.h"
#include "player/strategy.h"
#include "player/bhv_basic_tackle.h"
#include "player/neck_offensive_intercept_neck.h"
Expand Down Expand Up @@ -898,6 +899,17 @@ void GrpcClientPlayer::getActions()
rcsc::dlog.addText( rcsc::Logger::TEAM, __FILE__": Neck_ScanPlayers failed" );
}
}
else if (action.action_case() == PlayerAction::kBhvGoalieFreeKick && !action_performed) {
if (Bhv_GoalieFreeKick().execute(agent))
{
action_performed = true;
rcsc::dlog.addText( rcsc::Logger::TEAM, __FILE__": Bhv_GoalieFreeKick performed" );
}
else
{
rcsc::dlog.addText( rcsc::Logger::TEAM, __FILE__": Bhv_GoalieFreeKick failed" );
}
}
else if (action.action_case() == PlayerAction::kNeckTurnToBallAndPlayer) {
const auto &neckTurnToBallAndPlayer = action.neck_turn_to_ball_and_player();
const rcsc::AbstractPlayerObject *player = nullptr;
Expand Down
4 changes: 3 additions & 1 deletion src/grpc-client/state_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ protos::Self *StateGenerator::convertSelf(const rcsc::SelfObject &self, const rc
res->set_card(convertCardType(self.card()));
res->set_catch_time(self.catchTime().cycle());
res->set_effort(static_cast<float>(self.effort()));
res->set_get_safety_dash_power(static_cast<float>(self.getSafetyDashPower(rcsc::ServerParam::i().maxDashPower())));
return res;
}

Expand Down Expand Up @@ -246,7 +247,7 @@ protos::PenaltyKickState *StateGenerator::convertPenaltyKickState(const rcsc::Wo
res->set_our_score(state->ourScore());
res->set_their_score(state->theirScore());
res->set_is_kick_taker(state->isKickTaker(wm.ourSide(), wm.self().unum()));

res->set_cycle(state->time().cycle());
return res;
}

Expand Down Expand Up @@ -288,6 +289,7 @@ void StateGenerator::updatePlayerObject(protos::Player *p, const rcsc::PlayerObj
p->set_ball_reach_steps(player->ballReachStep());
p->set_is_tackling(player->isTackling());
p->set_type_id(player->playerTypePtr()->id());
p->set_allocated_inertia_final_point(convertVector2D(player->inertiaFinalPoint()));
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/thrift-client/thrift_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ void ThriftAgent::sendServerParam() const
serverParam.goal_area_length = SP.goalAreaLength();
serverParam.center_circle_r = SP.centerCircleR();
serverParam.goal_post_radius = SP.goalPostRadius();
serverParam.pitch_margin = SP.pitchMargin();
try{
soccer::Empty empty;
serverParam.register_response = M_register_response;
Expand Down
16 changes: 15 additions & 1 deletion src/thrift-client/thrift_client_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include "planner/action_chain_holder.h"
#include "planner/bhv_planned_action.h"
#include "player/strategy.h"
#include "player/bhv_goalie_free_kick.h"
#include "player/bhv_basic_tackle.h"
#include "player/neck_offensive_intercept_neck.h"
#include <rcsc/player/say_message_builder.h>
Expand Down Expand Up @@ -1227,9 +1228,22 @@ void ThriftClientPlayer::getActions()
__FILE__": doHeardPassReceive performed" );
}
else
{
agent->debugClient().addMessage("doHeardPassReceive failed");
}
}
else if(action.__isset.bhv_goalie_free_kick && !action_performed)
{
if (Bhv_GoalieFreeKick().execute(agent))
{
action_performed = true;
rcsc::dlog.addText( rcsc::Logger::TEAM,
__FILE__": Bhv_GoalieFreeKick performed" );
}
else
{
rcsc::dlog.addText( rcsc::Logger::TEAM,
__FILE__": doHeardPassReceive failed" );
__FILE__": Bhv_GoalieFreeKick failed" );
}
}
else if (action.__isset.helios_offensive_planner && !action_performed)
Expand Down
4 changes: 3 additions & 1 deletion src/thrift-client/thrift_state_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ soccer::Self ThriftStateGenerator::convertSelf(const rcsc::SelfObject &self, con
res.card = convertCardType(self.card());
res.catch_time = self.catchTime().cycle();
res.effort = static_cast<float>(self.effort());
res.get_safety_dash_power = static_cast<float>(self.getSafetyDashPower(rcsc::ServerParam::i().maxDashPower()));
return res;
}

Expand Down Expand Up @@ -255,7 +256,7 @@ soccer::PenaltyKickState ThriftStateGenerator::convertPenaltyKickState(const rcs
res.our_score = state->ourScore();
res.their_score = state->theirScore();
res.is_kick_taker = state->isKickTaker(wm.ourSide(), wm.self().unum());

res.cycle = state->time().cycle();
return res;
}

Expand Down Expand Up @@ -304,6 +305,7 @@ void ThriftStateGenerator::updatePlayerObject(soccer::Player & p, const rcsc::Pl
{
p.type_id = player->playerTypePtr()->id();
}
p.inertia_final_point = convertVector2D(player->inertiaFinalPoint());
}

/**
Expand Down
Loading