Home
FAQ
Player
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

stage1p3.h

Go to the documentation of this file.
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000  
00004  *     Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
00005  *                      
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 /*
00024  * $Id: stage1p3.h,v 1.1 2003/10/16 22:06:11 rtv Exp $
00025  *
00026  * defines information necessary for the Stage/Player interaction
00027  */
00028 
00029 #ifndef _STAGE_H
00030 #define _STAGE_H
00031 
00032 /* get types and device-specific packet formats */
00033 #include <player.h>
00034 /* for playerqueue functionality (used in configuration req/rep) */
00035 #include <playerqueue.h>
00036 #include <sys/time.h> // for struct timeval
00037 #include <semaphore.h> // for sem_t
00038 
00039 #include <fcntl.h> // for fcntl
00040 #include <unistd.h> // for fcntl
00041 
00042 #define STAGE_CLOCK_NAME "clock"
00043 #define STAGE_LOCK_NAME "lock"
00044 
00045 // the largest number of unique ports player can bind
00046 // this is only used for a temporary buffer
00047 // and can easily be replaced with dynamic allocation if necessary
00048 #define MAXPORTS 2048
00049 
00050 // Notes on stage/player shared memory format.
00051 //
00052 // Each device is allocateed a block of shared memory.
00053 // Each simulated device is allocated a block of shared memory.
00054 // This block is subdivided into 5 parts:
00055 //      info buffer -- device ids, plus timestamps and available byte-counts
00056 //      data buffer
00057 //      command buffer
00058 //      config buffer
00059 //      truth buffer
00060 
00061 // these notes might be a little wrong - check stage's entity.cc behavior:
00062 // player/stage info buffer
00063 // available is set by stage and read by player.
00064 // subscribed is set by player and read by stage.
00065 // data_timestamp is set by stage and read by player.
00066 // data_len is set by stage and read by player.
00067 // command_len is set by player.
00068 // config_len is set by player and reset (to zero) by stage.
00069 //
00070 
00071 typedef struct player_stage_info
00072 {
00073   //sem_t lock; // POSIX semaphore used to protect this structure
00074   int32_t lockbyte; // use this byte in the lock file to guard this device
00075 
00076   player_device_id_t player_id;  // identify this entity to Player
00077   uint8_t drivername[PLAYER_MAX_DEVICE_STRING_LEN]; // name of simulated driver
00078   uint8_t robotname[PLAYER_MAX_DEVICE_STRING_LEN]; // name of robot
00079   uint32_t len;           // total size of this struct + all the buffers
00080   uint8_t subscribed;     // the number of Players connected to this device
00081   uint8_t local;
00082   
00083 
00084   // the type-specific stuff is stored in variable length buffers
00085   // after this header - we store useful info about the availability
00086   // and freshness of that data here
00087   uint32_t data_len;
00088   uint32_t data_avail;
00089   uint32_t data_timestamp_sec;
00090   uint32_t data_timestamp_usec;
00091 
00092   uint32_t command_len;
00093   uint32_t command_avail;
00094   uint32_t command_timestamp_sec;
00095   uint32_t command_timestamp_usec;
00096 
00097   // config_len is this the # of elts in the queue, NOT the # of bytes used!
00098   uint32_t config_len;  
00099   uint32_t config_avail;
00100   uint32_t config_timestamp_sec;
00101   uint32_t config_timestamp_usec;
00102 
00103   // reply_len is this the # of elts in the queue, NOT the # of bytes used!
00104   uint32_t reply_len;
00105   uint32_t reply_avail;
00106   uint32_t reply_timestamp_sec;
00107   uint32_t reply_timestamp_usec;
00108 } __attribute__ ((packed)) player_stage_info_t;
00109 
00110 
00111 
00112 typedef struct stage_clock
00113 {
00114   sem_t lock; // POSIX semaphore used to protect this structure
00115   struct timeval time;
00116 }  __attribute__ ((packed)) stage_clock_t;
00117 
00118 #endif // _STAGE_H
00119 

Generated on Tue May 3 14:15:36 2005 for Player by doxygen 1.3.6