sdhbase.h
Go to the documentation of this file.
1 //======================================================================
28 //======================================================================
29 
30 #ifndef SDHBASE_H_
31 #define SDHBASE_H_
32 
33 #include "sdhlibrary_settings.h"
34 
35 #if SDH_USE_VCC
36 # pragma warning(disable : 4290)
37 #endif
38 
39 //----------------------------------------------------------------------
40 // System Includes - include with <>
41 //----------------------------------------------------------------------
42 
43 #include "iostream"
44 
45 //----------------------------------------------------------------------
46 // Project Includes - include with ""
47 //----------------------------------------------------------------------
48 
49 #include "dbg.h"
50 #include "sdhexception.h"
51 #include "simplevector.h"
52 
53 //----------------------------------------------------------------------
54 // Defines, enums, unions, structs,
55 //----------------------------------------------------------------------
56 
58 
59 
60 //----------------------------------------------------------------------
61 // Global variables
62 //----------------------------------------------------------------------
63 
64 extern VCC_EXPORT std::ostream* g_sdh_debug_log;
65 
66 //----------------------------------------------------------------------
67 // Function declarations
68 //----------------------------------------------------------------------
69 
70 
71 //----------------------------------------------------------------------
72 // Class declarations
73 //----------------------------------------------------------------------
74 
79 {
80 public:
82  : cSDHLibraryException( "cSDHErrorInvalidParameter", _msg )
83  {}
84 };
85 //======================================================================
86 
97 class VCC_EXPORT cSDHBase
98 {
99 public:
100 
102  enum {
103  All = -1
104  };
105 
106 
113  {
114  eEC_SUCCESS = 0,
149 
152 
153  eEC_DIMENSION
154  };
155 
156 
162  enum eGraspId
163  {
164  // ??? fehlt e vor enums:
165  eGID_INVALID = -1,
166  eGID_CENTRICAL = 0,
167  eGID_PARALLEL = 1,
168  eGID_CYLINDRICAL = 2,
169  eGID_SPHERICAL = 3,
170 
171  eGID_DIMENSION
172  };
173 
174 
177  {
178  eCT_INVALID = -1,
179  eCT_POSE = 0,
182 
183 // TODO: not implemented yet
184 // eCT_POSITION, //!< position controller, positions of axes are controlled independently (not implemented in %SDH firmwares up to and including 0.0.2.5)
185 
186  eCT_DIMENSION
187  };
188 
189 
192  {
193  eVP_INVALID = -1,
196 
197  eVP_DIMENSION
198  };
199 
200  //-----------------------------------------------------------------
210  cSDHBase( int debug_level );
211 
212 
213  //-----------------------------------------------------------------
217  virtual ~cSDHBase()
218  {}
219 
220 
222  void CheckIndex( int index, int maxindex, char const* name="" );
223 
224 
226  void CheckRange( double value, double minvalue, double maxvalue, char const* name="" );
227 
228 
230  void CheckRange( double* values, double* minvalues, double* maxvalues, char const* name="" );
231 
232 
234  static char const* GetStringFromErrorCode( eErrorCode error_code );
235 
236 
238  static char const* GetStringFromGraspId( eGraspId grasp_id );
239 
240 
242  static char const* GetStringFromControllerType( eControllerType controller_type );
243 
244 
246  int GetNumberOfAxes( void );
247 
248 
250  int GetNumberOfFingers( void );
251 
252 
254  int GetNumberOfTemperatureSensors( void );
255 
256 
258  eErrorCode GetFirmwareState( void );
259 
260 
262  double GetEps( void );
263 
264 
266  cSimpleVector const & GetEpsVector( void );
267 
268 
270  virtual bool IsOpen( void ) = 0;
271 
273  virtual void SetDebugOutput( std::ostream* debuglog )
274  {
275  cdbg.SetOutput( debuglog );
276  }
277 protected:
280 
283 
285  static char const* firmware_error_codes[];
286 
287 
289  static char const* grasp_id_name[];
290 
291 
293  static char const* controller_type_name[];
294  //---------------------
295 
298 
301 
304 
307 
310 
315  double eps;
316 
319 
321  //cSimpleVector zeros_v;
322 
324  //cSimpleVector ones_v;
325 
328 
331 
332 };
333 
334 // end of class cSDHBase
335 //=====================================================================
336 
338 
339 #endif
340 
341 
342 //======================================================================
343 /*
344  Here are some settings for the emacs/xemacs editor (and can be safely ignored):
345  (e.g. to explicitely set C++ mode for *.h header files)
346 
347  Local Variables:
348  mode:C++
349  mode:ELSE
350  End:
351 */
352 //======================================================================
sin square velocity profile
Definition: sdhbase.h:194
virtual ~cSDHBase()
Definition: sdhbase.h:217
The base class to control the SCHUNK Dexterous Hand.
Definition: sdhbase.h:97
A class to print colored debug messages.
Definition: dbg.h:113
eGraspId
The enum values of the known grasps.
Definition: sdhbase.h:162
NAMESPACE_SDH_START VCC_EXPORT std::ostream * g_sdh_debug_log
Definition: sdhbase.cpp:55
ramp velocity profile
Definition: sdhbase.h:195
void SetOutput(std::ostream *fd)
Definition: dbg.h:185
A simple vector implementation.
Definition: simplevector.h:91
velocity controller, velocities of axes are controlled independently (not implemented in SDH firmware...
Definition: sdhbase.h:180
UInt16 error_code
0000h, if successful, otherwise error code
Definition: dsa.h:116
velocity controller with acceleration ramp, velocities and accelerations of axes are controlled indep...
Definition: sdhbase.h:181
cSDHErrorInvalidParameter(cMsg const &_msg)
Definition: sdhbase.h:81
eVelocityProfile
An enum for all possible SDH internal velocity profile types.
Definition: sdhbase.h:191
eErrorCode firmware_state
the last known state of the SDH firmware
Definition: sdhbase.h:309
This file contains interface and implementation of class #SDH::cDBG, a class for colorfull debug mess...
Interface of the exception base class #SDH::cSDHLibraryException and #SDH::cMsg.
cSimpleVector min_angle_v
simple vector of 7 0 values ???
Definition: sdhbase.h:327
cDBG cdbg(false,"red")
#define NAMESPACE_SDH_START
virtual void SetDebugOutput(std::ostream *debuglog)
change the stream to use for debug messages
Definition: sdhbase.h:273
int NUMBER_OF_AXES
The number of axes.
Definition: sdhbase.h:297
int NUMBER_OF_TEMPERATURE_SENSORS
The number of temperature sensors.
Definition: sdhbase.h:303
Base class for exceptions in the SDHLibrary-CPP.
Definition: sdhexception.h:132
int NUMBER_OF_FINGERS
The number of fingers.
Definition: sdhbase.h:300
eControllerType
An enum for all possible SDH internal controller types (order must match that in the SDH firmware in ...
Definition: sdhbase.h:176
cDBG cdbg
debug stream to print colored debug messages
Definition: sdhbase.h:279
cSimpleVector eps_v
simple vector of 7 epsilon values
Definition: sdhbase.h:318
Interface of class #SDH::cSimpleVector.
eErrorCode
Definition: sdhbase.h:112
int all_axes_used
Bit field with the bits for all axes set.
Definition: sdhbase.h:306
#define NAMESPACE_SDH_END
This file contains settings to make the SDHLibrary compile on differen systems:
Class for short, fixed maximum length text messages.
Definition: sdhexception.h:77
Derived exception class for exceptions related to invalid parameters.
Definition: sdhbase.h:78
double eps
epsilon value (max absolute deviation of reported values from actual hardware values) (needed since S...
Definition: sdhbase.h:315
cSimpleVector max_angle_v
Maximum allowed axis angles (in internal units (degrees))
Definition: sdhbase.h:330
int debug_level
debug level of this object
Definition: sdhbase.h:282


sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Sun Aug 18 2019 03:42:20