LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rcsc::TrainerAgent Class Referenceabstract

basic trainer agent class More...

#include <trainer_agent.h>

Inheritance diagram for rcsc::TrainerAgent:
Inheritance graph
[legend]
Collaboration diagram for rcsc::TrainerAgent:
Collaboration graph
[legend]

Public Member Functions

 TrainerAgent ()
 initialize member variables
 
virtual ~TrainerAgent ()
 delete dynamic allocated memory
 
virtual std::shared_ptr< AbstractClientcreateConsoleClient ()
 create a client object (online or offline) according to the command line option. More...
 
void finalize ()
 finalize all things when the process exits
 
const TrainerConfigconfig () const
 get configuration set More...
 
const CoachWorldModelworld () const
 get field status More...
 
const CoachVisualSensorvisualSensor () const
 get the analyzed visual info More...
 
bool doCheckBall ()
 send check_ball command More...
 
bool doLook ()
 send look command More...
 
bool doTeamNames ()
 send team_name command More...
 
bool doEye (bool on)
 send eye command More...
 
bool doEar (bool on)
 send ear command More...
 
bool doKickOff ()
 send start command to kickoff the game More...
 
bool doMoveBall (const Vector2D &pos, const Vector2D &vel)
 send ball move command More...
 
bool doMovePlayer (const std::string &teamname, const int unum, const Vector2D &pos)
 send player move command More...
 
bool doMovePlayer (const std::string &teamname, const int unum, const Vector2D &pos, const AngleDeg &angle)
 send player move command More...
 
bool doRecover ()
 send recover command More...
 
bool doChangeMode (const PlayMode mode)
 send playmode change command More...
 
bool doChangePlayerType (const std::string &teamname, const int unum, const int type)
 send change_player_type command More...
 
bool doSay (const std::string &msg)
 send say command (coach language) More...
 
- Public Member Functions inherited from rcsc::SoccerAgent
 SoccerAgent ()
 nothing to do. just set NULL to M_client
 
virtual ~SoccerAgent ()
 virtual destructor.
 
bool init (CmdLineParser &cmd_parser)
 initialize with command line options. More...
 
void setClient (std::shared_ptr< AbstractClient > client)
 
virtual std::shared_ptr< AbstractClientcreateConsoleClient ()=0
 create standard console client object (online or offline) according to the command line option. More...
 

Protected Member Functions

virtual bool initImpl (CmdLineParser &cmd_parser)
 analyze command line options More...
 
virtual bool handleStart ()
 handle start event More...
 
virtual void handleMessage ()
 handle server message event More...
 
virtual void handleTimeout (const int timeout_count, const int waited_msec)
 handle timeout event More...
 
virtual void handleExit ()
 handle exit event More...
 
virtual void actionImpl ()=0
 pure virtual method. register decision. More...
 
virtual void handleInitMessage ()
 this method is called just after analyzing init message. Do NOT call this method by yourself.
 
virtual void handleServerParam ()
 this method is called just after analyzing server_param message. Do NOT call this method by yourself.
 
virtual void handlePlayerParam ()
 this method is called just after analyzing player_param message. Do NOT call this method by yourself.
 
virtual void handlePlayerType ()
 this method is called just after analyzing player_type message. Do NOT call this method by yourself.
 
- Protected Member Functions inherited from rcsc::SoccerAgent
virtual bool initImpl (CmdLineParser &cmd_parser)=0
 init interval status using command line options More...
 
virtual bool handleStart ()=0
 (pure virtual) handle start event More...
 
virtual bool handleStartOffline ()
 (virtual) handle start event in offline client mode. More...
 
virtual void handleMessage ()=0
 (pure virtual) handle server messege More...
 
virtual void handleMessageOffline ()
 (virtual) handle offline client log message in offline client mode. More...
 
virtual void handleTimeout (const int timeout_count, const int waited_msec)=0
 (pure virtual) handle timeout event More...
 
virtual void handleExit ()=0
 (pure virtual) handle exit event More...
 

Protected Attributes

TrainerConfig M_config
 configuration parameter set
 
CoachWorldModel M_worldmodel
 internal memory of field status
 
- Protected Attributes inherited from rcsc::SoccerAgent
std::shared_ptr< AbstractClientM_client
 interface to the rcssserver or offline log.
 

Detailed Description

basic trainer agent class

Member Function Documentation

◆ actionImpl()

virtual void rcsc::TrainerAgent::actionImpl ( )
protectedpure virtual

pure virtual method. register decision.

This method is used to set trainer's action. This method is called from action(). So, do NOT call this method by yourself.

◆ config()

const TrainerConfig & rcsc::TrainerAgent::config ( ) const
inline

get configuration set

Returns
const reference to the configuration class object

◆ createConsoleClient()

virtual std::shared_ptr< AbstractClient > rcsc::TrainerAgent::createConsoleClient ( )
virtual

create a client object (online or offline) according to the command line option.

Returns
client object pointer.

Implements rcsc::SoccerAgent.

◆ doChangeMode()

bool rcsc::TrainerAgent::doChangeMode ( const PlayMode  mode)

send playmode change command

Parameters
modenew playmode Id
Returns
true if command is generated and sent

◆ doChangePlayerType()

bool rcsc::TrainerAgent::doChangePlayerType ( const std::string &  teamname,
const int  unum,
const int  type 
)

send change_player_type command

Parameters
teamnametarget player's team name
unumtarget player's uniform number
typenew player type Id
Returns
true if command is generated and sent

◆ doCheckBall()

bool rcsc::TrainerAgent::doCheckBall ( )

send check_ball command

Returns
true if command is generated and sent

◆ doEar()

bool rcsc::TrainerAgent::doEar ( bool  on)

send ear command

on if true, send (ear on), else (ear off)

Returns
true if command is generated and sent

◆ doEye()

bool rcsc::TrainerAgent::doEye ( bool  on)

send eye command

on if true, send (eye on), else (eye off)

Returns
true if command is generated and sent

◆ doKickOff()

bool rcsc::TrainerAgent::doKickOff ( )

send start command to kickoff the game

Returns
true if command is generated and sent

◆ doLook()

bool rcsc::TrainerAgent::doLook ( )

send look command

Returns
true if command is generated and sent

◆ doMoveBall()

bool rcsc::TrainerAgent::doMoveBall ( const Vector2D pos,
const Vector2D vel 
)

send ball move command

Parameters
posnew position
velnew velocity
Returns
true if command is generated and sent

◆ doMovePlayer() [1/2]

bool rcsc::TrainerAgent::doMovePlayer ( const std::string &  teamname,
const int  unum,
const Vector2D pos 
)

send player move command

Parameters
teamnametarget player's team name
unumtarget player's uniform number
posnew position
Returns
true if command is generated and sent

◆ doMovePlayer() [2/2]

bool rcsc::TrainerAgent::doMovePlayer ( const std::string &  teamname,
const int  unum,
const Vector2D pos,
const AngleDeg angle 
)

send player move command

Parameters
teamnametarget player's team name
unumtarget player's uniform number
posnew position
anglenew body angle
Returns
true if command is generated and sent

◆ doRecover()

bool rcsc::TrainerAgent::doRecover ( )

send recover command

Returns
true if command is generated and sent

◆ doSay()

bool rcsc::TrainerAgent::doSay ( const std::string &  msg)

send say command (coach language)

Returns
true if command is generated and sent

◆ doTeamNames()

bool rcsc::TrainerAgent::doTeamNames ( )

send team_name command

Returns
true if command is generated and sent

◆ handleExit()

virtual void rcsc::TrainerAgent::handleExit ( )
protectedvirtual

handle exit event

Implements rcsc::SoccerAgent.

◆ handleMessage()

virtual void rcsc::TrainerAgent::handleMessage ( )
protectedvirtual

handle server message event

Do NOT call this method by yourself!

Implements rcsc::SoccerAgent.

◆ handleStart()

virtual bool rcsc::TrainerAgent::handleStart ( )
protectedvirtual

handle start event

Returns
status of start procedure.

This method is called on the top of BasicClient::run() method. The concrete agent must connect to the server and send init command. Do NOT call this method by yourself!

Implements rcsc::SoccerAgent.

◆ handleTimeout()

virtual void rcsc::TrainerAgent::handleTimeout ( const int  timeout_count,
const int  waited_msec 
)
protectedvirtual

handle timeout event

Parameters
timeout_countcount of timeout without sensory message.
waited_msecelapsed milli seconds sinc last sensory message.

This method is called when select() timeout occurs Do NOT call this method by yourself!

Implements rcsc::SoccerAgent.

◆ initImpl()

virtual bool rcsc::TrainerAgent::initImpl ( CmdLineParser cmd_parser)
protectedvirtual

analyze command line options

Parameters
cmd_parsercommand line parser object
Returns
only if "help" option is given, false is returned.

This method is called from SoccerAgent::init( argc, argv ) SoccerAgent::init(argc,argv) should be called in main(). Do NOT call this method by yourself!

Implements rcsc::SoccerAgent.

◆ visualSensor()

const CoachVisualSensor & rcsc::TrainerAgent::visualSensor ( ) const

get the analyzed visual info

Returns
const reference to the visual sensor instance

◆ world()

const CoachWorldModel & rcsc::TrainerAgent::world ( ) const
inline

get field status

Returns
const reference to the worldmodel instance

The documentation for this class was generated from the following file: