sdhbase.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2007 SCHUNK GmbH & Co. KG
00003  * Copyright (c) 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *   http://www.apache.org/licenses/LICENSE-2.0
00010 
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 //======================================================================
00045 //======================================================================
00046 
00047 #ifndef SDHBASE_H_
00048 #define SDHBASE_H_
00049 
00050 #include "sdhlibrary_settings.h"
00051 
00052 #if SDH_USE_VCC
00053 # pragma warning(disable : 4290)
00054 #endif
00055 
00056 //----------------------------------------------------------------------
00057 // System Includes - include with <>
00058 //----------------------------------------------------------------------
00059 
00060 #include "iostream"
00061 
00062 //----------------------------------------------------------------------
00063 // Project Includes - include with ""
00064 //----------------------------------------------------------------------
00065 
00066 #include "dbg.h"
00067 #include "sdhexception.h"
00068 #include "simplevector.h"
00069 
00070 //----------------------------------------------------------------------
00071 // Defines, enums, unions, structs,
00072 //----------------------------------------------------------------------
00073 
00074 NAMESPACE_SDH_START
00075 
00076 
00077 //----------------------------------------------------------------------
00078 // Global variables
00079 //----------------------------------------------------------------------
00080 
00081 extern VCC_EXPORT std::ostream* g_sdh_debug_log;
00082 
00083 //----------------------------------------------------------------------
00084 // Function declarations
00085 //----------------------------------------------------------------------
00086 
00087 
00088 //----------------------------------------------------------------------
00089 // Class declarations
00090 //----------------------------------------------------------------------
00091 
00095 class VCC_EXPORT cSDHErrorInvalidParameter: public cSDHLibraryException
00096 {
00097 public:
00098   cSDHErrorInvalidParameter(cMsg const & _msg)
00099     : cSDHLibraryException("cSDHErrorInvalidParameter", _msg)
00100   {}
00101 };
00102 //======================================================================
00103 
00114 class VCC_EXPORT cSDHBase
00115 {
00116 public:
00117 
00119   enum
00120   {
00121     All = -1 
00122   };
00123 
00124 
00130   enum eErrorCode
00131   {
00132     eEC_SUCCESS = 0,
00133     eEC_NOT_AVAILABLE,
00134     eEC_NOT_INITIALIZED,
00135     eEC_ALREADY_RUNNING,
00136     eEC_FEATURE_NOT_SUPPORTED,
00137     eEC_INCONSISTENT_DATA,
00138     eEC_TIMEOUT,
00139     eEC_READ_ERROR,
00140     eEC_WRITE_ERROR,
00141     eEC_INSUFFICIENT_RESOURCES,
00142     eEC_CHECKSUM_ERROR,
00143     eEC_NOT_ENOUGH_PARAMS,
00144     eEC_NO_PARAMS_EXPECTED,
00145     eEC_CMD_UNKNOWN,
00146     eEC_CMD_FORMAT_ERROR,
00147     eEC_ACCESS_DENIED,
00148     eEC_ALREADY_OPEN,
00149     eEC_CMD_FAILED,
00150     eEC_CMD_ABORTED,
00151     eEC_INVALID_HANDLE,
00152     eEC_DEVICE_NOT_FOUND,
00153     eEC_DEVICE_NOT_OPENED,
00154     eEC_IO_ERROR,
00155     eEC_INVALID_PARAMETER,
00156     eEC_RANGE_ERROR,
00157     eEC_NO_DATAPIPE,
00158     eEC_INDEX_OUT_OF_BOUNDS,
00159     eEC_HOMING_ERROR,
00160     eEC_AXIS_DISABLED,
00161     eEC_OVER_TEMPERATURE,
00162     eEC_MAX_COMMANDS_EXCEEDED,
00163     eEC_INVALID_PASSWORD,
00164     eEC_MAX_COMMANDLINE_EXCEEDED,
00165     eEC_CRC_ERROR,
00166     eEC_NO_COMMAND,
00167 
00168     eEC_INTERNAL,
00169     eEC_UNKNOWN_ERROR,
00170 
00171     eEC_DIMENSION         
00172   };
00173 
00174 
00180   enum eGraspId
00181   {
00182     // ??? fehlt e vor enums:
00183     eGID_INVALID = -1,    
00184     eGID_CENTRICAL = 0,   
00185     eGID_PARALLEL = 1,    
00186     eGID_CYLINDRICAL = 2, 
00187     eGID_SPHERICAL = 3,   
00188 
00189     eGID_DIMENSION        
00190   };
00191 
00192 
00194   enum eControllerType
00195   {
00196     eCT_INVALID = -1,          
00197     eCT_POSE = 0,              
00198     eCT_VELOCITY,              
00199     eCT_VELOCITY_ACCELERATION, 
00200 
00201 // TODO: not implemented yet
00202 //        eCT_POSITION,              //!< position controller, positions of axes are controlled independently  (not implemented in %SDH firmwares up to and including 0.0.2.5)
00203 
00204     eCT_DIMENSION         
00205   };
00206 
00207 
00209   enum eVelocityProfile
00210   {
00211     eVP_INVALID = -1,  
00212     eVP_SIN_SQUARE,    
00213     eVP_RAMP,          
00214 
00215     eVP_DIMENSION      
00216   };
00217 
00218   //-----------------------------------------------------------------
00228   cSDHBase(int debug_level);
00229 
00230 
00231   //-----------------------------------------------------------------
00235   virtual ~cSDHBase()
00236   {}
00237 
00238 
00240   void CheckIndex(int index, int maxindex, char const* name = "")
00241   throw (cSDHErrorInvalidParameter*);
00242 
00243 
00245   void CheckRange(double value, double minvalue, double maxvalue, char const* name = "")
00246   throw (cSDHErrorInvalidParameter*);
00247 
00248 
00250   void CheckRange(double* values, double* minvalues, double* maxvalues, char const* name = "")
00251   throw (cSDHErrorInvalidParameter*);
00252 
00253 
00255   static char const* GetStringFromErrorCode(eErrorCode error_code);
00256 
00257 
00259   static char const* GetStringFromGraspId(eGraspId grasp_id);
00260 
00261 
00263   static char const* GetStringFromControllerType(eControllerType controller_type);
00264 
00265 
00267   int GetNumberOfAxes(void);
00268 
00269 
00271   int GetNumberOfFingers(void);
00272 
00273 
00275   int GetNumberOfTemperatureSensors(void);
00276 
00277 
00279   eErrorCode GetFirmwareState(void);
00280 
00281 
00283   double GetEps(void);
00284 
00285 
00287   cSimpleVector const & GetEpsVector(void);
00288 
00289 
00291   virtual bool IsOpen(void) = 0;
00292 
00294   virtual void SetDebugOutput(std::ostream* debuglog)
00295   {
00296     cdbg.SetOutput(debuglog);
00297   }
00298 protected:
00300   cDBG cdbg;
00301 
00303   int debug_level;
00304 
00306   static char const* firmware_error_codes[];
00307 
00308 
00310   static char const* grasp_id_name[];
00311 
00312 
00314   static char const* controller_type_name[];
00315   //---------------------
00316 
00318   int NUMBER_OF_AXES;
00319 
00321   int NUMBER_OF_FINGERS;
00322 
00324   int NUMBER_OF_TEMPERATURE_SENSORS;
00325 
00327   int all_axes_used;
00328 
00330   eErrorCode firmware_state;
00331 
00336   double eps;
00337 
00339   cSimpleVector eps_v;
00340 
00342   //cSimpleVector zeros_v;
00343 
00345   //cSimpleVector ones_v;
00346 
00348   cSimpleVector min_angle_v;
00349 
00351   cSimpleVector max_angle_v;
00352 
00353 };
00354 
00355 // end of class cSDHBase
00356 //=====================================================================
00357 
00358 NAMESPACE_SDH_END
00359 
00360 #endif
00361 
00362 
00363 //======================================================================
00364 /*
00365   Here are some settings for the emacs/xemacs editor (and can be safely ignored):
00366   (e.g. to explicitely set C++ mode for *.h header files)
00367 
00368   Local Variables:
00369   mode:C++
00370   mode:ELSE
00371   End:
00372 */
00373 //======================================================================


schunk_sdh
Author(s): Mathias Luedtke , Florian Weisshardt
autogenerated on Sat Jun 8 2019 20:25:21