LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
player_state.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_COMMON_PLAYER_STATE_H
33#define RCSC_COMMON_PLAYER_STATE_H
34
35#include <rcsc/geom/vector_2d.h>
36#include <rcsc/types.h>
37
38#include <vector>
39#include <iostream>
40
41namespace rcsc {
42
43class PlayerType;
44
45/*-------------------------------------------------------------------*/
46
52public:
53
55 typedef std::vector< const PlayerState * > Cont;
56
57private:
58
59 SideID M_side;
60 int M_unum;
61 bool M_goalie;
62 const PlayerType * M_player_type;
63
64 Vector2D M_pos;
65 Vector2D M_vel;
66 AngleDeg M_body;
67 AngleDeg M_face;
68
69 // StaminaModel M_stamina; //!< estimated stamina value
70
71 // bool M_kicking; //!< true if player performed the kick.
72 // int M_tackle_cycle; //!< if player is tackling, this value is incremented
73 // int M_charged_cycle; //!< if player is charged, this value is incremented
74
75 Card M_card;
76
77public:
78
83
88 bool isValid() const
89 {
90 return M_side != NEUTRAL;
91 }
92
97 SideID side() const
98 {
99 return M_side;
100 }
101
106 int unum() const
107 {
108 return M_unum;
109 }
110
115 bool goalie() const
116 {
117 return M_goalie;
118 }
119
124 const PlayerType * playerType() const
125 {
126 return M_player_type;
127 }
128
133 const Vector2D & pos() const
134 {
135 return M_pos;
136 }
137
142 const Vector2D & vel() const
143 {
144 return M_vel;
145 }
146
151 const AngleDeg & body() const
152 {
153 return M_body;
154 }
155
160 const AngleDeg & face() const
161 {
162 return M_face;
163 }
164
169 Card card() const
170 {
171 return M_card;
172 }
173
175
182 void setTeam( const SideID side,
183 const int unum,
184 const bool goalie )
185 {
186 M_side = side;
187 M_unum = unum;
188 M_goalie = goalie;
189 }
190
195 void setPlayerType( const int type );
196
201 void setPlayerType( const PlayerType * type )
202 {
203 M_player_type = type;
204 }
205
211 void setPos( const double x,
212 const double y )
213 {
214 M_pos.assign( x, y );
215 }
216
222 void setVel( const double vx,
223 const double vy )
224 {
225 M_vel.assign( vx, vy );
226 }
227
233 void setAngle( const double b,
234 const double n )
235 {
236 M_body = b;
237 M_face = b + n;
238 }
239
243 void setCard( const Card card )
244 {
245 M_card = card;
246 }
247
248};
249
250}
251
252#endif
degree wrapper class
Definition: angle_deg.h:45
player state data
Definition: player_state.h:51
void setAngle(const double b, const double n)
set body and neck angle with seen information
Definition: player_state.h:233
void setPos(const double x, const double y)
set position with seen information
Definition: player_state.h:211
SideID side() const
get side info
Definition: player_state.h:97
const AngleDeg & body() const
get player's body angle
Definition: player_state.h:151
const Vector2D & vel() const
get player's velocity
Definition: player_state.h:142
void setCard(const Card card)
set card status
Definition: player_state.h:243
PlayerState()
inititialize all value with 0 or invalid values
void setVel(const double vx, const double vy)
set velocity with seen information
Definition: player_state.h:222
void setPlayerType(const PlayerType *type)
set player type
Definition: player_state.h:201
std::vector< const PlayerState * > Cont
container type of the const PlayerState pointer
Definition: player_state.h:55
int unum() const
get player's uniform number
Definition: player_state.h:106
bool isValid() const
check if this player is valid or not.
Definition: player_state.h:88
void setPlayerType(const int type)
set player type by giving type id
const PlayerType * playerType() const
get the pointer to player type object
Definition: player_state.h:124
const Vector2D & pos() const
get player's position
Definition: player_state.h:133
Card card() const
get current card status.
Definition: player_state.h:169
const AngleDeg & face() const
get player's global face angle
Definition: player_state.h:160
bool goalie() const
check if this player is goalie
Definition: player_state.h:115
void setTeam(const SideID side, const int unum, const bool goalie)
set team data with seen information
Definition: player_state.h:182
heterogeneous player parametor class
Definition: player_type.h:50
2D point vector class
Definition: vector_2d.h:46
Vector2D & assign(const double xx, const double yy)
assign XY value directly.
Definition: vector_2d.h:100
the type definition set for the RCSSServer2D
SideID
side type definition
Definition: types.h:47
Card
card type
Definition: types.h:281
2d vector class Header File.