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 | List of all members
rcsc::ActionEffector Class Reference

manages action effect, command counter More...

#include <action_effector.h>

Public Member Functions

 ActionEffector (const PlayerAgent &agent)
 init member variables More...
 
 ~ActionEffector ()
 destruct dynamic allocated command objects
 
void reset ()
 reset all command effect. called just before action decision
 
void incCommandCount (const PlayerCommand::Type type)
 increment command count More...
 
void checkCommandCount (const BodySensor &sense)
 compare internal command count with sensed command count More...
 
std::ostream & makeCommand (std::ostream &to)
 make command string and update last action time More...
 
void clearAllCommands ()
 delete all command objects and say messages.
 
const PlayerBodyCommandbodyCommand () const
 get const pointer to the player's body command object More...
 
const PlayerTurnNeckCommandturnNeckCommand () const
 get const pointer to the player's turn_neck command object More...
 
const PlayerChangeViewCommandchangeViewCommand () const
 get const pointer to the player's change_view command object More...
 
const PlayerSayCommandsayCommand () const
 get const pointer to the player's say command object More...
 
const PlayerPointtoCommandpointtoCommand () const
 get const pointer to the player's pointto command object More...
 
const PlayerAttentiontoCommandattentiontoCommand () const
 get const pointer to the player's attentionto command object More...
 
void setKick (const double &power, const AngleDeg &rel_dir)
 create kick command and its effect with kick parameter More...
 
void setDash (const double &power)
 create dash command and its effect with dash parameter More...
 
void setDash (const double &power, const AngleDeg &rel_dir)
 create dash command and its effect with dash parameter More...
 
void setTurn (const AngleDeg &moment)
 create turn command and its effect with turn parameter More...
 
void setCatch ()
 create catch command. More...
 
void setMove (const double &x, const double &y)
 create move command and its effect with move parameter More...
 
void setTackle (const double &power_or_dir, const bool foul)
 create tackle command and its effect with tackle parameter More...
 
void setTurnNeck (const AngleDeg &moment)
 create turn_neck command and its effect with turn_neck parameter More...
 
void setChangeView (const ViewWidth &width)
 create change_view command More...
 
void setChangeFocus (const double moment_dist, const AngleDeg &moment_dir)
 create change_focus command More...
 
void addSayMessage (SayMessage *message)
 add new say message More...
 
bool removeSayMessage (const char header)
 remove the registered say message if exist More...
 
void clearSayMessage ()
 remove all registered say messages
 
void setPointto (const double &x, const double &y)
 create pointto command and its effect with pointto parameter More...
 
void setPointtoOff ()
 create pointto command by off mode
 
void setAttentionto (const SideID side, const int unum)
 create attentionto command More...
 
void setAttentiontoOff ()
 create attentionto command by off mode
 
const GameTimelastActionTime () const
 get last command composition time More...
 
PlayerCommand::Type lastBodyCommandType () const
 get last perfomed command type to update SelfObject More...
 
PlayerCommand::Type lastBodyCommandType (int i) const
 get last perfomed command type to update SelfObject More...
 
bool doneTurnNeck () const
 check if turn_neck is performed to update SelfObject More...
 
void getKickInfo (Vector2D *accel, Vector2D *accel_err) const
 get estimated kick action effect More...
 
void getTurnInfo (double *moment, double *err) const
 get estimated turn action effect More...
 
void getDashInfo (Vector2D *accel, double *power) const
 get estimated dash action effect More...
 
const Vector2DgetMovePos () const
 get move action effect More...
 
const GameTimegetCatchTime () const
 get last time catch action is performed More...
 
void getTackleInfo (double *power, double *dir, bool *foul) const
 get tackle action effect More...
 
bool tackleFoul () const
 get the last tackle foul switch. More...
 
double getTurnNeckMoment () const
 get turn_neck action effect More...
 
const std::string & getSayMessage () const
 get say action effect More...
 
int getSayMessageLength () const
 get the total length of current reserved messages More...
 
const std::vector< SayMessage::Ptr > & sayMessageCont () const
 get the reserved say messages More...
 
const Vector2DgetPointtoPos () const
 get pointto action effect More...
 
AngleDeg queuedNextSelfBody () const
 get estimated next body angle using queued action effect More...
 
AngleDeg queuedNextMyBody () const
 get estimated next body angle using queued action effect More...
 
Vector2D queuedNextSelfPos () const
 get estimated next position using queued action effect More...
 
Vector2D queuedNextMyPos () const
 get estimated next position using queued action effect More...
 
bool queuedNextBallKickable () const
 check if ball will be kickable in the next cycle More...
 
Vector2D queuedNextBallPos () const
 get estimated next ball position using queued action effect More...
 
Vector2D queuedNextBallVel () const
 get estimated next ball velocity using queued action effect More...
 
AngleDeg queuedNextAngleFromBody (const Vector2D &target) const
 get estimated next angle of target point relative to estimated body angle using queued action effect More...
 
ViewWidth queuedNextViewWidth () const
 get next view width using queued action effect More...
 
bool queuedNextCanSeeWithTurnNeck (const Vector2D &point, const double &angle_buf) const
 get the next focus distance estimated by the queued acction effect More...
 
int queuedNextSeeCycles () const
 get cycles till next see message arrival using queued action effect More...
 

Detailed Description

manages action effect, command counter

Constructor & Destructor Documentation

◆ ActionEffector()

rcsc::ActionEffector::ActionEffector ( const PlayerAgent agent)
explicit

init member variables

Parameters
agentconst reference to the PlayerAgent instance

Member Function Documentation

◆ addSayMessage()

void rcsc::ActionEffector::addSayMessage ( SayMessage message)

add new say message

Parameters
messagepointer to the dynamically allocated say message object.

◆ attentiontoCommand()

const PlayerAttentiontoCommand * rcsc::ActionEffector::attentiontoCommand ( ) const
inline

get const pointer to the player's attentionto command object

Returns
const pointer to the attentionto command object

◆ bodyCommand()

const PlayerBodyCommand * rcsc::ActionEffector::bodyCommand ( ) const
inline

get const pointer to the player's body command object

Returns
const pointer to the body command object

◆ changeViewCommand()

const PlayerChangeViewCommand * rcsc::ActionEffector::changeViewCommand ( ) const
inline

get const pointer to the player's change_view command object

Returns
const pointer to the change_view command object

◆ checkCommandCount()

void rcsc::ActionEffector::checkCommandCount ( const BodySensor sense)

compare internal command count with sensed command count

Parameters
senseanalyzed sense_body info

This method is called when sense_body received. This method MUST be called before WorldModel update

◆ doneTurnNeck()

bool rcsc::ActionEffector::doneTurnNeck ( ) const
inline

check if turn_neck is performed to update SelfObject

Returns
true if turn_neck is performed in previous cycle

◆ getCatchTime()

const GameTime & rcsc::ActionEffector::getCatchTime ( ) const
inline

get last time catch action is performed

Returns
game time object

◆ getDashInfo()

void rcsc::ActionEffector::getDashInfo ( Vector2D accel,
double *  power 
) const
inline

get estimated dash action effect

Parameters
accelvariable pointer to store the estimated dash accel
powervariable pointer to store the used dash power

◆ getKickInfo()

void rcsc::ActionEffector::getKickInfo ( Vector2D accel,
Vector2D accel_err 
) const
inline

get estimated kick action effect

Parameters
accelvariable pointer to store the estimated ball accel
accel_errvariable pointer to store the estimated ball accel error

◆ getMovePos()

const Vector2D & rcsc::ActionEffector::getMovePos ( ) const
inline

get move action effect

Returns
moved position

◆ getPointtoPos()

const Vector2D & rcsc::ActionEffector::getPointtoPos ( ) const
inline

get pointto action effect

Returns
estimated pointed position

◆ getSayMessage()

const std::string & rcsc::ActionEffector::getSayMessage ( ) const
inline

get say action effect

Returns
say message string

◆ getSayMessageLength()

int rcsc::ActionEffector::getSayMessageLength ( ) const

get the total length of current reserved messages

Returns
the total length of current reserved messages

◆ getTackleInfo()

void rcsc::ActionEffector::getTackleInfo ( double *  power,
double *  dir,
bool *  foul 
) const
inline

get tackle action effect

Parameters
powervariable pointer to store the used tackle power
dirvariable pointer to store the tackle direction

◆ getTurnInfo()

void rcsc::ActionEffector::getTurnInfo ( double *  moment,
double *  err 
) const
inline

get estimated turn action effect

Parameters
momentvariable pointer to store the estimated actual turned moment
errvariable pointer to store the estimated turned moment error

◆ getTurnNeckMoment()

double rcsc::ActionEffector::getTurnNeckMoment ( ) const
inline

get turn_neck action effect

Returns
performed turn_neck moment

◆ incCommandCount()

void rcsc::ActionEffector::incCommandCount ( const PlayerCommand::Type  type)

increment command count

Parameters
typetarget command type

◆ lastActionTime()

const GameTime & rcsc::ActionEffector::lastActionTime ( ) const
inline

get last command composition time

Returns
const reference to the game time

◆ lastBodyCommandType() [1/2]

PlayerCommand::Type rcsc::ActionEffector::lastBodyCommandType ( ) const
inline

get last perfomed command type to update SelfObject

Returns
command type Id

◆ lastBodyCommandType() [2/2]

PlayerCommand::Type rcsc::ActionEffector::lastBodyCommandType ( int  i) const
inline

get last perfomed command type to update SelfObject

Returns
command type Id

◆ makeCommand()

std::ostream & rcsc::ActionEffector::makeCommand ( std::ostream &  to)

make command string and update last action time

Parameters
toreference to the output stream
Returns
reference to the output stream

After command string composition, all command objects are deleted.

◆ pointtoCommand()

const PlayerPointtoCommand * rcsc::ActionEffector::pointtoCommand ( ) const
inline

get const pointer to the player's pointto command object

Returns
const pointer to the pointto command object

◆ queuedNextAngleFromBody()

AngleDeg rcsc::ActionEffector::queuedNextAngleFromBody ( const Vector2D target) const

get estimated next angle of target point relative to estimated body angle using queued action effect

Parameters
targettarget point
Returns
angle relative to estimated body angle

◆ queuedNextBallKickable()

bool rcsc::ActionEffector::queuedNextBallKickable ( ) const

check if ball will be kickable in the next cycle

Returns
true if ball will be kickable

◆ queuedNextBallPos()

Vector2D rcsc::ActionEffector::queuedNextBallPos ( ) const

get estimated next ball position using queued action effect

Returns
estimated ball position

◆ queuedNextBallVel()

Vector2D rcsc::ActionEffector::queuedNextBallVel ( ) const

get estimated next ball velocity using queued action effect

Returns
estimated ball velocity

◆ queuedNextCanSeeWithTurnNeck()

bool rcsc::ActionEffector::queuedNextCanSeeWithTurnNeck ( const Vector2D point,
const double &  angle_buf 
) const

get the next focus distance estimated by the queued acction effect

Returns
queued focus distance

get the next focus direction estimated by the queued acction effect

Returns
queued focus direction

check if the target point can see only by turn_neck with the buffer

Parameters
pointtarget point
angle_bufangle buffer for the half view width
Returns
true if player can see the point only by turn_neck

◆ queuedNextMyBody()

AngleDeg rcsc::ActionEffector::queuedNextMyBody ( ) const
inline

get estimated next body angle using queued action effect

Returns
estimated body angle

◆ queuedNextMyPos()

Vector2D rcsc::ActionEffector::queuedNextMyPos ( ) const
inline

get estimated next position using queued action effect

Returns
estimated global position

◆ queuedNextSeeCycles()

int rcsc::ActionEffector::queuedNextSeeCycles ( ) const

get cycles till next see message arrival using queued action effect

Returns
cycle value till next see message

◆ queuedNextSelfBody()

AngleDeg rcsc::ActionEffector::queuedNextSelfBody ( ) const

get estimated next body angle using queued action effect

Returns
estimated body angle

◆ queuedNextSelfPos()

Vector2D rcsc::ActionEffector::queuedNextSelfPos ( ) const

get estimated next position using queued action effect

Returns
estimated global position

◆ queuedNextViewWidth()

ViewWidth rcsc::ActionEffector::queuedNextViewWidth ( ) const

get next view width using queued action effect

Returns
queued view width

◆ removeSayMessage()

bool rcsc::ActionEffector::removeSayMessage ( const char  header)

remove the registered say message if exist

Parameters
headermessage header character
Returns
true if removed

◆ sayCommand()

const PlayerSayCommand * rcsc::ActionEffector::sayCommand ( ) const
inline

get const pointer to the player's say command object

Returns
const pointer to the say command object

◆ sayMessageCont()

const std::vector< SayMessage::Ptr > & rcsc::ActionEffector::sayMessageCont ( ) const
inline

get the reserved say messages

Returns
const reference to the say message builder container

◆ setAttentionto()

void rcsc::ActionEffector::setAttentionto ( const SideID  side,
const int  unum 
)

create attentionto command

Parameters
sidetarget player's side
unumtarget player's uniform number

◆ setCatch()

void rcsc::ActionEffector::setCatch ( )

create catch command.

command argumment, catch direction is calculated in this method. catch direction is calculated using diagonal line direction

◆ setChangeFocus()

void rcsc::ActionEffector::setChangeFocus ( const double  moment_dist,
const AngleDeg moment_dir 
)

create change_focus command

Parameters
moment_distdistance added to the current focus point
moment_dirdirection added to the current focus point

◆ setChangeView()

void rcsc::ActionEffector::setChangeView ( const ViewWidth width)

create change_view command

Parameters
widthview width that player wants.

ViewQuality should not be changed by user

◆ setDash() [1/2]

void rcsc::ActionEffector::setDash ( const double &  power)

create dash command and its effect with dash parameter

Parameters
powerdash power for command argument

power is normalized by server parameter useless dash power is reduceed automatically.

◆ setDash() [2/2]

void rcsc::ActionEffector::setDash ( const double &  power,
const AngleDeg rel_dir 
)

create dash command and its effect with dash parameter

Parameters
powerdash power for command argument
rel_dirdash direction for command argument

power is normalized by server parameter useless dash power is reduceed automatically.

◆ setKick()

void rcsc::ActionEffector::setKick ( const double &  power,
const AngleDeg rel_dir 
)

create kick command and its effect with kick parameter

Parameters
powerkick power for command argument
rel_dirkick direction relative to body angle for command argument

power is normalized by server parameter

◆ setMove()

void rcsc::ActionEffector::setMove ( const double &  x,
const double &  y 
)

create move command and its effect with move parameter

Parameters
xmove target point x
ymove target point y

◆ setPointto()

void rcsc::ActionEffector::setPointto ( const double &  x,
const double &  y 
)

create pointto command and its effect with pointto parameter

Parameters
xtarget point x
ytarget point y

◆ setTackle()

void rcsc::ActionEffector::setTackle ( const double &  power_or_dir,
const bool  foul 
)

create tackle command and its effect with tackle parameter

Parameters
power_or_dirtackle power or directin for command argument
foulintentional foul switch

power is normalized by server parameter

◆ setTurn()

void rcsc::ActionEffector::setTurn ( const AngleDeg moment)

create turn command and its effect with turn parameter

Parameters
momentturn moment that player wants to perform

command argument, moment is calculated using current player's speed and its inertia moment parameter. command argument moment is normalized by server parameter.

◆ setTurnNeck()

void rcsc::ActionEffector::setTurnNeck ( const AngleDeg moment)

create turn_neck command and its effect with turn_neck parameter

Parameters
momentturn_neck moment that player wants to perform

command argument moment is normalized by server parameter.

◆ tackleFoul()

bool rcsc::ActionEffector::tackleFoul ( ) const
inline

get the last tackle foul switch.

Returns
the value of the last tackle foul switch.

◆ turnNeckCommand()

const PlayerTurnNeckCommand * rcsc::ActionEffector::turnNeckCommand ( ) const
inline

get const pointer to the player's turn_neck command object

Returns
const pointer to the turn_neck command object

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