LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
player_type_analyzer.h
Go to the documentation of this file.
1// -*-c++-*-
2
8/*
9 *Copyright:
10
11 Copyright (C) Hidehisa AKIYAMA
12
13 This code is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License as published by the Free Software Foundation; either
16 version 3 of the License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
27 *EndCopyright:
28 */
29
31
32#ifndef RCSC_COACH_PLAYER_TYPE_ANALYZER_H
33#define RCSC_COACH_PLAYER_TYPE_ANALYZER_H
34
36
37#include <rcsc/geom/vector_2d.h>
38#include <rcsc/game_time.h>
39#include <rcsc/types.h>
40
41#include <vector>
42
43namespace rcsc {
44
45class CoachWorldModel;
46
52private:
53
54 struct Data {
55 bool turned_;
56 bool kicked_;
57 bool tackling_;
58 bool maybe_referee_;
59 bool maybe_collide_;
60 bool maybe_kick_;
61 Vector2D pos_;
62 Vector2D vel_;
63 double body_;
64
66 std::vector< int > invalid_flags_;
67
68 int type_;
69
70 Data();
71 void setDefaultType();
72 void setUnknownType();
73 };
74
75 const CoachWorldModel & M_world;
76
77 GameTime M_updated_time;
78 PlayMode M_playmode;
79
80 CoachBallObject M_prev_ball;
81 Data M_teammate_data[11];
82 Data M_opponent_data[11];
83
84 std::vector< int > M_opponent_type_used_count;
85
87 PlayerTypeAnalyzer() = delete;
89 PlayerTypeAnalyzer( const PlayerTypeAnalyzer & ) = delete;
91 PlayerTypeAnalyzer & operator=( const PlayerTypeAnalyzer & ) = delete;
92public:
97 explicit
99
104 const GameTime & updatedTime() const
105 {
106 return M_updated_time;
107 }
108
112 void update();
113
114
121 void reset( const int unum );
122
128 int playerTypeId( const int unum ) const
129 {
130 if ( unum < 1 || 11 < unum )
131 {
132 std::cerr << "PlayerTypeAnalyzer::playerTypeId() Illegal unum "
133 << unum << std::endl;
134 return Hetero_Unknown;
135 }
136 return M_opponent_data[ unum - 1 ].type_;
137 }
138
139private:
140
144 void updateLastData();
145
149 void analyze();
150
154 void checkTurn();
155
159 void checkTackle();
160
164 void checkReferee();
165
169 void checkCollisions();
170
174 void checkKick();
175
179 void checkPlayerDecay();
180
184 void checkPlayerSpeedMax();
185
189 void checkTurnMoment();
190};
191
192}
193
194#endif
ball information for coath/trainer
Definition: coach_ball_object.h:44
world world for coach
Definition: coach_world_model.h:58
game time object
Definition: game_time.h:43
analyzer for opponent team players' player type
Definition: player_type_analyzer.h:51
int playerTypeId(const int unum) const
get opponent player's player type Id
Definition: player_type_analyzer.h:128
const GameTime & updatedTime() const
get the last updated time
Definition: player_type_analyzer.h:104
void update()
analyze world model.
PlayerTypeAnalyzer(const CoachWorldModel &world)
default constructor
void reset(const int unum)
reset all data for the specified player.
2D point vector class
Definition: vector_2d.h:46
ball object class for coach/trainer Header file.
game time depending on RCSSServer2D Header File
the type definition set for the RCSSServer2D
PlayMode
playmode types defined in rcssserver/src/types.h
Definition: types.h:130
constexpr int Hetero_Unknown
Id of the unknown player type.
Definition: types.h:122
2d vector class Header File.