fawkes::WorldInfoDataContainer Class Reference
Data container to store and exchange worldinfo data. More...
#include <worldinfo_utils/data_container.h>
Classes | |
| class | BallRecord |
| struct | GameState |
| Container struct for momentary game state infos. More... | |
| class | OpponentsRecord |
| class | PoseRecord |
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. | |
| 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.
Definition at line 43 of file data_container.h.
Constructor & Destructor Documentation
| fawkes::WorldInfoDataContainer::WorldInfoDataContainer | ( | Clock * | clock, | |
| long | timeout_msec = 3000 | |||
| ) |
Constructor.
- Parameters:
-
clock pointer to a Clock timeout_msec timeout in milliseconds
Definition at line 231 of file data_container.cpp.
References fawkes::WorldInfoDataContainer::GameState::game_state, fawkes::GOAL_BLUE, fawkes::GS_FROZEN, fawkes::WorldInfoDataContainer::GameState::half, fawkes::HALF_FIRST, fawkes::WorldInfoDataContainer::GameState::score_cyan, fawkes::WorldInfoDataContainer::GameState::score_magenta, fawkes::WorldInfoDataContainer::GameState::state_team, fawkes::TEAM_BOTH, and fawkes::TEAM_CYAN.
| fawkes::WorldInfoDataContainer::~WorldInfoDataContainer | ( | ) |
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 265 of file data_container.cpp.
References fawkes::Time::in_msec(), fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), fawkes::LockList< Type >::lock(), fawkes::Time::stamp(), fawkes::LockMap< KeyType, ValueType, LessKey >::unlock(), and fawkes::LockList< Type >::unlock().
Referenced by get_hosts(), and WorldInfoViewer::update().
| 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:
-
host the robot's hostname pos refercence to a HomPoint where the position of the ball written to
Definition at line 646 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), fawkes::LockMap< KeyType, ValueType, LessKey >::unlock(), fawkes::HomPose2d::x(), fawkes::HomPose2d::y(), and fawkes::HomPose2d::yaw().
Referenced by FieldView::on_expose_event().
| 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:
-
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
- Returns:
- true if a global ball position was found
Definition at line 617 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
| bool fawkes::WorldInfoDataContainer::get_ball_pos_relative | ( | const char * | host, | |
| HomPolar & | pos | |||
| ) |
Get the ball position estimation of a certain robot.
- Parameters:
-
host the hostname of the robot pos reference to a HomPolar where the position is written to
- Returns:
- true if a global ball position was found
Definition at line 589 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
Referenced by FieldView::on_expose_event().
| bool fawkes::WorldInfoDataContainer::get_ball_velocity | ( | const char * | host, | |
| HomVector & | ball_vel | |||
| ) |
Obtain ball velocity information for specified robot.
- Parameters:
-
host the hostname of the robot ball_vel refrence 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 720 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 848 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 857 of file data_container.cpp.
References fawkes::WorldInfoDataContainer::GameState::game_state, fawkes::WorldInfoDataContainer::GameState::state_team, fawkes::worldinfo_gamestate_team_tostring(), and fawkes::worldinfo_msl_gamestate_tostring().
Referenced by WorldInfoViewer::gamestate_changed().
| std::string fawkes::WorldInfoDataContainer::get_half_string | ( | ) | const |
Get the current half as string.
- Returns:
- the current half
Definition at line 873 of file data_container.cpp.
References fawkes::WorldInfoDataContainer::GameState::half, and fawkes::worldinfo_gamestate_half_tostring().
Referenced by WorldInfoViewer::gamestate_changed().
| std::list< std::string > fawkes::WorldInfoDataContainer::get_hosts | ( | bool | check_timeout_first = false |
) |
Obtain the list of active hosts.
- Parameters:
-
check_timeout_first if true check_timeout() is called before the list is compiled
- Returns:
- the list of active hosts
Definition at line 325 of file data_container.cpp.
References check_timeout(), fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
Referenced by FieldView::on_expose_event(), and WorldInfoViewer::update().
| 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:
-
host hostname of the robot opp_positions map containing the positions of the detected opponents
- Returns:
- false if no data about opponents is available from the given robot
Definition at line 798 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
Referenced by FieldView::on_expose_event().
| unsigned int fawkes::WorldInfoDataContainer::get_other_score | ( | ) | const |
Get score of the other team.
- Returns:
- the other team's score
Definition at line 896 of file data_container.cpp.
References fawkes::WorldInfoDataContainer::GameState::score_cyan, fawkes::WorldInfoDataContainer::GameState::score_magenta, and fawkes::TEAM_CYAN.
Referenced by WorldInfoViewer::gamestate_changed().
| 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 928 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 937 of file data_container.cpp.
References fawkes::worldinfo_gamestate_goalcolor_tostring().
Referenced by WorldInfoViewer::gamestate_changed().
| unsigned int fawkes::WorldInfoDataContainer::get_own_score | ( | ) | const |
Get own score.
- Returns:
- own score
Definition at line 884 of file data_container.cpp.
References fawkes::WorldInfoDataContainer::GameState::score_cyan, fawkes::WorldInfoDataContainer::GameState::score_magenta, and fawkes::TEAM_CYAN.
Referenced by WorldInfoViewer::gamestate_changed().
| 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 908 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 917 of file data_container.cpp.
References fawkes::worldinfo_gamestate_team_tostring().
Referenced by WorldInfoViewer::gamestate_changed().
| bool fawkes::WorldInfoDataContainer::get_robot_pose | ( | const char * | host, | |
| HomPose2d & | pose, | |||
| Matrix & | pose_cov | |||
| ) |
Get the position of a certain robot.
- Parameters:
-
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
- Returns:
- true if a pose for the robot could be found
Definition at line 467 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
| bool fawkes::WorldInfoDataContainer::get_robot_pose | ( | const char * | host, | |
| HomPose2d & | pose | |||
| ) |
Obtain the pose of the given robot.
- Parameters:
-
host the hostname of the robot pose reference to a HomPose where the pose will be stored
- Returns:
- false if no pose for the requested robot could be found
Definition at line 438 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
Referenced by FieldView::on_expose_event().
| bool fawkes::WorldInfoDataContainer::get_robot_velocity | ( | const char * | host, | |
| HomVector & | robot_vel | |||
| ) |
Obtain current velocity of the specified robot.
- Parameters:
-
host the hostname of the robot robot_vel reference to a HomVector where the velocity information is written to
- Returns:
- true, if velocity information for the specified host are available
Definition at line 533 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 348 of file data_container.cpp.
References fawkes::LockList< Type >::lock(), and fawkes::LockList< Type >::unlock().
Referenced by WorldInfoViewer::update().
| bool fawkes::WorldInfoDataContainer::host_timedout | ( | ) |
Check whether a host has timed out.
- Returns:
- true if a host has timed out recently
Definition at line 388 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 366 of file data_container.cpp.
Referenced by WorldInfoViewer::update().
| 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 377 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:
-
host the hostname of the robot uid the uid of the opponent
Definition at line 776 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::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.
- Parameters:
-
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 551 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
Referenced by WorldInfoViewerBackendThread::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:
-
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 684 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
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_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 826 of file data_container.cpp.
References fawkes::WorldInfoDataContainer::GameState::game_state, fawkes::WorldInfoDataContainer::GameState::half, fawkes::WorldInfoDataContainer::GameState::score_cyan, fawkes::WorldInfoDataContainer::GameState::score_magenta, and fawkes::WorldInfoDataContainer::GameState::state_team.
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:
-
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 735 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
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:
-
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 405 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
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:
-
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 497 of file data_container.cpp.
References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().
Referenced by WorldInfoViewerBackendThread::velocity_rcvd().
| void fawkes::WorldInfoDataContainer::set_timeout | ( | long | msec | ) |
Set the time out.
- Parameters:
-
msec time out value in milliseconds
Definition at line 314 of file data_container.cpp.
The documentation for this class was generated from the following files:
- src/libs/worldinfo_utils/data_container.h
- src/libs/worldinfo_utils/data_container.cpp

