Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fawkes::WorldInfoDataContainer Class Reference

Data container to store and exchange worldinfo data. More...

#include <>>

List of all members.

Classes

struct  GameState
 Container struct for momentary game state infos. More...

Public Member Functions

 WorldInfoDataContainer (Clock *clock, long timeout_msec=3000)
 Constructor.
 ~WorldInfoDataContainer ()
 Destructor.
bool check_timeout ()
 Check for timed out hosts.
void set_timeout (long msec)
 Set the time out.
std::list< std::string > get_hosts (bool check_timeout_first=false)
 Obtain the list of active hosts.
std::list< std::string > get_timedout_hosts ()
 Obtain the list of timedout hosts.
bool new_data_available ()
 Check whehter new data is available.
bool new_host ()
 Check whether a new host has been added recently.
bool host_timedout ()
 Check whether a host has timed out.
void set_robot_pose (const char *from_host, float x, float y, float theta, float *covariance)
 Set the pose of a robot.
bool get_robot_pose (const char *host, HomPose2d &robot_pose)
 Obtain the pose of the given robot.
bool get_robot_pose (const char *host, HomPose2d &robot_pose, Matrix &robot_pose_cov)
 Get the position of a certain robot.
void set_robot_velocity (const char *from_host, float vel_x, float vel_y, float vel_theta, float *covariance)
 Set the velocity of the robot.
bool get_robot_velocity (const char *host, HomVector &robot_vel)
 Obtain current velocity of the specified robot.
void set_ball_pos (const char *from_host, bool visible, int visibility_history, float dist, float bearing, float slope, float *covariance)
 Set the ball position estimation of a robot.
void set_ball_pos_global (const char *from_host, bool visible, int visibility_history, float x, float y, float z, float *covariance)
 Set the global ball position estimation of a robot.
bool get_ball_pos_relative (const char *host, HomPolar &ball_pos)
 Get the ball position estimation of a certain robot.
bool get_ball_pos_relative (const char *host, HomPolar &ball_pos, Matrix &ball_pos_cov)
 Get the ball position estimation of a certain robot.
bool get_ball_pos_global (const char *host, HomPoint &ball_pos)
 Get the global position of the ball as it is estimated by the specified robot.
void set_ball_velocity (const char *from_host, float vel_x, float vel_y, float vel_z, float *covariance)
 Set the ball velocity as it is estimated by the specified robot.
bool get_ball_velocity (const char *from_host, HomVector &ball_vel)
 Obtain ball velocity information for specified robot.
void set_opponent_pos (const char *from_host, unsigned int uid, float distance, float angle, float *covariance)
 Set the position of a detected opponent.
void opponent_disappeared (const char *from_host, unsigned int uid)
 Remove the opponent with the given ID form the list of opponents seen by the given robot.
bool get_opponent_pos (const char *host, std::map< unsigned int, HomPoint > &opp_positions)
 Get all oppenents detected by a certain robot.
void set_game_state (int game_state, worldinfo_gamestate_team_t state_team, unsigned int score_cyan, unsigned int score_magenta, worldinfo_gamestate_team_t own_team, worldinfo_gamestate_goalcolor_t own_goal_color, worldinfo_gamestate_half_t half)
 Set the gamestate.
GameState get_game_state () const
 Obtain the game state.
std::string get_game_state_string () const
 Get the current game state as string.
std::string get_half_string () const
 Get the current half as string.
unsigned int get_own_score () const
 Get own score.
unsigned int get_other_score () const
 Get score of the other team.
worldinfo_gamestate_team_t get_own_team_color () const
 Get own team color.
std::string get_own_team_color_string () const
 Get own team color as string.
worldinfo_gamestate_goalcolor_t get_own_goal_color () const
 Get own goal color.
std::string get_own_goal_color_string () const
 Get own goal color as string.

Detailed Description

Data container to store and exchange worldinfo data.

Author:
Daniel Beck

Definition at line 43 of file data_container.h.


Constructor & Destructor Documentation

fawkes::WorldInfoDataContainer::WorldInfoDataContainer ( Clock clock,
long  timeout_msec = 3000 
)

Constructor.

Parameters:
clockpointer to a Clock
timeout_msectimeout in milliseconds

Definition at line 256 of file data_container.cpp.

References fawkes::GOAL_BLUE, fawkes::GS_FROZEN, fawkes::HALF_FIRST, fawkes::TEAM_BOTH, and fawkes::TEAM_CYAN.

fawkes::WorldInfoDataContainer::~WorldInfoDataContainer ( )

Destructor.

Definition at line 279 of file data_container.cpp.


Member Function Documentation

bool fawkes::WorldInfoDataContainer::check_timeout ( )

Check for timed out hosts.

This method should be called regularly to remove hosts from the data container from which no data has been received in a certain amount of time.

Returns:
true if there are timed out hosts

Definition at line 290 of file data_container.cpp.

References fawkes::Time::in_msec(), and fawkes::Time::stamp().

bool fawkes::WorldInfoDataContainer::get_ball_pos_global ( const char *  host,
HomPoint pos 
)

Get the global position of the ball as it is estimated by the specified robot.

Parameters:
hostthe robot's hostname
posrefercence to a HomPoint where the position of the ball written to
Returns:
true if position was found/received, false otherwise

Definition at line 713 of file data_container.cpp.

References fawkes::HomPose2d::x(), fawkes::HomPose2d::y(), and fawkes::HomPose2d::yaw().

bool fawkes::WorldInfoDataContainer::get_ball_pos_relative ( const char *  host,
HomPolar pos 
)

Get the ball position estimation of a certain robot.

Parameters:
hostthe hostname of the robot
posreference to a HomPolar where the position is written to
Returns:
true if a global ball position was found

Definition at line 655 of file data_container.cpp.

bool fawkes::WorldInfoDataContainer::get_ball_pos_relative ( const char *  host,
HomPolar pos,
Matrix pos_cov 
)

Get the ball position estimation of a certain robot.

Parameters:
hostthe hostname of the robot
posreference to a HomPolar where the position is written to
pos_covreference to a Matrix where the ball position covariance is written to
Returns:
true if a global ball position was found

Definition at line 683 of file data_container.cpp.

bool fawkes::WorldInfoDataContainer::get_ball_velocity ( const char *  host,
HomVector ball_vel 
)

Obtain ball velocity information for specified robot.

Parameters:
hostthe hostname of the robot
ball_velrefrence to a HomVector where the velocity information is written to
Returns:
true if ball velocity information from the specified robot are available

Definition at line 787 of file data_container.cpp.

WorldInfoDataContainer::GameState fawkes::WorldInfoDataContainer::get_game_state ( ) const

Obtain the game state.

Returns:
the current game state

Definition at line 915 of file data_container.cpp.

std::string fawkes::WorldInfoDataContainer::get_game_state_string ( ) const

Get the current game state as string.

Returns:
the current game mode

Definition at line 924 of file data_container.cpp.

References fawkes::worldinfo_gamestate_team_tostring(), and fawkes::worldinfo_msl_gamestate_tostring().

std::string fawkes::WorldInfoDataContainer::get_half_string ( ) const

Get the current half as string.

Returns:
the current half

Definition at line 942 of file data_container.cpp.

References fawkes::worldinfo_gamestate_half_tostring().

std::list< std::string > fawkes::WorldInfoDataContainer::get_hosts ( bool  check_timeout_first = false)

Obtain the list of active hosts.

Parameters:
check_timeout_firstif true check_timeout() is called before the list is compiled
Returns:
the list of active hosts

Definition at line 350 of file data_container.cpp.

bool fawkes::WorldInfoDataContainer::get_opponent_pos ( const char *  host,
std::map< unsigned int, HomPoint > &  opp_positions 
)

Get all oppenents detected by a certain robot.

Parameters:
hosthostname of the robot
opp_positionsmap containing the positions of the detected opponents
Returns:
false if no data about opponents is available from the given robot

Definition at line 865 of file data_container.cpp.

unsigned int fawkes::WorldInfoDataContainer::get_other_score ( ) const

Get score of the other team.

Returns:
the other team's score

Definition at line 965 of file data_container.cpp.

References fawkes::TEAM_CYAN.

worldinfo_gamestate_goalcolor_t fawkes::WorldInfoDataContainer::get_own_goal_color ( ) const

Get own goal color.

Returns:
struct containing the own goal color

Definition at line 997 of file data_container.cpp.

std::string fawkes::WorldInfoDataContainer::get_own_goal_color_string ( ) const

Get own goal color as string.

Returns:
string with the current goal color

Definition at line 1006 of file data_container.cpp.

References fawkes::worldinfo_gamestate_goalcolor_tostring().

unsigned int fawkes::WorldInfoDataContainer::get_own_score ( ) const

Get own score.

Returns:
own score

Definition at line 953 of file data_container.cpp.

References fawkes::TEAM_CYAN.

worldinfo_gamestate_team_t fawkes::WorldInfoDataContainer::get_own_team_color ( ) const

Get own team color.

Returns:
struct containing the own team color

Definition at line 977 of file data_container.cpp.

std::string fawkes::WorldInfoDataContainer::get_own_team_color_string ( ) const

Get own team color as string.

Returns:
string with the own team color

Definition at line 986 of file data_container.cpp.

References fawkes::worldinfo_gamestate_team_tostring().

bool fawkes::WorldInfoDataContainer::get_robot_pose ( const char *  host,
HomPose2d pose 
)

Obtain the pose of the given robot.

Parameters:
hostthe hostname of the robot
posereference to a HomPose where the pose will be stored
Returns:
false if no pose for the requested robot could be found

Definition at line 463 of file data_container.cpp.

bool fawkes::WorldInfoDataContainer::get_robot_pose ( const char *  host,
HomPose2d pose,
Matrix pose_cov 
)

Get the position of a certain robot.

Parameters:
hostthe hostname of the robot
posereference to a HomPoint where the global position of the robot is written to
pose_covreference to a Matrix where the covariance of the robot position is written to
Returns:
true if a pose for the robot could be found

Definition at line 492 of file data_container.cpp.

bool fawkes::WorldInfoDataContainer::get_robot_velocity ( const char *  host,
HomVector robot_vel 
)

Obtain current velocity of the specified robot.

Parameters:
hostthe hostname of the robot
robot_velreference to a HomVector where the velocity information is written to
Returns:
true, if velocity information for the specified host are available

Definition at line 558 of file data_container.cpp.

std::list< std::string > fawkes::WorldInfoDataContainer::get_timedout_hosts ( )

Obtain the list of timedout hosts.

Hosts that have been marked as timedout in the last call of check_timeout().

Returns:
the list of timedout hosts

Definition at line 373 of file data_container.cpp.

bool fawkes::WorldInfoDataContainer::host_timedout ( )

Check whether a host has timed out.

Returns:
true if a host has timed out recently

Definition at line 413 of file data_container.cpp.

bool fawkes::WorldInfoDataContainer::new_data_available ( )

Check whehter new data is available.

Returns:
true if new data is available.

Definition at line 391 of file data_container.cpp.

bool fawkes::WorldInfoDataContainer::new_host ( )

Check whether a new host has been added recently.

Returns:
true if a new host has been added recently

Definition at line 402 of file data_container.cpp.

void fawkes::WorldInfoDataContainer::opponent_disappeared ( const char *  host,
unsigned int  uid 
)

Remove the opponent with the given ID form the list of opponents seen by the given robot.

Parameters:
hostthe hostname of the robot
uidthe uid of the opponent

Definition at line 843 of file data_container.cpp.

Referenced by WorldInfoViewerBackendThread::opponent_disapp_rcvd().

void fawkes::WorldInfoDataContainer::set_ball_pos ( const char *  host,
bool  visible,
int  visibility_history,
float  dist,
float  bearing,
float  slope,
float *  covariance 
)

Set the ball position estimation of a robot.

Parameters:
hostthe hostname of the robot
visiblevisible or not
visibility_historyvisible/not visible for n iterations
distdistance to the robot
bearingvertical angle to the ball
slopethe horizontal angle to the ball
covariancecovariance associated with the position estimation

Definition at line 576 of file data_container.cpp.

Referenced by WorldInfoViewerBackendThread::ball_pos_rcvd().

void fawkes::WorldInfoDataContainer::set_ball_pos_global ( const char *  host,
bool  visible,
int  visibility_history,
float  x,
float  y,
float  z,
float *  covariance 
)

Set the global ball position estimation of a robot.

Parameters:
hostthe hostname of the robot
visiblevisible or not
visibility_historyvisible/not visible for n iterations
xthe x-coordinte of the global ball position
ythe y-coordinte of the global ball position
zthe z-coordinte of the global ball position
covariancecovariance associated with the position estimation

Definition at line 617 of file data_container.cpp.

Referenced by WorldInfoViewerBackendThread::global_ball_pos_rcvd().

void fawkes::WorldInfoDataContainer::set_ball_velocity ( const char *  host,
float  vel_x,
float  vel_y,
float  vel_z,
float *  covariance 
)

Set the ball velocity as it is estimated by the specified robot.

Parameters:
hostthe hostname of the robot
vel_xthe ball velocity in x-direction of the robot-centered coordinate system
vel_ythe ball velocity in y-direction of the robot-centered coordinate system
vel_zthe ball velocity in z-direction of the robot-centered coordinate system
covarianceball velocity covariance

Definition at line 751 of file data_container.cpp.

Referenced by WorldInfoViewerBackendThread::ball_velocity_rcvd().

void fawkes::WorldInfoDataContainer::set_game_state ( int  game_state,
worldinfo_gamestate_team_t  state_team,
unsigned int  score_cyan,
unsigned int  score_magenta,
worldinfo_gamestate_team_t  own_team,
worldinfo_gamestate_goalcolor_t  own_goal_color,
worldinfo_gamestate_half_t  half 
)

Set the gamestate.

Parameters:
game_statethe current game state
state_teamteam association of the game state
score_cyanscore of the cyan-colored team
score_magentascore of the magenta-colored team
own_teamown team color
own_goal_colorown goal color
halffirst or second half

Definition at line 893 of file data_container.cpp.

Referenced by WorldInfoViewerBackendThread::gamestate_rcvd().

void fawkes::WorldInfoDataContainer::set_opponent_pos ( const char *  host,
unsigned int  uid,
float  distance,
float  angle,
float *  covariance 
)

Set the position of a detected opponent.

Parameters:
hosthostname of the robot that detected the robot
uidopponent id
distancedistance to the robot
angleangle at which the opponent is detected
covariancecorresponding covariance matrix

Definition at line 802 of file data_container.cpp.

Referenced by WorldInfoViewerBackendThread::opponent_pose_rcvd().

void fawkes::WorldInfoDataContainer::set_robot_pose ( const char *  host,
float  x,
float  y,
float  theta,
float *  covariance 
)

Set the pose of a robot.

Parameters:
hostthe hostname of the robot
xthe x-coordinate of the robot's global position
ythe y-coordinate of the robot's global position
thetathe global orientation of the robot
covariancecovariance associated with the position estimation

Definition at line 430 of file data_container.cpp.

Referenced by WorldInfoViewerBackendThread::pose_rcvd().

void fawkes::WorldInfoDataContainer::set_robot_velocity ( const char *  host,
float  vel_x,
float  vel_y,
float  vel_theta,
float *  covariance 
)

Set the velocity of the robot.

Parameters:
hostthe hostname of the robot
vel_xthe current forward velocity of the robot
vel_ythe current sideward velocity of the robot
vel_thetathe current rotational velociy of the robot
covariancethe velocity covariance

Definition at line 522 of file data_container.cpp.

Referenced by WorldInfoViewerBackendThread::velocity_rcvd().

void fawkes::WorldInfoDataContainer::set_timeout ( long  msec)

Set the time out.

Parameters:
msectime out value in milliseconds

Definition at line 339 of file data_container.cpp.


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