player.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000
4  * Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
5  *
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  */
22 /********************************************************************
23  *
24  * This library is free software; you can redistribute it and/or
25  * modify it under the terms of the GNU Lesser General Public
26  * License as published by the Free Software Foundation; either
27  * version 2.1 of the License, or (at your option) any later version.
28  *
29  * This library is distributed in the hope that it will be useful,
30  * but WITHOUT ANY WARRANTY; without even the implied warranty of
31  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32  * Lesser General Public License for more details.
33  *
34  * You should have received a copy of the GNU Lesser General Public
35  * License along with this library; if not, write to the Free Software
36  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
37  *
38  ********************************************************************/
39 
40 /*
41  * Desc: Player communication packet structures and codes
42  * CVS: $Id$
43  */
44 
45 
46 #ifndef PLAYER_H
47 #define PLAYER_H
48 
49 #include <time.h>
50 
51 /* Include values from the configure script */
52 #include "playerconfig.h"
53 
68 #define PLAYER_MAX_MESSAGE_SIZE 8388608 /*8MB*/
69 
70 #define PLAYER_MAX_PAYLOAD_SIZE (PLAYER_MAX_MESSAGE_SIZE - sizeof(player_msghdr_t))
71 
72 #define PLAYER_MAX_DRIVER_STRING_LEN 64
73 
74 #define PLAYER_MAX_DEVICES 4096
75 
76 #define PLAYER_MSGQUEUE_DEFAULT_MAXLEN 1024
77 
78 #define PLAYER_IDENT_STRING "Player v."
79 
80 #define PLAYER_IDENT_STRLEN 32
81 
82 #define PLAYER_KEYLEN 32
83 
95 #define PLAYER_MSGTYPE_DATA 1
96 
99 #define PLAYER_MSGTYPE_CMD 2
100 
106 #define PLAYER_MSGTYPE_REQ 3
107 
112 #define PLAYER_MSGTYPE_RESP_ACK 4
113 
117 #define PLAYER_MSGTYPE_SYNCH 5
118 
125 #define PLAYER_MSGTYPE_RESP_NACK 6
126 
145 typedef struct player_devaddr
146 {
148  uint32_t host;
151  uint32_t robot;
153  uint16_t interf;
155  uint16_t index;
157 
161 typedef struct player_msghdr
162 {
166  uint8_t type;
168  uint8_t subtype;
170  double timestamp;
172  uint32_t seq;
174  uint32_t size;
184 typedef struct player_point_2d
185 {
187  double px;
189  double py;
191 
192 
194 typedef struct player_point_3d
195 {
197  double px;
199  double py;
201  double pz;
203 
204 
206 typedef struct player_orientation_3d
207 {
209  double proll;
211  double ppitch;
213  double pyaw;
215 
217 typedef struct player_pose2d
218 {
220  double px;
222  double py;
224  double pa;
226 
228 typedef struct player_pose3d
229 {
231  double px;
233  double py;
235  double pz;
237  double proll;
239  double ppitch;
241  double pyaw;
243 
245 typedef struct player_bbox2d
246 {
248  double sw;
250  double sl;
252 
254 typedef struct player_bbox3d
255 {
257  double sw;
259  double sl;
261  double sh;
263 
266 {
268  uint32_t key_count;
270  char* key;
272  uint32_t group_count;
274  char* group;
276  uint16_t type;
278  uint16_t subtype;
280  uint32_t data_count;
282  uint8_t* data;
284  uint32_t timestamp_sec;
286  uint32_t timestamp_usec;
289 
291 typedef struct player_segment
292 {
294  double x0;
296  double y0;
298  double x1;
300  double y1;
302 
307 typedef struct player_extent2d
308 {
310  double x0;
312  double y0;
314  double x1;
316  double y1;
318 
320 typedef struct player_color
321 {
323  uint8_t alpha;
325  uint8_t red;
327  uint8_t green;
329  uint8_t blue;
331 
333 typedef struct player_bool
334 {
336  uint8_t state;
338 
340 typedef struct player_uint32
341 {
342  uint32_t value;
344 
345 
396 #define PLAYER_CAPABILITIES_REQ 255
398 #define PLAYER_CAPABILTIES_REQ 255
401 
404 {
406  uint32_t type;
408  uint32_t subtype;
410 
429 #define PLAYER_GET_INTPROP_REQ 254
431 #define PLAYER_SET_INTPROP_REQ 253
433 #define PLAYER_GET_DBLPROP_REQ 252
435 #define PLAYER_SET_DBLPROP_REQ 251
437 #define PLAYER_GET_STRPROP_REQ 250
439 #define PLAYER_SET_STRPROP_REQ 249
441 #define PLAYER_GET_BOOLPROP_REQ 248
443 #define PLAYER_SET_BOOLPROP_REQ 247
445 
447 typedef struct player_boolprop_req
448 {
450  uint32_t key_count;
452  char *key;
454  char value;
456 
458 typedef struct player_intprop_req
459 {
461  uint32_t key_count;
463  char *key;
465  int32_t value;
467 
469 typedef struct player_dblprop_req
470 {
472  uint32_t key_count;
474  char *key;
476  double value;
478 
480 typedef struct player_strprop_req
481 {
483  uint32_t key_count;
485  char *key;
487  uint32_t value_count;
489  char *value;
491 
494 // /////////////////////////////////////////////////////////////////////////////
495 //
496 // Here starts the alphabetical list of interfaces
497 // (please keep it that way)
498 //
499 // /////////////////////////////////////////////////////////////////////////////
500 
536 #include <libplayerinterface/player_interfaces.h>
537 
538 #endif /* PLAYER_H */
Request to get an integer property.
Definition: player.h:459
struct player_dblprop_req player_dblprop_req_t
Request to get a double property.
struct player_orientation_3d player_orientation_3d_t
An angle in 3D space.
uint32_t key_count
The property key's length.
Definition: player.h:461
double proll
roll [rad]
Definition: player.h:237
uint32_t host
The "host" on which the device resides.
Definition: player.h:148
double sw
Width [m].
Definition: player.h:248
uint32_t timestamp_usec
Time of entry creation.
Definition: player.h:286
double py
Y [m].
Definition: player.h:199
struct player_uint32 player_uint32_t
Structure for messages returning a single integer.
A rectangular bounding box, used to define the size of an object.
Definition: player.h:255
uint32_t key_count
Length of key in bytes.
Definition: player.h:268
struct player_intprop_req player_intprop_req_t
Request to get an integer property.
struct player_pose3d player_pose3d_t
A pose in space.
uint32_t key_count
The property key's length.
Definition: player.h:450
uint8_t * data
Entry data.
Definition: player.h:282
double px
X [m].
Definition: player.h:231
double py
Y [m].
Definition: player.h:189
A pose in the plane.
Definition: player.h:218
struct player_bbox3d player_bbox3d_t
A rectangular bounding box, used to define the size of an object.
char value
The property value.
Definition: player.h:454
double y1
Endpoints [m].
Definition: player.h:300
uint32_t subtype
The subtype of the requested capability (i.e.
Definition: player.h:408
An angle in 3D space.
Definition: player.h:207
struct player_bbox2d player_bbox2d_t
A rectangular bounding box, used to define the size of an object.
double px
X [m].
Definition: player.h:187
double ppitch
pitch [rad]
Definition: player.h:211
Generic message header.
Definition: player.h:162
double pz
Z [m].
Definition: player.h:235
char * group
Second identifier.
Definition: player.h:274
struct player_point_3d player_point_3d_t
A point in 3D space.
double x1
Endpoints [m].
Definition: player.h:298
A color descriptor.
Definition: player.h:321
struct player_extent2d player_extent2d_t
A rectangular bounding box, used to define the origin and bounds of an object.
uint8_t type
Message type; must be one of PLAYER_MSGTYPE_*.
Definition: player.h:166
uint32_t type
The type of the requested capability (i.e.
Definition: player.h:406
double px
X [m].
Definition: player.h:220
A line segment, used to construct vector-based maps.
Definition: player.h:292
double x1
Endpoints [m].
Definition: player.h:314
double pyaw
yaw [rad]
Definition: player.h:241
A point in 3D space.
Definition: player.h:195
uint8_t subtype
Message subtype; interface specific.
Definition: player.h:168
uint32_t robot
The "robot" or device collection in which the device resides.
Definition: player.h:151
uint16_t type
Entry data type.
Definition: player.h:276
uint8_t blue
Blue color channel.
Definition: player.h:329
uint32_t group_count
Second identifier count.
Definition: player.h:272
char * key
Identifier for the entry.
Definition: player.h:270
uint8_t red
Red color channel.
Definition: player.h:325
double py
Y [m].
Definition: player.h:222
Request to get a double property.
Definition: player.h:470
int32_t value
The property value.
Definition: player.h:465
double px
X [m].
Definition: player.h:197
struct player_bool player_bool_t
A boolean variable, 0 for false anything else for true.
struct player_pose2d player_pose2d_t
A pose in the plane.
double x0
Endpoints [m].
Definition: player.h:294
struct player_boolprop_req player_boolprop_req_t
Request to get a boolean property.
double ppitch
pitch [rad]
Definition: player.h:239
double sh
Height [m].
Definition: player.h:261
A rectangular bounding box, used to define the origin and bounds of an object.
Definition: player.h:308
Structure for messages returning a single integer.
Definition: player.h:341
double x0
Origin x [m].
Definition: player.h:310
struct player_point_2d player_point_2d_t
A point in the plane.
double sl
Length [m].
Definition: player.h:259
A rectangular bounding box, used to define the size of an object.
Definition: player.h:246
double proll
roll [rad]
Definition: player.h:209
double sw
Width [m].
Definition: player.h:257
double pz
Z [m].
Definition: player.h:201
A device address.
Definition: player.h:146
double py
Y [m].
Definition: player.h:233
struct player_strprop_req player_strprop_req_t
Request to get a string property.
char * key
The property key.
Definition: player.h:485
double y0
Origin y [m].
Definition: player.h:312
uint8_t state
state
Definition: player.h:336
struct player_capabilities_req player_capabilities_req_t
Structure containing a single capability request.
struct player_devaddr player_devaddr_t
A device address.
A boolean variable, 0 for false anything else for true.
Definition: player.h:334
char * key
The property key.
Definition: player.h:452
char * key
The property key.
Definition: player.h:474
A pose in space.
Definition: player.h:229
uint32_t timestamp_sec
Time of entry creation.
Definition: player.h:284
uint32_t seq
For keeping track of associated messages.
Definition: player.h:172
double y0
Endpoints [m].
Definition: player.h:296
A point in the plane.
Definition: player.h:185
double timestamp
Time associated with message contents (seconds since epoch)
Definition: player.h:170
uint32_t size
Size in bytes of the payload to follow.
Definition: player.h:174
char * key
The property key.
Definition: player.h:463
struct player_color player_color_t
A color descriptor.
Structure containing a single capability request.
Definition: player.h:404
double sl
Length [m].
Definition: player.h:250
double pyaw
yaw [rad]
Definition: player.h:213
double y1
Endpoints [m].
Definition: player.h:316
uint8_t alpha
Alpha (transparency) channel.
Definition: player.h:323
struct player_segment player_segment_t
A line segment, used to construct vector-based maps.
double pa
yaw [rad]
Definition: player.h:224
uint32_t key_count
The property key's length.
Definition: player.h:483
uint32_t key_count
The property key's length.
Definition: player.h:472
char * value
The property value.
Definition: player.h:489
Request to get a string property.
Definition: player.h:481
Vectormap feature data.
Definition: player.h:266
uint32_t value_count
The property's length.
Definition: player.h:487
Request to get a boolean property.
Definition: player.h:448
double value
The property value.
Definition: player.h:476
struct player_blackboard_entry player_blackboard_entry_t
Vectormap feature data.
uint32_t data_count
Entry data length.
Definition: player.h:280
uint16_t subtype
Entry data subtype.
Definition: player.h:278
struct player_msghdr player_msghdr_t
Generic message header.
uint16_t index
Which device of that interface.
Definition: player.h:155
player_devaddr_t addr
Device to which this message pertains.
Definition: player.h:164
uint16_t interf
The interface provided by the device; must be one of PLAYER_*_CODE.
Definition: player.h:153
uint8_t green
Green color channel.
Definition: player.h:327