Home
FAQ
Player
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

rwidevice.h

Go to the documentation of this file.
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2002
00004  *     Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
00005  *     Nik Melchior
00006  *
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program; if not, write to the Free Software
00020  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00024 /*
00025  * Currently equiped only to interface with the mobility drivers, this base class
00026  * handles the actual interaction between the devices on the RWI robot and some
00027  * underlying system. Since it acts as a proxy for the actual devices, it must
00028  * contain specific logic for each subclass/device which it is capable of
00029  * operating.  Similar to the P2OS device.
00030  */
00031 
00032 #ifndef _RWIDEVICE_H
00033 #define _RWIDEVICE_H
00034 
00035 #if HAVE_CONFIG_H
00036   #include <config.h>
00037 #endif
00038 
00039 #include <pthread.h>
00040 
00041 #include <driver.h>
00042 #include <configfile.h>
00043 #include <player.h>
00044 #include <netinet/in.h>  // for htonl()
00045 
00046 #ifdef USE_MOBILITY
00047 #include <mobilitycomponents_i.h>
00048 #include <mobilitydata_i.h>
00049 #include <mobilityutil.h>
00050 #include <mobilitygeometry_i.h>
00051 #include <mobilityactuator_i.h>
00052 #endif // USE_MOBILITY
00053 
00054 /*************************************************************************/
00055 /*
00056  * RWI drivers
00057  *
00058  * All RWI devices use the same struct for sending config commands.
00059  * The request numbers are found near the devices to which they
00060  * pertain.
00061  *
00062  * TODO: this struct should be renamed in an interface-specific way and moved
00063  *       up into the section(s) for which is pertains.  also, request type
00064  *       codes should be claimed for each one (requests are now part of the
00065  *       device interface)
00066  */
00067 
00068 typedef struct player_rwi_config
00069 {
00070   uint8_t   request;
00071   uint8_t   value;
00072 } __PACKED__ player_rwi_config_t;
00073 /*************************************************************************/
00074 
00075 class CRWIDevice : public Driver  {
00076 
00077 public:
00078         CRWIDevice ( ConfigFile* cf, int section,
00079                        size_t datasize, size_t commandsize,
00080                        int reqqueuelen, int repqueuelen);
00081         ~CRWIDevice ();
00082                 
00083 protected:
00084 
00085         static pthread_mutex_t rwi_counter_mutex;
00086         static unsigned int rwi_device_count;
00087 #ifdef USE_MOBILITY
00088         #define RWI_ROBOT_NAME_MAX 25
00089         #define RWI_MOBILITY_PATH_MAX 100
00090         #define RWI_ROBOT_NAME_DEFAULT "B21R"
00091         
00092         // Used to access the devices managed by mobility.  Most rwi_devices
00093         // should not need to use this helper directly.  Instead, use the
00094         // RWIConnect function below.   
00095         static mbyClientHelper *helper;
00096         
00097         // Keep track of whether a `name' parameter was passed on the command
00098         // line for this device, or the default name is being used.
00099         bool name_provided;
00100         
00101         // This name is the first part of the "path" used to access any of
00102         // your robot's devices in mobility (or MOM).  It is necessary for
00103         // RwiConnect().
00104         char name[RWI_ROBOT_NAME_MAX];
00105         
00106         // Attempts to fill the first argument with a pointer to the requested
00107         // mobility device.  Wraps the call to helper->find_object().
00108         int RWIConnect (CORBA::Object_ptr *corba_ptr, const char *path) const;
00109 #endif // USE_MOBILITY
00110 
00111 };
00112 
00113 #endif // _RWIDEVICE_H

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