Fawkes API  Fawkes Development Version
messages.h
1 
2 /***************************************************************************
3  * messages.h - World Info Transceiver Messages
4  *
5  * Created: Wed May 02 10:25:56 2007
6  * Copyright 2006-2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __NETCOMM_WORLDINFO_MESSAGES_H_
25 #define __NETCOMM_WORLDINFO_MESSAGES_H_
26 
27 #include <netcomm/worldinfo/defs.h>
28 #include <stdint.h>
29 
30 #pragma pack(push,4)
31 
32 namespace fawkes {
33 
34 /** WorldInfo message IDs. */
35 typedef enum {
36  WORLDINFO_MSGTYPE_POSE = 1, /**< Sending robot's pose */
37  WORLDINFO_MSGTYPE_VELO = 2, /**< Sending robot's velocity */
38  WORLDINFO_MSGTYPE_RELBALL = 3, /**< Observed relative ball position */
39  WORLDINFO_MSGTYPE_RELBALLVELO = 4, /**< Observed relative ball velocity */
40  WORLDINFO_MSGTYPE_OPP_POSE = 5, /**< Observed opponent pose */
41  WORLDINFO_MSGTYPE_OPP_DISAPP = 6, /**< Observed opponent disappered */
42  WORLDINFO_MSGTYPE_FAT_WORLDINFO = 7, /**< Fat message containing all the information, @deprecated */
43  WORLDINFO_MSGTYPE_GAMESTATE = 8, /**< Gamestate info */
44  WORLDINFO_MSGTYPE_PENALTY = 9, /**< Penalty info */
45  WORLDINFO_MSGTYPE_GLOBBALL = 10,/**< Global ball position */
46  WORLDINFO_MSGTYPE_GLOBBALLVELO = 11 /**< Global ball velocity */
48 
49 
50 /** Per-message header.
51  * In the sent buffer each message is preceeded by a per-message header which
52  * contains the message type ID and the message length.
53  */
54 typedef struct {
55  uint16_t type; /**< message type in network byte order */
56  uint16_t size; /**< message size in network byte order */
58 
59 
60 /** World info header.
61  * Every message conglomerate (each packet) is prefixed by this general
62  * header. It is used to determine if decryption has been successful, if protocol
63  * versions are compatible and if the received sequence number is valid to prevent
64  * replay attacks or problems with packets received out-of-order.
65  */
66 typedef struct {
67  uint16_t beef; /**< has to contain 0xBEEF in network byte order */
68  uint8_t version; /**< version of the following content */
69  uint8_t reserved; /**< reserved for future use */
70  uint32_t seq; /**< sequence number in network byte order */
72 
73 
74 /** Robot pose message.
75  * This message ought to be send by a robot to distribute its belief about its
76  * position. This is NOT meant to be send with information about positions of
77  * any other object or robot. There is a strong binding between the sender and
78  * the object which this data describes.
79  */
80 typedef struct {
81  float x; /**< X coordinate */
82  float y; /**< Y coordinate */
83  float theta; /**< orientation */
84  float covariance[WORLDINFO_COVARIANCE_SIZE_3X3]; /**< position covariance matrix */
86 
87 
88 /** Robot velocity message.
89  * This message ought to be send by a robot to distribute its belief about its
90  * velocity. This is NOT meant to be send with information about velocities of
91  * any other object or robot. There is a strong binding between the sender and
92  * the object which this data describes.
93  */
94 typedef struct {
95  float vel_x; /**< Velocity in X direction */
96  float vel_y; /**< Velocity in Y direction */
97  float vel_theta; /**< Rotational velocity */
98  float covariance[WORLDINFO_COVARIANCE_SIZE_3X3]; /**< velocity covariance matrix */
100 
101 
102 /** Relative ball position message.
103  * This message describes a robots belief about the position of a ball relative
104  * to itself.
105  * This is NOT meant to be send with information about any other object but the ball.
106  * There is a strong binding between the sender and the object which this data
107  * describes which means that with this message a robot may not distribute another
108  * robots belief of a ball position.
109  */
110 typedef struct {
111  int32_t history : 24; /**< visibility history, positive means number of positive
112  * observations in a row, 0 means vision has just been
113  * initialized, negative number means the number of negative
114  * observations in a row (not seen for three loops results
115  * in a history of -3). */
116  int32_t visible : 1; /**< -1 if ball visible, 0 otherwise. If the ball is not
117  * visible the position will be the last known position.
118  */
119  int32_t reserved : 7; /**< reserved for future use. */
120  float bearing; /**< bearing to the ball, this is the angle between the robots
121  * forward direction and the ball on the ground plane (azimuth)*/
122  float dist; /**< distance to the robot */
123  float slope; /**< slope to the ball, this is the angle between the robots
124  * center position on the ground plane and the ball (declination) */
125  float covariance[WORLDINFO_COVARIANCE_SIZE_3X3]; /**< ball covariance matrix */
127 
128 
129 /** Global ball position message.
130  * This message describes a robots belief about the global position of a ball.
131  * This is NOT meant to be send with information about any other object but the ball.
132  */
133 typedef struct {
134  int32_t history : 24; /**< visibility history, positive means number of positive
135  * observations in a row, 0 means vision has just been
136  * initialized, negative number means the number of negative
137  * observations in a row (not seen for three loops results
138  * in a history of -3). */
139  int32_t visible : 1; /**< -1 if ball visible, 0 otherwise. If the ball is not
140  * visible the position will be the last known position.
141  */
142  int32_t reserved : 7; /**< reserved for future use. */
143  float x; /**< x-coordinate of the global ball positions */
144  float y; /**< y-coordinate of the global ball positions */
145  float z; /**< z-coordinate of the global ball positions */
146  float covariance[WORLDINFO_COVARIANCE_SIZE_3X3]; /**< ball covariance matrix */
148 
149 
150 /** Relative ball velocity message.
151  * This message describes a robots belief about the velocity of a ball relative
152  * to itself.
153  * This is NOT meant to be send with information about any other object but the ball.
154  * There is a strong binding between the sender and the object which this data
155  * describes which means that with this message a robot may not distribute another
156  * robots belief of a ball position.
157  */
158 typedef struct {
159  float vel_x; /**< relative velocity of the ball in x direction */
160  float vel_y; /**< relative velocity of the ball in y direction */
161  float vel_z; /**< relative velocity of the ball in z direction */
162  float covariance[WORLDINFO_COVARIANCE_SIZE_3X3]; /**< ball velocity covariance matrix */
164 
165 
166 /** Global ball velocity message.
167  * This message describes a robots belief about the velocity wrt. the global frame.
168  */
169 typedef struct {
170  float vel_x; /**< global velocity of the ball in x direction */
171  float vel_y; /**< global velocity of the ball in y direction */
172  float vel_z; /**< global velocity of the ball in z direction */
173  float covariance[WORLDINFO_COVARIANCE_SIZE_3X3]; /**< ball velocity covariance matrix */
175 
176 
177 /** Opponent message.
178  * This message should be sent for every opponent that a robot detects. The position
179  * is given in robot-relative polar coordinates on the ground plane.
180  * This is NOT meant to be send with information about any other object but an opponent.
181  * There is a strong binding between the sender and the object which this data
182  * describes which means that with this message a robot may not distribute another
183  * robots belief of an opponent position.
184  * The sending robot assigns an ID to each opponent. The ID is unique on the robot, which
185  * means that if two messages are sent with the same ID it can be assumed that it is for
186  * the exact same opponents.
187  */
188 typedef struct {
189  uint32_t uid; /**< unique ID of this opponent */
190  float dist; /**< distance to the opponent. */
191  float bearing; /**< bearing to the opponent, this is the angle between the robots
192  * forward direction and the opponent on the ground plane (azimuth)*/
193  float covariance[WORLDINFO_COVARIANCE_SIZE_2X2]; /**< opponent position covariance matrix */
195 
196 
197 /** Opponent disappeared.
198  * This message should be sent for every opponent that disappeared or that cannot be
199  * tracked any longer. The UID is the uid that had been sent with an earlier opponent
200  * pose message.
201  */
202 typedef struct {
203  uint32_t uid; /**< unique ID of the disappeared opponent */
205 
206 
207 /** Fat worldinfo message.
208  * Legacy adapter message to communicate with TU Graz team.
209  */
210 typedef struct {
211  uint32_t valid_pose : 1; /**< 1 if pose is valid, 0 otherwise*/
212  uint32_t valid_velo : 1; /**< 1 if velo is valid, 0 otherwise*/
213  uint32_t valid_relball_pos : 1; /**< 1 if relball_pos is valid, 0 otherwise*/
214  uint32_t valid_relball_velo : 1; /**< 1 if relball_velo is valid, 0 otherwise*/
215  uint32_t num_opponents : 8; /**< number of opponents with valid data in opponents */
216  uint32_t reserved : 20; /**< reserved for future use */
217  worldinfo_pose_message_t pose; /**< sending robot's pose */
218  worldinfo_velocity_message_t velo; /**< sending robot's velocity */
219  worldinfo_relballpos_message_t relball_pos; /**< ball position relative to sending robot */
220  worldinfo_relballvelo_message_t relball_velo; /**< ball velocity relative to sending robot */
221  worldinfo_opppose_message_t opponents[WORLDINFO_FATMSG_NUMOPPS]; /**< best seen opponents */
223 
224 
225 /** Game state message.
226  * This message is sent by the refbox repeater to indicate the current game state.
227  */
228 typedef struct {
229  uint32_t game_state : 4; /**< Current game state, can be freely chosen,
230  * worldinfo_gamestate_t provides recommended
231  * values for soccer games. */
232  uint32_t state_team : 2; /**< Team the game state references */
233  uint32_t score_cyan : 8; /**< Score of team cyan */
234  uint32_t score_magenta : 8; /**< Score of team magenta */
235  uint32_t our_team : 2; /**< Our team color */
236  uint32_t our_goal_color : 1; /**< Our own goal color */
237  uint32_t half : 1; /**< Game time half */
238  uint32_t reserved : 6; /**< Reserved for future use */
240 
241 /** Penalty message.
242  * This message is sent by the refbox repeater to indicate individual penalties
243  * for particular robots. This is optional and used in the SPL.
244  */
245 typedef struct {
246  uint32_t player : 4; /**< Number of penalized robot. */
247  uint32_t penalty : 6; /**< Penalty code, cf. worldinfo_penalty_t. */
248  uint32_t reserved : 6; /**< Reserved for future use. */
249  uint32_t seconds_remaining : 16; /**< Estimate in seconds when unpenalized. */
251 
252 } // end namespace fawkes
253 
254 #pragma pack(pop)
255 
256 #endif
float vel_z
relative velocity of the ball in z direction
Definition: messages.h:161
Global ball position message.
Definition: messages.h:133
worldinfo_velocity_message_t velo
sending robot's velocity
Definition: messages.h:218
float y
Y coordinate.
Definition: messages.h:82
Relative ball position message.
Definition: messages.h:110
uint8_t reserved
reserved for future use
Definition: messages.h:69
float bearing
bearing to the ball, this is the angle between the robots forward direction and the ball on the groun...
Definition: messages.h:120
float vel_x
relative velocity of the ball in x direction
Definition: messages.h:159
Fawkes library namespace.
float slope
slope to the ball, this is the angle between the robots center position on the ground plane and the b...
Definition: messages.h:123
worldinfo_msgid_t
WorldInfo message IDs.
Definition: messages.h:35
Observed relative ball position.
Definition: messages.h:38
uint16_t beef
has to contain 0xBEEF in network byte order
Definition: messages.h:67
uint16_t size
message size in network byte order
Definition: messages.h:56
World info header.
Definition: messages.h:66
uint32_t uid
unique ID of the disappeared opponent
Definition: messages.h:203
float vel_x
Velocity in X direction.
Definition: messages.h:95
float dist
distance to the opponent.
Definition: messages.h:190
float x
x-coordinate of the global ball positions
Definition: messages.h:143
Global ball position.
Definition: messages.h:45
float vel_z
global velocity of the ball in z direction
Definition: messages.h:172
Observed opponent pose.
Definition: messages.h:40
Observed opponent disappered.
Definition: messages.h:41
worldinfo_pose_message_t pose
sending robot's pose
Definition: messages.h:217
Fat worldinfo message.
Definition: messages.h:210
float vel_theta
Rotational velocity.
Definition: messages.h:97
float vel_y
relative velocity of the ball in y direction
Definition: messages.h:160
float z
z-coordinate of the global ball positions
Definition: messages.h:145
Sending robot's velocity.
Definition: messages.h:37
worldinfo_relballpos_message_t relball_pos
ball position relative to sending robot
Definition: messages.h:219
Relative ball velocity message.
Definition: messages.h:158
Per-message header.
Definition: messages.h:54
Sending robot's pose.
Definition: messages.h:36
float theta
orientation
Definition: messages.h:83
uint32_t seq
sequence number in network byte order
Definition: messages.h:70
Global ball velocity message.
Definition: messages.h:169
Robot velocity message.
Definition: messages.h:94
Robot pose message.
Definition: messages.h:80
Global ball velocity.
Definition: messages.h:46
worldinfo_relballvelo_message_t relball_velo
ball velocity relative to sending robot
Definition: messages.h:220
Observed relative ball velocity.
Definition: messages.h:39
Fat message containing all the information,.
Definition: messages.h:42
float x
X coordinate.
Definition: messages.h:81
float vel_y
Velocity in Y direction.
Definition: messages.h:96
uint16_t type
message type in network byte order
Definition: messages.h:55
uint32_t uid
unique ID of this opponent
Definition: messages.h:189
float vel_y
global velocity of the ball in y direction
Definition: messages.h:171
float bearing
bearing to the opponent, this is the angle between the robots forward direction and the opponent on t...
Definition: messages.h:191
float dist
distance to the robot
Definition: messages.h:122
uint8_t version
version of the following content
Definition: messages.h:68
float y
y-coordinate of the global ball positions
Definition: messages.h:144
float vel_x
global velocity of the ball in x direction
Definition: messages.h:170