LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
coach_agent.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_COACH_AGENT_H
33#define RCSC_COACH_COACH_AGENT_H
34
41
42#include <memory>
43#include <string>
44#include <set>
45
46namespace rcsc {
47
48class CLangMessage;
49class CoachAudioSensor;
50class CoachCommand;
51class GlobalVisualSensor;
52class SayMessageParser;
53
59 : public SoccerAgent {
60private:
61
62 struct Impl;
63
65 std::unique_ptr< Impl > M_impl;
66
67protected:
68
71
74
77
78public:
86 virtual
88
93 virtual
94 std::shared_ptr< AbstractClient > createConsoleClient();
95
99 void finalize();
100
104 const
106 {
107 return M_config;
108 }
109
110
116 {
117 return M_debug_client;
118 }
119
124 const CoachWorldModel & world() const
125 {
126 return M_worldmodel;
127 }
128
134
140
145 const std::set< TeamGraphic::Index > & teamGraphicOKSet() const;
146
152
157 bool doLook();
158
164
165 //bool doTeamGraphic();
166
172 bool doEye( bool on );
173
180 bool doChangePlayerType( const int unum,
181 const int type );
182
188 bool doChangePlayerTypes( const std::vector< std::pair< int, int > > & types );
189
190 /*
191 \brief send freeform message by say command
192 \return true if command is generated and sent
193 */
194 // bool doSayFreeform( const std::string & msg );
195
201
207 bool removeFreeformMessage( const std::string & type );
208
213 void doSendCLang( const CLangMessage * msg );
214
219 bool doTeamGraphic( const int x,
220 const int y,
221 const TeamGraphic & team_graphic );
222
223private:
224
229 void parse( const char * msg );
230
234 void action();
235
241 bool sendCommand( const CoachCommand & com );
242
243protected:
244
254 virtual
255 bool initImpl( CmdLineParser & cmd_parser );
256
265 virtual
267
276 virtual
278
284 virtual
286
287
293 virtual
295
304 virtual
305 void handleTimeout( const int timeout_count,
306 const int waited_msec );
307
311 virtual
313
314 //
315 //
316 //
317
323 virtual
324 void actionImpl() = 0;
325
326
331 virtual
333 { }
334
339 virtual
341 { }
342
347 virtual
349 { }
350
355 virtual
357 { }
358
363 virtual
365 { }
366
371 virtual
373 { }
374
380
385 void removeSayMessageParser( const char header );
386
387};
388
389}
390
391#endif
abstract clang message
Definition: clang_message.h:46
command line parser
Definition: cmd_line_parser.h:49
abstract coach agent class
Definition: coach_agent.h:59
virtual ~CoachAgent()
delete dynamic allocated memory
virtual void handleInitMessage()
this method is called just after analyzing init message. Do NOT call this method by yourself.
Definition: coach_agent.h:348
bool doChangePlayerTypes(const std::vector< std::pair< int, int > > &types)
send change_player_types command
virtual bool initImpl(CmdLineParser &cmd_parser)
analyze command line options
bool doEye(bool on)
send eye command
const CoachVisualSensor & visualSensor() const
get visual sensor.
const CoachConfig & config() const
finalize all things when the process exits
Definition: coach_agent.h:105
void removeSayMessageParser(const char header)
remove registered parser object
virtual void handlePlayerParam()
this method is called just after analyzing player_param message. Do NOT call this method by yourself.
Definition: coach_agent.h:364
bool doCheckBall()
send check_ball command
virtual void handleMessageOffline()
handle offline client log messages in offline client mode.
CoachWorldModel M_worldmodel
internal memory of field status
Definition: coach_agent.h:76
virtual void handleServerParam()
this method is called just after analyzing server_param message. Do NOT call this method by yourself.
Definition: coach_agent.h:356
virtual void actionImpl()=0
pure virtual method. the decision making procedure implemented by team developper....
virtual void handleMessage()
handle server message event
bool doLook()
send look command
bool doTeamGraphic(const int x, const int y, const TeamGraphic &team_graphic)
send team_graphic command
const CoachAudioSensor & audioSensor() const
get audio sensor
bool removeFreeformMessage(const std::string &type)
remove the registered say message if exist
virtual void handleActionStart()
This method is called at the top of action(). Do not call this method by yourself.
Definition: coach_agent.h:332
virtual bool handleStart()
handle start event
virtual std::shared_ptr< AbstractClient > createConsoleClient()
create a client object (online or offline) according to the command line option.
CoachDebugClient M_debug_client
debug client interface
Definition: coach_agent.h:73
virtual void handlePlayerType()
this method is called just after analyzing player_type message. Do NOT call this method by yourself.
Definition: coach_agent.h:372
void addSayMessageParser(SayMessageParser *parser)
register new say message parser object
virtual bool handleStartOffline()
handle start event in offline client mode.
void doSendCLang(const CLangMessage *msg)
set clang message to the queue
void finalize()
finalize program process
CoachConfig M_config
configuration parameter set
Definition: coach_agent.h:70
virtual void handleActionEnd()
This method is called at the end of action() but before the debug output. Do not call this method by ...
Definition: coach_agent.h:340
bool doChangePlayerType(const int unum, const int type)
send change_player_type command
virtual void handleTimeout(const int timeout_count, const int waited_msec)
handle timeout event
virtual void handleExit()
handle exit event
CoachDebugClient & debugClient()
get debug client interface
Definition: coach_agent.h:115
bool doTeamNames()
send team_name command
const CoachWorldModel & world() const
get field status
Definition: coach_agent.h:124
void addFreeformMessage(FreeformMessage::Ptr message)
add freeform message to the message queue.
CoachAgent()
init member variables
const std::set< TeamGraphic::Index > & teamGraphicOKSet() const
get team_graphic ok flags
players' communication message handler class
Definition: coach_audio_sensor.h:53
abstract coach command class
Definition: coach_command.h:48
coach configuration parameters
Definition: coach_config.h:47
Definition: coach_debug_client.h:50
visual sensor for coach/trainer
Definition: coach_visual_sensor.h:49
world world for coach
Definition: coach_world_model.h:58
std::shared_ptr< const FreeformMessage > Ptr
pointer type
Definition: freeform_message.h:50
abstract player's say message parser
Definition: say_message_parser.h:50
abstract soccer agent class
Definition: soccer_agent.h:54
team graphic data management class
Definition: team_graphic.h:46
coach configuration Header File
interface for visual debug server Header File
coach/trainer world model class Header File
freeform message builder Header File
abstract soccer agent class Header File.
team graphic data class Header File