00001
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00031
00032 #ifndef RCSC_PLAYER_FULLSTATE_SENSOR_H
00033 #define RCSC_PLAYER_FULLSTATE_SENSOR_H
00034
00035 #include <rcsc/geom/vector_2d.h>
00036 #include <rcsc/game_time.h>
00037 #include <rcsc/types.h>
00038
00039 #include <vector>
00040 #include <iostream>
00041
00042 namespace rcsc {
00043
00048 class FullstateSensor {
00049 public:
00050
00054 struct BallT {
00055 Vector2D pos_;
00056 Vector2D vel_;
00057 };
00058
00062 struct PlayerT {
00063 SideID side_;
00064 int unum_;
00065 bool goalie_;
00066
00067 int type_;
00068
00069 Vector2D pos_;
00070 Vector2D vel_;
00071 double body_;
00072 double neck_;
00073
00074 double stamina_;
00075 double effort_;
00076 double recovery_;
00077
00079 double pointto_dist_;
00081 double pointto_dir_;
00082
00086 PlayerT()
00087 : side_( NEUTRAL )
00088 , unum_( Unum_Unknown )
00089 , goalie_( false )
00090 , type_( 0 )
00091 , pos_( Vector2D::INVALIDATED )
00092 , vel_( 0.0, 0.0 )
00093 , body_( 0.0 )
00094 , neck_( 0.0 )
00095 , stamina_( 0.0 )
00096 , effort_( 0.0 )
00097 , recovery_( 0.0 )
00098 , pointto_dist_( -1.0 )
00099 , pointto_dir_( 0.0 )
00100 { }
00101
00107 std::ostream & print( std::ostream & os ) const;
00108 };
00109
00110
00111 typedef std::vector< PlayerT > PlayerCont;
00112
00113 private:
00114 GameTime M_time;
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00144 BallT M_ball;
00146 PlayerCont M_left_team;
00148 PlayerCont M_right_team;
00149
00151 int M_left_score;
00153 int M_right_score;
00154
00159 void parseV7( const char * msg );
00160
00165 void parseV8( const char * msg );
00166 public:
00173 void parse( const char * msg,
00174 const double & version,
00175 const GameTime & current );
00176
00180 void reverse();
00181
00182
00183
00188 const
00189 GameTime & time() const
00190 {
00191 return M_time;
00192 }
00193
00198 const
00199 BallT & ball() const
00200 {
00201 return M_ball;
00202 }
00203
00208 const
00209 PlayerCont & leftTeam() const
00210 {
00211 return M_left_team;
00212 }
00213
00218 const
00219 PlayerCont & rightTeam() const
00220 {
00221 return M_right_team;
00222 }
00223
00228 int leftScore() const
00229 {
00230 return M_left_score;
00231 }
00232
00237 int rightScore() const
00238 {
00239 return M_right_score;
00240 }
00241
00247 std::ostream & print( std::ostream & os ) const;
00248
00253
00254 };
00255
00256 }
00257
00258 #endif