LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
fullstate_sensor.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_PLAYER_FULLSTATE_SENSOR_H
33#define RCSC_PLAYER_FULLSTATE_SENSOR_H
34
35#include <rcsc/geom/vector_2d.h>
36#include <rcsc/game_time.h>
37#include <rcsc/types.h>
38
39#include <vector>
40#include <iostream>
41
42namespace rcsc {
43
49public:
50
55 struct BallT {
58 };
59
64 struct PlayerT {
66 int unum_;
67 bool goalie_;
68
69 int type_;
70
73 double body_;
74 double neck_;
75
76 double stamina_;
77 double effort_;
78 double recovery_;
80
84 double focus_dir_;
85
90
92 bool kicked_;
94 bool tackle_;
95
100
105 : side_( NEUTRAL ),
107 goalie_( false ),
108 type_( 0 ),
109 pos_( Vector2D::INVALIDATED ),
110 vel_( 0.0, 0.0 ),
111 body_( 0.0 ),
112 neck_( 0.0 ),
113 stamina_( 0.0 ),
114 effort_( 0.0 ),
115 recovery_( 0.0 ),
116 focus_dist_( 0.0 ),
117 focus_dir_( 0.0 ),
118 pointto_dist_( -1.0 ),
119 pointto_dir_( 0.0 ),
120 kicked_( false ),
121 tackle_( false ),
122 charged_( false ),
123 card_( NO_CARD )
124 { }
125
131 std::ostream & print( std::ostream & os ) const;
132 };
133
134
135 typedef std::vector< PlayerT > PlayerCont;
136
137private:
138
139 GameTime M_time;
140
141 /*
142 // Because sense_body message have the following information,
143 // it is not necessary to analyze these data.
144
145 std::string M_playmode_string; //!< playmode string
146
147 ViewQuality M_view_quality; //!< agent's view quality
148 ViewWidth M_view_width; //!< agent's view width
149
150 int M_kick_count; //!< executed command count
151 int M_dash_count; //!< executed command count
152 int M_turn_count; //!< executed command count
153 int M_catch_count; //!< executed command count
154 int M_move_count; //!< executed command count
155 int M_turn_neck_count; //!< executed command count
156 int M_change_view_count; //!< executed command count
157 int M_say_count; //!< executed command count
158
159 int M_arm_movable; //!< after this step, player can move the arm.
160 int M_arm_expires; //!< while this step, player continue to point out.
161 double M_pointto_dist; //!< pointing distance
162 double M_pointto_dir; //!< pointing angle. this is relative to face
163 int M_pointto_count; //!< sensed command count
164 */
165
166 // set the information of left-hand-side orientation
167
168 BallT M_ball;
169 PlayerCont M_our_players;
170 PlayerCont M_their_players;
171
172 int M_our_score;
173 int M_their_score;
174
175
176public:
177
182
183private:
184
189 void parseV7( const char * msg,
190 const SideID our_side );
191
196 void parseV8( const char * msg,
197 const SideID our_side );
198
202 void reverseSide();
203
204public:
212 void parse( const char * msg,
213 const SideID our_side,
214 const double version,
215 const GameTime & current );
216
217 // accessor method
218
223 const GameTime & time() const
224 {
225 return M_time;
226 }
227
232 const BallT & ball() const
233 {
234 return M_ball;
235 }
236
241 const PlayerCont & ourPlayers() const
242 {
243 return M_our_players;
244 }
245
250 const PlayerCont & theirPlayers() const
251 {
252 return M_their_players;
253 }
254
259 int ourScore() const
260 {
261 return M_our_score;
262 }
263
268 int theirScore() const
269 {
270 return M_their_score;
271 }
272
278 std::ostream & print( std::ostream & os ) const;
279
280};
281
282}
283
284#endif
fullstate info holder
Definition: fullstate_sensor.h:48
std::vector< PlayerT > PlayerCont
player information container
Definition: fullstate_sensor.h:135
int theirScore() const
get right team score
Definition: fullstate_sensor.h:268
void parse(const char *msg, const SideID our_side, const double version, const GameTime &current)
parse server message
int ourScore() const
get left team score
Definition: fullstate_sensor.h:259
std::ostream & print(std::ostream &os) const
put all fullstate info to stream
const BallT & ball() const
get analyzed ball data
Definition: fullstate_sensor.h:232
const PlayerCont & theirPlayers() const
get analyzed right team data
Definition: fullstate_sensor.h:250
FullstateSensor()
their team score
const PlayerCont & ourPlayers() const
get analyzed left team data
Definition: fullstate_sensor.h:241
const GameTime & time() const
get updated time
Definition: fullstate_sensor.h:223
game time object
Definition: game_time.h:43
2D point vector class
Definition: vector_2d.h:46
game time depending on RCSSServer2D Header File
fullstate ball info
Definition: fullstate_sensor.h:55
Vector2D vel_
ball velocity
Definition: fullstate_sensor.h:57
Vector2D pos_
ball position
Definition: fullstate_sensor.h:56
fullstate player info
Definition: fullstate_sensor.h:64
PlayerT()
initialize member variables
Definition: fullstate_sensor.h:104
int unum_
uniform number
Definition: fullstate_sensor.h:66
double recovery_
recovery value
Definition: fullstate_sensor.h:78
int type_
player type id
Definition: fullstate_sensor.h:69
bool kicked_
v13+ true if player kicked.
Definition: fullstate_sensor.h:92
double stamina_
stamina value
Definition: fullstate_sensor.h:76
Vector2D pos_
global position
Definition: fullstate_sensor.h:71
bool charged_
v14+ foul charged
Definition: fullstate_sensor.h:97
double effort_
effort value
Definition: fullstate_sensor.h:77
double focus_dist_
v18+. disntance to the focus point
Definition: fullstate_sensor.h:82
std::ostream & print(std::ostream &os) const
output to stream
Vector2D vel_
velocity
Definition: fullstate_sensor.h:72
double stamina_capacity_
stamina capacity value
Definition: fullstate_sensor.h:79
SideID side_
left or right
Definition: fullstate_sensor.h:65
double pointto_dist_
v8+. distance from pos_ to pointing point
Definition: fullstate_sensor.h:87
double neck_
neck angle relative to body angle
Definition: fullstate_sensor.h:74
double focus_dir_
v18+. direction to the focus point
Definition: fullstate_sensor.h:84
Card card_
v14+ card status
Definition: fullstate_sensor.h:99
double body_
body angle
Definition: fullstate_sensor.h:73
double pointto_dir_
v8+. pointing direction direction relative to face(=body+neck)
Definition: fullstate_sensor.h:89
bool tackle_
v13+ true if player is tackling.
Definition: fullstate_sensor.h:94
bool goalie_
goalie flag (v8+ only)
Definition: fullstate_sensor.h:67
the type definition set for the RCSSServer2D
SideID
side type definition
Definition: types.h:47
Card
card type
Definition: types.h:281
constexpr int Unum_Unknown
uniform number that represents the unknown player
Definition: types.h:41
2d vector class Header File.