LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
coach_player_object.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_OBJECT_H
33#define RCSC_COACH_PLAYER_OBJECT_H
34
37#include <rcsc/geom/vector_2d.h>
38#include <rcsc/types.h>
39
40#include <vector>
41#include <iostream>
42
43namespace rcsc {
44
45namespace rcg {
46struct PlayerT;
47}
48
49/*-------------------------------------------------------------------*/
50
56public:
57
59 typedef std::vector< const CoachPlayerObject * > Cont;
60
61private:
62
63 SideID M_side;
64 int M_unum;
65 bool M_goalie;
66 int M_type;
67 const PlayerType * M_player_type;
68
69 Vector2D M_pos;
70 Vector2D M_vel;
71
72 AngleDeg M_body;
73 AngleDeg M_face;
74
75 StaminaModel M_stamina;
76
77 int M_pointto_cycle; //< if player is pointing, this value in incremented
78 AngleDeg M_pointto_angle;
79
80 bool M_kicking;
81 int M_tackle_cycle;
82 int M_charged_cycle;
83
84 Card M_card;
85
86 //
87
88 int M_ball_reach_step;
89
90public:
91
96
102
107 bool isValid() const
108 {
109 return M_side != NEUTRAL;
110 }
111
116 SideID side() const
117 {
118 return M_side;
119 }
120
125 int unum() const
126 {
127 return M_unum;
128 }
129
134 bool goalie() const
135 {
136 return M_goalie;
137 }
138
143 int type() const
144 {
145 return M_type;
146 }
147
152 const PlayerType * playerTypePtr() const
153 {
154 return M_player_type;
155 }
156
161 const Vector2D & pos() const
162 {
163 return M_pos;
164 }
165
170 const Vector2D & vel() const
171 {
172 return M_vel;
173 }
174
179 const AngleDeg & body() const
180 {
181 return M_body;
182 }
183
188 const AngleDeg & face() const
189 {
190 return M_face;
191 }
192
198 {
199 return M_stamina;
200 }
201
206 double stamina() const
207 {
208 return M_stamina.stamina();
209 }
210
215 double effort() const
216 {
217 return M_stamina.effort();
218 }
219
224 double recovery() const
225 {
226 return M_stamina.recovery();
227 }
228
233 double staminaCapacity() const
234 {
235 return M_stamina.capacity();
236 }
237
244 int pointtoCycle() const
245 {
246 return M_pointto_cycle;
247 }
248
253 const AngleDeg & pointtoAngle() const
254 {
255 return M_pointto_angle;
256 }
257
262 bool isPointing() const
263 {
264 return ( M_pointto_cycle > 0 );
265 }
266
271 bool isKicking() const
272 {
273 return M_kicking;
274 }
275
282 int tackleCycle() const
283 {
284 return M_tackle_cycle;
285 }
286
291 bool isTackling() const
292 {
293 return ( M_tackle_cycle > 0 );
294 }
295
300 int chargedCycle() const
301 {
302 return M_charged_cycle;
303 }
304
309 bool isCharged() const
310 {
311 return ( M_charged_cycle > 0 );
312 }
313
318 Card card() const
319 {
320 return M_card;
321 }
322
327 int ballReachStep() const
328 {
329 return M_ball_reach_step;
330 }
331
333
340 void setTeam( const SideID side,
341 const int unum,
342 const bool goalie )
343 {
344 M_side = side;
345 M_unum = unum;
346 M_goalie = goalie;
347 }
348
353 void setPlayerType( const int type );
354
355
360 void changePlayerType( const int type );
361
367 void setPos( const double x,
368 const double y )
369 {
370 M_pos.assign( x, y );
371 }
372
378 void setVel( const double vx,
379 const double vy )
380 {
381 M_vel.assign( vx, vy );
382 }
383
389 void setAngle( const double b,
390 const double n )
391 {
392 M_body = b;
393 M_face = b + n;
394 }
395
400 void setStamina( const double s )
401 {
402 M_stamina.setStamina( s );
403 }
404
409 void setEffort( const double e )
410 {
411 M_stamina.setEffort( e );
412 }
413
418 void setRecovery( const double r )
419 {
420 M_stamina.setRecovery( r );
421 }
422
427 void setStaminaCapacity( const double c )
428 {
429 M_stamina.setCapacity( c );
430 }
431
436 void setArm( const double angle )
437 {
438 M_pointto_cycle = 1;
439 M_pointto_angle = angle;
440 }
441
446 void setKicking( const bool on )
447 {
448 M_kicking = on;
449 }
450
455 {
456 M_tackle_cycle = 1;
457 }
458
459 void setCharged()
460 {
461 M_charged_cycle = 1;
462 }
463
467 void setCard( const Card card )
468 {
469 M_card = card;
470 }
471
472
473 void setBallReachStep( const int step )
474 {
475 M_ball_reach_step = step;
476 }
477
482 void update( const CoachPlayerObject & p );
483
488 void update( const rcg::PlayerT & p );
489
494
499 {
500 M_pos.reverse();
501 M_vel.reverse();
502 M_body += 180.0;
503 M_face += 180.0;
504 if ( isPointing() ) M_pointto_angle += 180.0;
505 }
506
512 std::ostream & print( std::ostream & os ) const;
513
514};
515
516}
517
518#endif
degree wrapper class
Definition: angle_deg.h:45
player information for coath/trainer
Definition: coach_player_object.h:55
void setRecovery(const double r)
set player's recovery information
Definition: coach_player_object.h:418
void setAngle(const double b, const double n)
set body and neck angle with seen information
Definition: coach_player_object.h:389
const Vector2D & vel() const
get player's velocity
Definition: coach_player_object.h:170
const Vector2D & pos() const
get player's position
Definition: coach_player_object.h:161
void setKicking(const bool on)
set kick state
Definition: coach_player_object.h:446
std::ostream & print(std::ostream &os) const
put data to the output stream
bool isPointing() const
check if player is pointing or not
Definition: coach_player_object.h:262
double staminaCapacity() const
get player's stamina capacity value
Definition: coach_player_object.h:233
CoachPlayerObject * clone() const
create clone object
const AngleDeg & face() const
get player's global face angle
Definition: coach_player_object.h:188
bool isKicking() const
check if player performed a kick.
Definition: coach_player_object.h:271
int pointtoCycle() const
get player's pointto status
Definition: coach_player_object.h:244
int ballReachStep() const
get the estimated interception step. negative value means this player never intercept the ball.
Definition: coach_player_object.h:327
int unum() const
get player's uniform number
Definition: coach_player_object.h:125
void reverseSide()
reverse positional value
Definition: coach_player_object.h:498
void changePlayerType(const int type)
change player type (recover stamina and reset card)
int chargedCycle() const
get player's charged status
Definition: coach_player_object.h:300
std::vector< const CoachPlayerObject * > Cont
container type of const CoachPlayerObject*
Definition: coach_player_object.h:59
bool isTackling() const
check if player is tackling or not
Definition: coach_player_object.h:291
SideID side() const
get side info
Definition: coach_player_object.h:116
double recovery() const
get player's recovery value
Definition: coach_player_object.h:224
void setStaminaCapacity(const double c)
set player's stamina capacity information
Definition: coach_player_object.h:427
int type() const
get player type id
Definition: coach_player_object.h:143
void setPos(const double x, const double y)
set position with seen information
Definition: coach_player_object.h:367
const AngleDeg & pointtoAngle() const
get player's global arm angle
Definition: coach_player_object.h:253
void setPlayerType(const int type)
set player type id
double effort() const
get player's effort value
Definition: coach_player_object.h:215
bool isValid() const
check if this player is valid or not.
Definition: coach_player_object.h:107
void setVel(const double vx, const double vy)
set velocity with seen information
Definition: coach_player_object.h:378
const AngleDeg & body() const
get player's body angle
Definition: coach_player_object.h:179
void setCard(const Card card)
set card status
Definition: coach_player_object.h:467
const StaminaModel & staminaModel() const
get player's stamina model data
Definition: coach_player_object.h:197
void update(const CoachPlayerObject &p)
update with seen data
void update(const rcg::PlayerT &p)
update using game log data
Card card() const
get current card status.
Definition: coach_player_object.h:318
double stamina() const
get player's stamina value
Definition: coach_player_object.h:206
bool isCharged() const
check if player is charged or not
Definition: coach_player_object.h:309
bool goalie() const
check if this player is goalie
Definition: coach_player_object.h:134
int tackleCycle() const
get player's tackle status
Definition: coach_player_object.h:282
void setTeam(const SideID side, const int unum, const bool goalie)
set team data with seen information
Definition: coach_player_object.h:340
void setStamina(const double s)
set player's stamina information
Definition: coach_player_object.h:400
const PlayerType * playerTypePtr() const
get the pointer to player type object
Definition: coach_player_object.h:152
void recoverStamina()
reset stamina to the initial value
void setTackle()
set tackle status
Definition: coach_player_object.h:454
CoachPlayerObject()
inititialize all value with 0 or invalid values
void setEffort(const double e)
set player's effort information
Definition: coach_player_object.h:409
void setArm(const double angle)
set arm status with seen information
Definition: coach_player_object.h:436
heterogeneous player parametor class
Definition: player_type.h:50
stamina management class
Definition: stamina_model.h:44
double capacity() const
get the current remained stamina capacity
Definition: stamina_model.h:103
const StaminaModel & setStamina(const double new_stamina)
set new stamina value
Definition: stamina_model.h:152
double recovery() const
get current recovery value
Definition: stamina_model.h:85
double effort() const
get current effort value
Definition: stamina_model.h:94
const StaminaModel & setCapacity(const double new_capacity)
set new stamina capacity value
Definition: stamina_model.h:183
const StaminaModel & setRecovery(const double new_recovery)
set new recovery value
Definition: stamina_model.h:173
double stamina() const
get current stamina value
Definition: stamina_model.h:76
const StaminaModel & setEffort(const double new_effort)
set new effort value
Definition: stamina_model.h:163
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
Vector2D & reverse()
reverse vector components
Definition: vector_2d.h:397
heterogenious player parametor Header File
player's stamina model Header File
generic player data for display information
Definition: types.h:597
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.