Skip to content

Commit

Permalink
Merge pull request #50 from CLSFramework/develop-py2d
Browse files Browse the repository at this point in the history
Update proto and thrift definitions to version 1.8, add Neck_Offensiv…
  • Loading branch information
naderzare authored Dec 1, 2024
2 parents cb70fcc + dd481e0 commit 1193740
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 6 deletions.
22 changes: 22 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# ChangeLog

## [1.1.1] - 2024-12-01

### Added

- added Neck_OffensiveInterceptNeck into idls
- added HeliosBasicTackle into idls
- added start-debug-agent.sh file

### Fixed

- bug fixed in start-agent.sh

### Changed

-

### Developers

- [NaderZare](https://github.com/naderzare)

=======

## [1.1.0] - 2024-11-17

### Added
Expand Down
13 changes: 11 additions & 2 deletions idl/grpc/service.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// version 1.7
// version 1.8

syntax = "proto3";

Expand Down Expand Up @@ -835,6 +835,9 @@ message Neck_TurnToRelative {
float angle = 1;
}

message Neck_OffensiveInterceptNeck {
}

message View_ChangeWidth {
ViewWidth view_width = 1;
}
Expand Down Expand Up @@ -1284,6 +1287,11 @@ message HeliosPenalty {}

message HeliosCommunicaion {}

message HeliosBasicTackle {
float min_prob = 1;
float body_thr = 2;
}

message bhv_doForceKick {}

message bhv_doHeardPassRecieve {}
Expand Down Expand Up @@ -1356,7 +1364,8 @@ message PlayerAction {
HeliosCommunicaion helios_communication = 64;
bhv_doForceKick bhv_do_force_kick = 65;
bhv_doHeardPassRecieve bhv_do_heard_pass_recieve = 66;

HeliosBasicTackle helios_basic_tackle = 67;
Neck_OffensiveInterceptNeck neck_offensive_intercept_neck = 68;
}
}

Expand Down
13 changes: 11 additions & 2 deletions idl/thrift/soccer_service.thrift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// version 1.7
// version 1.8

namespace cpp soccer
namespace py soccer
Expand Down Expand Up @@ -743,6 +743,8 @@ struct Neck_TurnToRelative {
1: double angle
}

struct Neck_OffensiveInterceptNeck {}

struct View_ChangeWidth {
1: ViewWidth view_width
}
Expand Down Expand Up @@ -839,6 +841,11 @@ struct HeliosPenalty {}

struct HeliosCommunicaion {}

struct HeliosBasicTackle {
1: double min_prob,
2: double body_thr
}

struct bhv_doForceKick {}

struct bhv_doHeardPassRecieve {}
Expand Down Expand Up @@ -909,7 +916,9 @@ struct PlayerAction {
63: optional HeliosPenalty helios_penalty,
64: optional HeliosCommunicaion helios_communication,
65: optional bhv_doForceKick bhv_do_force_kick,
66: optional bhv_doHeardPassRecieve bhv_do_heard_pass_recieve
66: optional bhv_doHeardPassRecieve bhv_do_heard_pass_recieve,
67: optional HeliosBasicTackle helios_basic_tackle,
68: optional Neck_OffensiveInterceptNeck neck_offensive_intercept_neck
}

struct PlayerActions {
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ file(

# copy other files to the binary direcotry
file(COPY
formations-dt formations-keeper formations-taker player.conf coach.conf start-debug.sh start-offline.sh
formations-dt formations-keeper formations-taker player.conf coach.conf start-debug.sh start-offline.sh start-debug-agent.sh
DESTINATION ${PROJECT_BINARY_DIR}/bin
)
25 changes: 25 additions & 0 deletions src/grpc-client/grpc_client_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
#include "planner/action_chain_holder.h"
#include "planner/bhv_planned_action.h"
#include "player/strategy.h"
#include "player/bhv_basic_tackle.h"
#include "player/neck_offensive_intercept_neck.h"
#include <rcsc/player/say_message_builder.h>
#include <rcsc/common/player_param.h>

Expand Down Expand Up @@ -1022,6 +1024,16 @@ void GrpcClientPlayer::getActions()
rcsc::dlog.addText( rcsc::Logger::TEAM, __FILE__": Neck_TurnToRelative failed" );
}
}
else if (action.action_case() == PlayerAction::kNeckOffensiveInterceptNeck) {
if (Neck_OffensiveInterceptNeck().execute(agent))
{
rcsc::dlog.addText( rcsc::Logger::TEAM, __FILE__": Neck_OffensiveInterceptNeck performed" );
}
else
{
rcsc::dlog.addText( rcsc::Logger::TEAM, __FILE__": Neck_OffensiveInterceptNeck failed" );
}
}
else if (action.action_case() == PlayerAction::kViewChangeWidth) {
const auto &viewChangeWidth = action.view_change_width();
const rcsc::ViewWidth view_width = GrpcClient::convertViewWidth(viewChangeWidth.view_width());
Expand Down Expand Up @@ -1167,6 +1179,19 @@ void GrpcClientPlayer::getActions()
__FILE__": sample_communication failed" );
}
}
else if (action.action_case() == PlayerAction::kHeliosBasicTackle && !action_performed) {
const auto &helios_basic_tackle = action.helios_basic_tackle();
if (Bhv_BasicTackle( helios_basic_tackle.min_prob(), helios_basic_tackle.body_thr() ).execute(agent)) {
action_performed = true;
rcsc::dlog.addText( rcsc::Logger::TEAM,
__FILE__": Bhv_BasicTackle performed" );
}
else
{
rcsc::dlog.addText( rcsc::Logger::TEAM,
__FILE__": Bhv_BasicTackle failed" );
}
}
else if (action.action_case() == PlayerAction::kBhvDoForceKick && !action_performed)
{
if(doForceKick(agent))
Expand Down
2 changes: 2 additions & 0 deletions src/start-agent.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,14 @@ do

--goalie)
is_goalie="true"
is_player="false"
;;
--player)
is_player="true"
;;
--coach)
is_coach="true"
is_player="false"
;;
--fullstate)
if [ $# -lt 2 ]; then
Expand Down
3 changes: 3 additions & 0 deletions src/start-debug-agent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

./start-agent.sh --offline-logging --debug --debug-server-connect ${1+"$@"}
26 changes: 25 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,8 @@
#include "planner/action_chain_holder.h"
#include "planner/bhv_planned_action.h"
#include "player/strategy.h"
#include "player/bhv_basic_tackle.h"
#include "player/neck_offensive_intercept_neck.h"
#include <rcsc/player/say_message_builder.h>
#include <rcsc/common/player_param.h>

Expand Down Expand Up @@ -1008,6 +1010,16 @@ void ThriftClientPlayer::getActions()
__FILE__": Neck_TurnToRelative failed" );
}
}
else if (action.__isset.neck_offensive_intercept_neck) {
if (Neck_OffensiveInterceptNeck().execute(agent))
{
rcsc::dlog.addText( rcsc::Logger::TEAM, __FILE__": Neck_OffensiveInterceptNeck performed" );
}
else
{
rcsc::dlog.addText( rcsc::Logger::TEAM, __FILE__": Neck_OffensiveInterceptNeck failed" );
}
}
else if (action.__isset.view_change_width)
{
const auto &viewChangeWidth = action.view_change_width;
Expand Down Expand Up @@ -1178,7 +1190,19 @@ void ThriftClientPlayer::getActions()
rcsc::dlog.addText( rcsc::Logger::TEAM,
__FILE__": sample_communication failed" );
}

}
else if (action.__isset.helios_basic_tackle && !action_performed) {
const auto &helios_basic_tackle = action.helios_basic_tackle;
if (Bhv_BasicTackle( helios_basic_tackle.min_prob, helios_basic_tackle.body_thr ).execute(agent)) {
action_performed = true;
rcsc::dlog.addText( rcsc::Logger::TEAM,
__FILE__": Bhv_BasicTackle performed" );
}
else
{
rcsc::dlog.addText( rcsc::Logger::TEAM,
__FILE__": Bhv_BasicTackle failed" );
}
}
else if (action.__isset.bhv_do_force_kick && !action_performed)
{
Expand Down

0 comments on commit 1193740

Please sign in to comment.