sdhbase.h
Go to the documentation of this file.
00001 //======================================================================
00028 //======================================================================
00029 
00030 #ifndef SDHBASE_H_
00031 #define SDHBASE_H_
00032 
00033 #include "sdhlibrary_settings.h"
00034 
00035 #if SDH_USE_VCC
00036 # pragma warning(disable : 4290)
00037 #endif
00038 
00039 //----------------------------------------------------------------------
00040 // System Includes - include with <>
00041 //----------------------------------------------------------------------
00042 
00043 #include "iostream"
00044 
00045 //----------------------------------------------------------------------
00046 // Project Includes - include with ""
00047 //----------------------------------------------------------------------
00048 
00049 #include "dbg.h"
00050 #include "sdhexception.h"
00051 #include "simplevector.h"
00052 
00053 //----------------------------------------------------------------------
00054 // Defines, enums, unions, structs,
00055 //----------------------------------------------------------------------
00056 
00057 NAMESPACE_SDH_START
00058 
00059 
00060 //----------------------------------------------------------------------
00061 // Global variables
00062 //----------------------------------------------------------------------
00063 
00064 extern VCC_EXPORT std::ostream* g_sdh_debug_log;
00065 
00066 //----------------------------------------------------------------------
00067 // Function declarations
00068 //----------------------------------------------------------------------
00069 
00070 
00071 //----------------------------------------------------------------------
00072 // Class declarations
00073 //----------------------------------------------------------------------
00074 
00078 class VCC_EXPORT cSDHErrorInvalidParameter: public cSDHLibraryException
00079 {
00080 public:
00081   cSDHErrorInvalidParameter( cMsg const & _msg )
00082     : cSDHLibraryException( "cSDHErrorInvalidParameter", _msg )
00083   {}
00084 };
00085 //======================================================================
00086 
00097 class VCC_EXPORT cSDHBase
00098 {
00099 public:
00100 
00102     enum {
00103         All = -1 
00104     };
00105 
00106 
00112     enum eErrorCode
00113     {
00114         eEC_SUCCESS = 0,
00115         eEC_NOT_AVAILABLE,
00116         eEC_NOT_INITIALIZED,
00117         eEC_ALREADY_RUNNING,
00118         eEC_FEATURE_NOT_SUPPORTED,
00119         eEC_INCONSISTENT_DATA,
00120         eEC_TIMEOUT,
00121         eEC_READ_ERROR,
00122         eEC_WRITE_ERROR,
00123         eEC_INSUFFICIENT_RESOURCES,
00124         eEC_CHECKSUM_ERROR,
00125         eEC_NOT_ENOUGH_PARAMS,
00126         eEC_NO_PARAMS_EXPECTED,
00127         eEC_CMD_UNKNOWN,
00128         eEC_CMD_FORMAT_ERROR,
00129         eEC_ACCESS_DENIED,
00130         eEC_ALREADY_OPEN,
00131         eEC_CMD_FAILED,
00132         eEC_CMD_ABORTED,
00133         eEC_INVALID_HANDLE,
00134         eEC_DEVICE_NOT_FOUND,
00135         eEC_DEVICE_NOT_OPENED,
00136         eEC_IO_ERROR,
00137         eEC_INVALID_PARAMETER,
00138         eEC_RANGE_ERROR,
00139         eEC_NO_DATAPIPE,
00140         eEC_INDEX_OUT_OF_BOUNDS,
00141         eEC_HOMING_ERROR,
00142         eEC_AXIS_DISABLED,
00143         eEC_OVER_TEMPERATURE,
00144         eEC_MAX_COMMANDS_EXCEEDED,
00145         eEC_INVALID_PASSWORD,
00146         eEC_MAX_COMMANDLINE_EXCEEDED,
00147         eEC_CRC_ERROR,
00148         eEC_NO_COMMAND,
00149 
00150         eEC_INTERNAL,
00151         eEC_UNKNOWN_ERROR,
00152 
00153         eEC_DIMENSION         
00154     };
00155 
00156 
00162     enum eGraspId
00163     {
00164         // ??? fehlt e vor enums:
00165         eGID_INVALID = -1,    
00166         eGID_CENTRICAL = 0,   
00167         eGID_PARALLEL = 1,    
00168         eGID_CYLINDRICAL = 2, 
00169         eGID_SPHERICAL = 3,   
00170 
00171         eGID_DIMENSION        
00172     };
00173 
00174 
00176     enum eControllerType
00177     {
00178         eCT_INVALID = -1,          
00179         eCT_POSE = 0,              
00180         eCT_VELOCITY,              
00181         eCT_VELOCITY_ACCELERATION, 
00182 
00183 // TODO: not implemented yet
00184 //        eCT_POSITION,              //!< position controller, positions of axes are controlled independently  (not implemented in %SDH firmwares up to and including 0.0.2.5)
00185 
00186         eCT_DIMENSION         
00187     };
00188 
00189 
00191     enum eVelocityProfile
00192     {
00193         eVP_INVALID = -1,  
00194         eVP_SIN_SQUARE,    
00195         eVP_RAMP,          
00196 
00197         eVP_DIMENSION      
00198     };
00199 
00200     //-----------------------------------------------------------------
00210     cSDHBase( int debug_level );
00211 
00212 
00213     //-----------------------------------------------------------------
00217     virtual ~cSDHBase()
00218     {}
00219 
00220 
00222     void CheckIndex( int index, int maxindex, char const* name="" )
00223         throw (cSDHErrorInvalidParameter*);
00224 
00225 
00227     void CheckRange( double value, double minvalue, double maxvalue, char const* name="" )
00228         throw (cSDHErrorInvalidParameter*);
00229 
00230 
00232     void CheckRange( double* values, double* minvalues, double* maxvalues, char const* name="" )
00233         throw (cSDHErrorInvalidParameter*);
00234 
00235 
00237     static char const* GetStringFromErrorCode( eErrorCode error_code );
00238 
00239 
00241     static char const* GetStringFromGraspId( eGraspId grasp_id );
00242 
00243 
00245     static char const* GetStringFromControllerType( eControllerType controller_type );
00246 
00247 
00249     int GetNumberOfAxes( void );
00250 
00251 
00253     int GetNumberOfFingers( void );
00254 
00255 
00257     int GetNumberOfTemperatureSensors( void );
00258 
00259 
00261     eErrorCode GetFirmwareState( void );
00262 
00263 
00265     double GetEps( void );
00266 
00267 
00269     cSimpleVector const & GetEpsVector( void );
00270 
00271 
00273     virtual bool IsOpen( void ) = 0;
00274 
00276     virtual void SetDebugOutput( std::ostream* debuglog )
00277     {
00278         cdbg.SetOutput( debuglog );
00279     }
00280 protected:
00282     cDBG cdbg;
00283 
00285     int debug_level;
00286 
00288     static char const* firmware_error_codes[];
00289 
00290 
00292     static char const* grasp_id_name[];
00293 
00294 
00296     static char const* controller_type_name[];
00297     //---------------------
00298 
00300     int NUMBER_OF_AXES;
00301 
00303     int NUMBER_OF_FINGERS;
00304 
00306     int NUMBER_OF_TEMPERATURE_SENSORS;
00307 
00309     int all_axes_used;
00310 
00312     eErrorCode firmware_state;
00313 
00318     double eps;
00319 
00321     cSimpleVector eps_v;
00322 
00324     //cSimpleVector zeros_v;
00325 
00327     //cSimpleVector ones_v;
00328 
00330     cSimpleVector min_angle_v;
00331 
00333     cSimpleVector max_angle_v;
00334 
00335 };
00336 
00337 // end of class cSDHBase
00338 //=====================================================================
00339 
00340 NAMESPACE_SDH_END
00341 
00342 #endif
00343 
00344 
00345 //======================================================================
00346 /*
00347   Here are some settings for the emacs/xemacs editor (and can be safely ignored):
00348   (e.g. to explicitely set C++ mode for *.h header files)
00349 
00350   Local Variables:
00351   mode:C++
00352   mode:ELSE
00353   End:
00354 */
00355 //======================================================================


schunk_sdh
Author(s): Mathias Luedtke , Florian Weisshardt
autogenerated on Thu Aug 27 2015 15:07:03