LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
|
basic player agent class More...
#include <player_agent.h>
Public Member Functions | |
PlayerAgent () | |
create internal modules | |
virtual | ~PlayerAgent () |
virtual destructor | |
virtual std::shared_ptr< AbstractClient > | createConsoleClient () |
create a client object (online or offline) according to the command line option. More... | |
void | finalize () |
finalize all things when the process exits | |
const PlayerConfig & | config () const |
get configuration set More... | |
DebugClient & | debugClient () |
get debug client interface More... | |
const WorldModel & | world () const |
get worldmodel More... | |
const WorldModel & | fullstateWorld () const |
get fullstate worldmodel More... | |
const ActionEffector & | effector () const |
get action effector More... | |
const BodySensor & | bodySensor () const |
get body sensor More... | |
const VisualSensor & | visualSensor () const |
get visual sensor More... | |
const AudioSensor & | audioSensor () const |
get audio sensor More... | |
const FullstateSensor & | fullstateSensor () const |
get fullstate sensor More... | |
const SeeState & | seeState () const |
get see state More... | |
const TimeStamp & | bodyTimeStamp () const |
get time stamp when sense_body message is received More... | |
const TimeStamp & | seeTimeStamp () const |
get time stamp of see message when see message is received More... | |
bool | doKick (const double &power, const AngleDeg &rel_dir) |
register kick command More... | |
bool | doDash (const double &power, const AngleDeg &rel_dir=0.0) |
register dash command More... | |
bool | doTurn (const AngleDeg &moment) |
register turn command More... | |
bool | doCatch () |
register catch command. catch direction is automatically calculated. More... | |
bool | doMove (const double &x, const double &y) |
register move command More... | |
bool | doTackle (const double &power_or_dir, const bool foul=false) |
register tackle command More... | |
bool | doTurnNeck (const AngleDeg &moment) |
register turn_neck command. More... | |
bool | doChangeView (const ViewWidth &width) |
register change_view command. More... | |
bool | doChangeFocus (const double moment_dist, const AngleDeg &moment_dir) |
register change_focus command More... | |
bool | doPointto (const double &x, const double &y) |
register pointto command. More... | |
bool | doPointtoOff () |
register pointto command. turn off mode More... | |
bool | doAttentionto (SideID side, const int unum) |
register attentionto command by off mode More... | |
bool | doAttentiontoOff () |
register attentionto command. turn off mode More... | |
void | setArmAction (ArmAction *act) |
reserve pointto action More... | |
void | setNeckAction (NeckAction *act) |
reserve turn neck action More... | |
void | setViewAction (ViewAction *act) |
reserve change view action More... | |
void | setFocusAction (FocusAction *act) |
reserve change_focus action More... | |
void | addSayMessage (SayMessage *message) |
add say message to the action effector More... | |
bool | removeSayMessage (const char header) |
remove the registered say message if exist More... | |
void | clearSayMessage () |
remove all registered say messages | |
void | setIntention (SoccerIntention *intention) |
set intention object More... | |
bool | doIntention () |
execute queued intention if exist. More... | |
![]() | |
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< AbstractClient > | createConsoleClient ()=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 bool | handleStartOffline () |
handle start event in offline client mode. More... | |
virtual void | handleMessage () |
handle server message event More... | |
virtual void | handleMessageOffline () |
handle offline client log message in offline client mode. 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 body action to ActionEffector. More... | |
virtual void | communicationImpl () |
virtual method. register say action to ActionEffector More... | |
virtual void | handleActionStart () |
This method is called at the top of action(). Do not call this method by yourself. | |
virtual void | handleActionEnd () |
This method is called at the end of action() but before the debug output. Do not call this method by yourself. | |
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. | |
virtual void | handleOnlineCoachAudio () |
this method is called just after analyzing online coach's say message. Do not call this method by yourself. | |
void | addSayMessageParser (SayMessageParser *parser) |
register new say message parser object More... | |
void | removeSayMessageParser (const char header) |
remove registered parser object More... | |
void | addFreeformMessageParser (FreeformMessageParser *parser) |
set new freeform message parser More... | |
void | removeFreeformMessageParser (const std::string &type) |
remove registered parser object More... | |
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 | |
PlayerConfig | M_config |
configuration parameter set | |
DebugClient | M_debug_client |
debug client interface | |
WorldModel | M_worldmodel |
mental memory of world status | |
WorldModel | M_fullstate_worldmodel |
mental memory of fullstate world status | |
ActionEffector | M_effector |
action info manager | |
![]() | |
std::shared_ptr< AbstractClient > | M_client |
interface to the rcssserver or offline log. | |
basic player agent class
|
protectedpure virtual |
pure virtual method. register body action to ActionEffector.
This method is used to set player's body action. Do not call this method by yourself because this method is called automatically.
|
protected |
set new freeform message parser
parser | pointer to the dynamically allocated parser object. |
void rcsc::PlayerAgent::addSayMessage | ( | SayMessage * | message | ) |
add say message to the action effector
message | pointer to the dynamically allocated object. |
|
protected |
register new say message parser object
parser | pointer to the dynamically allocated parser object. |
const AudioSensor & rcsc::PlayerAgent::audioSensor | ( | ) | const |
get audio sensor
const BodySensor & rcsc::PlayerAgent::bodySensor | ( | ) | const |
get body sensor
const TimeStamp & rcsc::PlayerAgent::bodyTimeStamp | ( | ) | const |
get time stamp when sense_body message is received
|
inlineprotectedvirtual |
virtual method. register say action to ActionEffector
This method is called just after turn_neck action. Do not call this method by yourself because this method is called automatically.
|
inline |
get configuration set
|
virtual |
create a client object (online or offline) according to the command line option.
Implements rcsc::SoccerAgent.
|
inline |
get debug client interface
bool rcsc::PlayerAgent::doAttentionto | ( | SideID | side, |
const int | unum | ||
) |
register attentionto command by off mode
side | target player's side |
unum | target player's uniform number |
bool rcsc::PlayerAgent::doAttentiontoOff | ( | ) |
register attentionto command. turn off mode
bool rcsc::PlayerAgent::doCatch | ( | ) |
register catch command. catch direction is automatically calculated.
bool rcsc::PlayerAgent::doChangeFocus | ( | const double | moment_dist, |
const AngleDeg & | moment_dir | ||
) |
register change_focus command
moment_dist | distance added to the current focus point |
moment_dir | direction added to the current focus point |
bool rcsc::PlayerAgent::doChangeView | ( | const ViewWidth & | width | ) |
register change_view command.
width | new view width |
ViewQuality should not be changed by user
bool rcsc::PlayerAgent::doDash | ( | const double & | power, |
const AngleDeg & | rel_dir = 0.0 |
||
) |
register dash command
power | command argument: dash power |
rel_dir | command argument: dash direction relative to body (or reverse body) angle |
bool rcsc::PlayerAgent::doIntention | ( | ) |
execute queued intention if exist.
true | if action is executed |
false | if queue is empty, or action is failed. |
bool rcsc::PlayerAgent::doKick | ( | const double & | power, |
const AngleDeg & | rel_dir | ||
) |
register kick command
power | command argument: kick power |
rel_dir | command argument kick direction relative to body angle |
bool rcsc::PlayerAgent::doMove | ( | const double & | x, |
const double & | y | ||
) |
register move command
x | move target x |
y | move target y |
bool rcsc::PlayerAgent::doPointto | ( | const double & | x, |
const double & | y | ||
) |
register pointto command.
x | target point x |
y | target point y |
bool rcsc::PlayerAgent::doPointtoOff | ( | ) |
register pointto command. turn off mode
bool rcsc::PlayerAgent::doTackle | ( | const double & | power_or_dir, |
const bool | foul = false |
||
) |
register tackle command
power_or_dir | tackle power or direction |
foul | foul mode switch |
bool rcsc::PlayerAgent::doTurn | ( | const AngleDeg & | moment | ) |
register turn command
moment | command argument: turn moment |
bool rcsc::PlayerAgent::doTurnNeck | ( | const AngleDeg & | moment | ) |
register turn_neck command.
moment | turn neck moment |
|
inline |
get action effector
const FullstateSensor & rcsc::PlayerAgent::fullstateSensor | ( | ) | const |
get fullstate sensor
|
inline |
get fullstate worldmodel
|
protectedvirtual |
handle exit event
Implements rcsc::SoccerAgent.
|
protectedvirtual |
handle server message event
This method is called from AbstractClient::run() method. Do NOT call this method by yourself!
Implements rcsc::SoccerAgent.
|
protectedvirtual |
handle offline client log message in offline client mode.
This method is called when offline client log message is read.
Reimplemented from rcsc::SoccerAgent.
|
protectedvirtual |
handle start event
This method is called when client starts to run. The concrete agent must connect to the server and send init command. Do NOT call this method by yourself!
Implements rcsc::SoccerAgent.
|
protectedvirtual |
handle start event in offline client mode.
This method is called at the top of AbstractClient::run() method. The concrete agent must connect to the server and send init command. Do NOT call this method by yourself!
Reimplemented from rcsc::SoccerAgent.
|
protectedvirtual |
handle timeout event
timeout_count | count of timeout without sensory message. |
waited_msec | elapsed milliseconds since last sensory message. This method is called from AbstractClient::run() method. Do NOT call this method by yourself! |
Implements rcsc::SoccerAgent.
|
protectedvirtual |
analyze command line options
cmd_parser | command line parser object |
This method is called from SoccerAgent::init( argc, argv ) SoccerAgent::init(argc,argv) should be called in main().
Implements rcsc::SoccerAgent.
|
protected |
remove registered parser object
type | freeform message type string |
bool rcsc::PlayerAgent::removeSayMessage | ( | const char | header | ) |
remove the registered say message if exist
header | message header character |
|
protected |
remove registered parser object
header | say message header character |
const SeeState & rcsc::PlayerAgent::seeState | ( | ) | const |
get see state
const TimeStamp & rcsc::PlayerAgent::seeTimeStamp | ( | ) | const |
get time stamp of see message when see message is received
void rcsc::PlayerAgent::setArmAction | ( | ArmAction * | act | ) |
reserve pointto action
act | pointer to the action. must be a dynamically allocated object. |
void rcsc::PlayerAgent::setFocusAction | ( | FocusAction * | act | ) |
reserve change_focus action
act | pointer to the action. must be a dynamically allocated object. |
void rcsc::PlayerAgent::setIntention | ( | SoccerIntention * | intention | ) |
set intention object
intention | pointer to the dynamically allocated object. |
void rcsc::PlayerAgent::setNeckAction | ( | NeckAction * | act | ) |
reserve turn neck action
act | pointer to the action. must be a dynamically allocated object. |
void rcsc::PlayerAgent::setViewAction | ( | ViewAction * | act | ) |
reserve change view action
act | pointer to the action. must be a dynamically allocated object. |
const VisualSensor & rcsc::PlayerAgent::visualSensor | ( | ) | const |
get visual sensor
|
inline |
get worldmodel