fullstate_sensor.h

説明を見る。
00001 // -*-c++-*-
00002 
00008 /*
00009  *Copyright:
00010 
00011  Copyright (C) Hidehisa AKIYAMA
00012 
00013  This code is free software; you can redistribute it and/or
00014  modify it under the terms of the GNU Lesser General Public
00015  License as published by the Free Software Foundation; either
00016  version 2.1 of the License, or (at your option) any later version.
00017 
00018  This library is distributed in the hope that it will be useful,
00019  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  Lesser General Public License for more details.
00022 
00023  You should have received a copy of the GNU Lesser General Public
00024  License along with this library; if not, write to the Free Software
00025  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 
00027  *EndCopyright:
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_; // body angle
00072         double neck_; // neck angle relative to body angle
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     // Following data are included in sense_body.
00118     // So, it is not necessary to analyze these data
00119 
00120     std::string M_playmode_str; //!< playmode string
00121 
00122     ViewQuality M_view_quality; //!< agent's view quality
00123     ViewWidth M_view_width; //!< agent's view width
00124 
00125     int M_kick_count; //!< executed command count
00126     int M_dash_count; //!< executed command count
00127     int M_turn_count; //!< executed command count
00128     int M_catch_count; //!< executed command count
00129     int M_move_count; //!< executed command count
00130     int M_turn_neck_count; //!< executed command count
00131     int M_change_view_count; //!< executed command count
00132     int M_say_count; //!< executed command count
00133 
00134     int M_arm_movable; //!< after this step, player can move the arm.
00135     int M_arm_expires; //!< while this step, player continue to point out.
00136     double M_pointto_dist; //!< pointing distance
00137     double M_pointto_dir; //!< pointing angle. this is relative to face
00138     int M_pointto_count; //!< sensed command count
00139     */
00140 
00141     // set the information of left-hand-side orientation
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     // accessor method
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     //void printWithWorld( const WorldModel & world ) const;
00254 };
00255 
00256 }
00257 
00258 #endif

librcscに対してThu May 1 15:41:21 2008に生成されました。  doxygen 1.5.0