23 #ifndef __TOOLS_WORLDINFO_VIEWER_DATA_CONTAINER_H_
24 #define __TOOLS_WORLDINFO_VIEWER_DATA_CONTAINER_H_
26 #include <geometry/matrix.h>
27 #include <geometry/hom_point.h>
28 #include <geometry/hom_polar.h>
29 #include <geometry/hom_pose_2d.h>
30 #include <core/utils/lock_map.h>
31 #include <core/utils/lock_list.h>
32 #include <netcomm/worldinfo/enums.h>
62 std::list<std::string>
get_hosts(
bool check_timeout_first =
false);
70 void set_robot_pose(
const char* from_host,
float x,
float y,
float theta,
78 float vel_x,
float vel_y,
float vel_theta,
83 void set_ball_pos(
const char* from_host,
bool visible,
int visibility_history,
84 float dist,
float bearing,
float slope,
float* covariance );
86 bool visible,
int visibility_history,
87 float x,
float y,
float z,
float* covariance );
95 float vel_x,
float vel_y,
float vel_z,
101 float distance,
float angle,
float* covariance );
104 std::map<unsigned int, HomPoint>& opp_positions );
109 unsigned int score_cyan,
110 unsigned int score_magenta,
136 virtual ~BallRecord();
138 void set_pos(
float dist,
float bearing,
float slope,
139 float* covariance = NULL );
140 void set_pos_global(
float x,
float y,
float z,
141 float* covariance = NULL );
142 void set_visible(
bool visible,
int visibility_history );
143 void set_velocity(
float vel_x,
float vel_y,
float vel_z,
144 float* covariance = NULL );
146 bool visible()
const;
147 int visibility_history()
const;
150 Matrix covariance_relative();
152 HomPoint pos_global(
float ref_x,
float ref_y,
float ref_theta );
153 HomVector vel_global(
float vel_x,
float vel_y,
float vel_theta,
163 int m_visibility_history;
171 virtual ~PoseRecord();
173 void set_pose(
float x,
float y,
float theta,
174 float* covariance = NULL );
175 void set_velocity(
float vel_x,
float vel_y,
float vel_theta,
176 float* covariance = NULL );
181 Matrix velocity_covariance();
187 Matrix m_velocity_covariance;
191 class OpponentsRecord
195 virtual ~OpponentsRecord();
197 void set_pos(
unsigned int opp_id,
float distance,
float bearing,
198 float* covariance = NULL );
199 void set_pos( HomPose2d robot_pose,
200 unsigned int opp_id,
float rel_dist,
float rel_bearing,
201 float* rel_covariance = NULL );
202 void disappeared(
unsigned int opp_id );
204 std::map<unsigned int, HomPoint> positions();
207 std::map<unsigned int, HomPoint> m_glob_opp_positions;
213 unsigned int get_host_id(std::string host);
214 void clock_in_host(
unsigned int id);
218 typedef LockMap<std::string, unsigned int> HostLockMap;
219 typedef LockList<std::string> HostLockList;
220 typedef LockMap<unsigned int, long> TimeLockMap;
221 typedef LockMap<unsigned int, BallRecord> BallLockMap;
222 typedef LockMap<unsigned int, PoseRecord> PoseLockMap;
223 typedef LockMap<unsigned int, OpponentsRecord> OpponentsLockMap;
226 unsigned int m_host_id;
229 HostLockList m_timedout_hosts;
230 TimeLockMap m_last_seen;
231 BallLockMap m_ball_positions;
232 PoseLockMap m_robot_poses;
233 OpponentsLockMap m_opponents;
235 GameState m_game_state;
242 bool m_new_data_available;
244 bool m_host_timedout;