Fawkes API
Fawkes Development Version
|
Data container to store and exchange worldinfo data. More...
#include <>>
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. |
Data container to store and exchange worldinfo data.
fawkes::WorldInfoDataContainer::WorldInfoDataContainer | ( | Clock * | clock, |
long | timeout_msec = 3000 |
||
) |
Constructor.
clock | pointer to a Clock |
timeout_msec | timeout in milliseconds |
Definition at line 256 of file data_container.cpp.
References fawkes::TEAM_CYAN, fawkes::GOAL_BLUE, fawkes::GS_FROZEN, fawkes::TEAM_BOTH, and fawkes::HALF_FIRST.
fawkes::WorldInfoDataContainer::~WorldInfoDataContainer | ( | ) |
Destructor.
Definition at line 279 of file data_container.cpp.
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.
Definition at line 290 of file data_container.cpp.
References fawkes::Time::stamp(), fawkes::Time::in_msec(), and fawkes::LockMap::lock().
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.
host | the robot's hostname |
pos | refercence to a HomPoint where the position of the ball written to |
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.
host | the hostname of the robot |
pos | reference to a HomPolar where the position is written to |
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.
host | the hostname of the robot |
pos | reference to a HomPolar where the position is written to |
pos_cov | reference to a Matrix where the ball position covariance is written to |
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.
host | the hostname of the robot |
ball_vel | refrence to a HomVector where the velocity information is written to |
Definition at line 787 of file data_container.cpp.
WorldInfoDataContainer::GameState fawkes::WorldInfoDataContainer::get_game_state | ( | ) | const |
Obtain the 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.
Definition at line 924 of file data_container.cpp.
References fawkes::worldinfo_msl_gamestate_tostring(), and fawkes::worldinfo_gamestate_team_tostring().
std::string fawkes::WorldInfoDataContainer::get_half_string | ( | ) | const |
Get the current half as string.
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.
check_timeout_first | if true check_timeout() is called before the list is compiled |
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.
host | hostname of the robot |
opp_positions | map containing the positions of the detected opponents |
Definition at line 865 of file data_container.cpp.
unsigned int fawkes::WorldInfoDataContainer::get_other_score | ( | ) | const |
Get score of the other team.
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.
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.
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.
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.
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.
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.
host | the hostname of the robot |
pose | reference to a HomPose where the pose will be stored |
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.
host | the hostname of the robot |
pose | reference to a HomPoint where the global position of the robot is written to |
pose_cov | reference to a Matrix where the covariance of the robot position is written to |
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.
host | the hostname of the robot |
robot_vel | reference to a HomVector where the velocity information is written to |
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().
Definition at line 373 of file data_container.cpp.
bool fawkes::WorldInfoDataContainer::host_timedout | ( | ) |
Check whether a host has timed out.
Definition at line 413 of file data_container.cpp.
bool fawkes::WorldInfoDataContainer::new_data_available | ( | ) |
Check whehter 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.
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.
host | the hostname of the robot |
uid | the uid of the opponent |
Definition at line 843 of file data_container.cpp.
References fawkes::LockMap::unlock().
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.
host | the hostname of the robot |
visible | visible or not |
visibility_history | visible/not visible for n iterations |
dist | distance to the robot |
bearing | vertical angle to the ball |
slope | the horizontal angle to the ball |
covariance | covariance 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.
host | the hostname of the robot |
visible | visible or not |
visibility_history | visible/not visible for n iterations |
x | the x-coordinte of the global ball position |
y | the y-coordinte of the global ball position |
z | the z-coordinte of the global ball position |
covariance | covariance 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.
host | the hostname of the robot |
vel_x | the ball velocity in x-direction of the robot-centered coordinate system |
vel_y | the ball velocity in y-direction of the robot-centered coordinate system |
vel_z | the ball velocity in z-direction of the robot-centered coordinate system |
covariance | ball 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.
game_state | the current game state |
state_team | team association of the game state |
score_cyan | score of the cyan-colored team |
score_magenta | score of the magenta-colored team |
own_team | own team color |
own_goal_color | own goal color |
half | first 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.
host | hostname of the robot that detected the robot |
uid | opponent id |
distance | distance to the robot |
angle | angle at which the opponent is detected |
covariance | corresponding 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.
host | the hostname of the robot |
x | the x-coordinate of the robot's global position |
y | the y-coordinate of the robot's global position |
theta | the global orientation of the robot |
covariance | covariance 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.
host | the hostname of the robot |
vel_x | the current forward velocity of the robot |
vel_y | the current sideward velocity of the robot |
vel_theta | the current rotational velociy of the robot |
covariance | the 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.
msec | time out value in milliseconds |
Definition at line 339 of file data_container.cpp.