coach_agent.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_COACH_COACH_AGENT_H
00033 #define RCSC_COACH_COACH_AGENT_H
00034 
00035 #include <rcsc/coach/global_world_model.h>
00036 #include <rcsc/coach/coach_config.h>
00037 #include <rcsc/common/soccer_agent.h>
00038 #include <rcsc/common/team_graphic.h>
00039 
00040 #include <boost/scoped_ptr.hpp>
00041 
00042 #include <string>
00043 #include <set>
00044 
00045 namespace rcsc {
00046 
00047 class CoachAudioSensor;
00048 class CoachCommand;
00049 class GlobalVisualSensor;
00050 class SayMessageParser;
00051 
00052 struct CoachAgentImpl;
00053 
00058 class CoachAgent
00059     : public SoccerAgent {
00060 private:
00061 
00063     boost::scoped_ptr< CoachAgentImpl > M_impl;
00064 
00065 protected:
00066 
00068     CoachConfig M_config;
00069 
00071     GlobalWorldModel M_worldmodel;
00072 
00073 private:
00074 
00076     std::set< TeamGraphic::Index > M_team_graphic_ok_set;
00077 
00078 public:
00082     CoachAgent();
00086     virtual
00087     ~CoachAgent();
00088 
00093     const
00094     CoachConfig & config() const
00095       {
00096           return M_config;
00097       }
00098 
00103     const
00104     GlobalWorldModel & world() const
00105       {
00106           return M_worldmodel;
00107       }
00108 
00113     const
00114     GlobalVisualSensor & visualSensor() const;
00115 
00120     const
00121     CoachAudioSensor & audioSensor() const;
00122 
00127     const
00128     std::set< TeamGraphic::Index > & teamGraphicOKSet() const
00129       {
00130           return M_team_graphic_ok_set;
00131       }
00132 
00133 protected:
00143     virtual
00144     bool initImpl( CmdLineParser & cmd_parser );
00145 
00154     virtual
00155     bool handleStart();
00156 
00162     virtual
00163     void handleMessage();
00164 
00173     virtual
00174     void handleTimeout( const int timeout_count,
00175                         const int waited_msec );
00176 
00180     virtual
00181     void handleExit();
00182 
00187     void addSayMessageParser( boost::shared_ptr< SayMessageParser > parser );
00188 
00193     void removeSayMessageParser( const char header );
00194 
00195 public:
00199     void finalize();
00200 
00201 private:
00202 
00209     void sendInitCommand();
00210 
00215     void sendByeCommand();
00216 
00218 
00223     void parse( const char * msg );
00224 
00229     void analyzeInit( const char * msg );
00230 
00237     bool analyzeCycle( const char * msg,
00238                        const bool by_see_global );
00239 
00244     void analyzeSeeGlobal( const char * msg );
00245 
00250     void analyzeHear( const char * msg );
00251 
00256     void analyzeHearReferee( const char * msg );
00257 
00262     void analyzeHearPlayer( const char * msg );
00263 
00268     void analyzeChangePlayerType( const char * msg );
00269 
00274     void analyzePlayerType( const char * msg );
00275 
00280     void analyzePlayerParam( const char * msg );
00281 
00286     void analyzeServerParam( const char * msg );
00287 
00292     void analyzeCLangVer( const char * msg );
00293 
00298     void analyzeScore( const char * msg );
00299 
00304     void analyzeOK( const char * msg );
00305 
00310     void analyzeOKTeamGraphic( const char * msg );
00311 
00316     void analyzeTeamNames( const char * msg );
00317 
00322     void analyzeError( const char * msg );
00323 
00328     void analyzeWarning( const char * msg );
00329 
00334     void analyzeInclude( const char * msg );
00335 
00339     void action();
00340 
00346     bool sendCommand( const CoachCommand & com );
00347 
00348 public:
00353     bool doCheckBall();
00354 
00359     bool doLook();
00360 
00365     bool doTeamNames();
00366 
00367     //bool doTeamGraphic();
00368 
00374     bool doEye( bool on );
00375 
00382     bool doChangePlayerType( const int unum,
00383                              const int type );
00384 
00390     bool doChangePlayerTypes( const std::vector< std::pair< int, int > > & types );
00391 
00396     bool doSayFreeform( const std::string & msg );
00397 
00398 
00399     //bool doSendCLang( const CLang & lang );
00400 
00405     bool doTeamGraphic( const int x,
00406                         const int y,
00407                         const TeamGraphic & team_graphic );
00408 
00409 protected:
00410 
00418     virtual
00419     void actionImpl() = 0;
00420 };
00421 
00422 }
00423 
00424 #endif

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