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 //======================================================================
cSDHBase::SetDebugOutput
virtual void SetDebugOutput(std::ostream *debuglog)
change the stream to use for debug messages
Definition: sdhbase.h:273
cSDHBase::eEC_AXIS_DISABLED
@ eEC_AXIS_DISABLED
Definition: sdhbase.h:142
cSDHLibraryException
Base class for exceptions in the SDHLibrary-CPP.
Definition: sdhexception.h:132
cSDHBase::eEC_NO_COMMAND
@ eEC_NO_COMMAND
Definition: sdhbase.h:148
g_sdh_debug_log
NAMESPACE_SDH_START VCC_EXPORT std::ostream * g_sdh_debug_log
Definition: sdhbase.cpp:55
cSDHBase::max_angle_v
cSimpleVector max_angle_v
Maximum allowed axis angles (in internal units (degrees))
Definition: sdhbase.h:330
NAMESPACE_SDH_END
#define NAMESPACE_SDH_END
Definition: sdhlibrary_settings.h:80
cSDHBase::eCT_VELOCITY_ACCELERATION
@ eCT_VELOCITY_ACCELERATION
velocity controller with acceleration ramp, velocities and accelerations of axes are controlled indep...
Definition: sdhbase.h:181
cSDHBase::eEC_NO_PARAMS_EXPECTED
@ eEC_NO_PARAMS_EXPECTED
Definition: sdhbase.h:126
cSDHErrorInvalidParameter::cSDHErrorInvalidParameter
cSDHErrorInvalidParameter(cMsg const &_msg)
Definition: sdhbase.h:81
cSDHBase::eVP_SIN_SQUARE
@ eVP_SIN_SQUARE
sin square velocity profile
Definition: sdhbase.h:194
cSDHBase::eEC_INSUFFICIENT_RESOURCES
@ eEC_INSUFFICIENT_RESOURCES
Definition: sdhbase.h:123
cSDHBase::cdbg
cDBG cdbg
debug stream to print colored debug messages
Definition: sdhbase.h:279
cSDHBase::eEC_FEATURE_NOT_SUPPORTED
@ eEC_FEATURE_NOT_SUPPORTED
Definition: sdhbase.h:118
cSDHBase::eVP_RAMP
@ eVP_RAMP
ramp velocity profile
Definition: sdhbase.h:195
cSDHBase::eEC_DEVICE_NOT_FOUND
@ eEC_DEVICE_NOT_FOUND
Definition: sdhbase.h:134
cSDHBase::eEC_NOT_ENOUGH_PARAMS
@ eEC_NOT_ENOUGH_PARAMS
Definition: sdhbase.h:125
cSDHBase::eCT_VELOCITY
@ eCT_VELOCITY
velocity controller, velocities of axes are controlled independently (not implemented in SDH firmware...
Definition: sdhbase.h:180
cSDHBase::eEC_ALREADY_RUNNING
@ eEC_ALREADY_RUNNING
Definition: sdhbase.h:117
cSDHBase::eEC_DEVICE_NOT_OPENED
@ eEC_DEVICE_NOT_OPENED
Definition: sdhbase.h:135
cSDHBase::eControllerType
eControllerType
An enum for all possible SDH internal controller types (order must match that in the SDH firmware in ...
Definition: sdhbase.h:176
cDBG::SetOutput
void SetOutput(std::ostream *fd)
Definition: dbg.h:185
cSDHBase::eps
double eps
epsilon value (max absolute deviation of reported values from actual hardware values) (needed since S...
Definition: sdhbase.h:315
cSimpleVector
A simple vector implementation.
Definition: simplevector.h:91
cSDHBase::eEC_INVALID_HANDLE
@ eEC_INVALID_HANDLE
Definition: sdhbase.h:133
cSDHBase::eEC_IO_ERROR
@ eEC_IO_ERROR
Definition: sdhbase.h:136
dbg.h
This file contains interface and implementation of class #SDH::cDBG, a class for colorfull debug mess...
error_code
UInt16 error_code
0000h, if successful, otherwise error code
Definition: dsa.h:116
cSDHBase::eEC_NOT_AVAILABLE
@ eEC_NOT_AVAILABLE
Definition: sdhbase.h:115
cSDHBase::eEC_RANGE_ERROR
@ eEC_RANGE_ERROR
Definition: sdhbase.h:138
cSDHBase::debug_level
int debug_level
debug level of this object
Definition: sdhbase.h:282
cSDHBase::eVelocityProfile
eVelocityProfile
An enum for all possible SDH internal velocity profile types.
Definition: sdhbase.h:191
cSDHBase::NUMBER_OF_FINGERS
int NUMBER_OF_FINGERS
The number of fingers.
Definition: sdhbase.h:300
cSDHBase::eEC_CRC_ERROR
@ eEC_CRC_ERROR
Definition: sdhbase.h:147
cSDHBase::eEC_UNKNOWN_ERROR
@ eEC_UNKNOWN_ERROR
Definition: sdhbase.h:151
cSDHBase::eEC_NOT_INITIALIZED
@ eEC_NOT_INITIALIZED
Definition: sdhbase.h:116
cSDHBase::eEC_TIMEOUT
@ eEC_TIMEOUT
Definition: sdhbase.h:120
cSDHBase::eErrorCode
eErrorCode
Definition: sdhbase.h:112
cSDHBase::eEC_MAX_COMMANDLINE_EXCEEDED
@ eEC_MAX_COMMANDLINE_EXCEEDED
Definition: sdhbase.h:146
cSDHBase::eEC_INCONSISTENT_DATA
@ eEC_INCONSISTENT_DATA
Definition: sdhbase.h:119
cMsg
Class for short, fixed maximum length text messages.
Definition: sdhexception.h:77
cSDHBase::eEC_OVER_TEMPERATURE
@ eEC_OVER_TEMPERATURE
Definition: sdhbase.h:143
cSDHBase
The base class to control the SCHUNK Dexterous Hand.
Definition: sdhbase.h:97
cSDHBase::eEC_ACCESS_DENIED
@ eEC_ACCESS_DENIED
Definition: sdhbase.h:129
cSDHBase::eEC_HOMING_ERROR
@ eEC_HOMING_ERROR
Definition: sdhbase.h:141
cSDHBase::~cSDHBase
virtual ~cSDHBase()
Definition: sdhbase.h:217
cSDHBase::eEC_CMD_FORMAT_ERROR
@ eEC_CMD_FORMAT_ERROR
Definition: sdhbase.h:128
cDBG
A class to print colored debug messages.
Definition: dbg.h:113
simplevector.h
Interface of class #SDH::cSimpleVector.
cSDHBase::min_angle_v
cSimpleVector min_angle_v
simple vector of 7 0 values ???
Definition: sdhbase.h:327
cSDHBase::eps_v
cSimpleVector eps_v
simple vector of 7 epsilon values
Definition: sdhbase.h:318
NAMESPACE_SDH_START
#define NAMESPACE_SDH_START
Definition: sdhlibrary_settings.h:79
cSDHErrorInvalidParameter
Derived exception class for exceptions related to invalid parameters.
Definition: sdhbase.h:78
cdbg
cDBG cdbg(false, "red")
cSDHBase::eEC_CMD_FAILED
@ eEC_CMD_FAILED
Definition: sdhbase.h:131
cSDHBase::eEC_CMD_UNKNOWN
@ eEC_CMD_UNKNOWN
Definition: sdhbase.h:127
sdhexception.h
Interface of the exception base class #SDH::cSDHLibraryException and #SDH::cMsg.
cSDHBase::eEC_MAX_COMMANDS_EXCEEDED
@ eEC_MAX_COMMANDS_EXCEEDED
Definition: sdhbase.h:144
cSDHBase::firmware_state
eErrorCode firmware_state
the last known state of the SDH firmware
Definition: sdhbase.h:309
cSDHBase::eEC_INVALID_PARAMETER
@ eEC_INVALID_PARAMETER
Definition: sdhbase.h:137
cSDHBase::eEC_INTERNAL
@ eEC_INTERNAL
Definition: sdhbase.h:150
cSDHBase::NUMBER_OF_TEMPERATURE_SENSORS
int NUMBER_OF_TEMPERATURE_SENSORS
The number of temperature sensors.
Definition: sdhbase.h:303
sdhlibrary_settings.h
This file contains settings to make the SDHLibrary compile on differen systems:
cSDHBase::eEC_INDEX_OUT_OF_BOUNDS
@ eEC_INDEX_OUT_OF_BOUNDS
Definition: sdhbase.h:140
cSDHBase::eEC_READ_ERROR
@ eEC_READ_ERROR
Definition: sdhbase.h:121
cSDHBase::eEC_ALREADY_OPEN
@ eEC_ALREADY_OPEN
Definition: sdhbase.h:130
cSDHBase::eEC_NO_DATAPIPE
@ eEC_NO_DATAPIPE
Definition: sdhbase.h:139
cSDHBase::all_axes_used
int all_axes_used
Bit field with the bits for all axes set.
Definition: sdhbase.h:306
cSDHBase::eEC_CMD_ABORTED
@ eEC_CMD_ABORTED
Definition: sdhbase.h:132
cSDHBase::eGraspId
eGraspId
The enum values of the known grasps.
Definition: sdhbase.h:162
cSDHBase::eEC_CHECKSUM_ERROR
@ eEC_CHECKSUM_ERROR
Definition: sdhbase.h:124
cSDHBase::eEC_INVALID_PASSWORD
@ eEC_INVALID_PASSWORD
Definition: sdhbase.h:145
cSDHBase::eEC_WRITE_ERROR
@ eEC_WRITE_ERROR
Definition: sdhbase.h:122
cSDHBase::NUMBER_OF_AXES
int NUMBER_OF_AXES
The number of axes.
Definition: sdhbase.h:297


sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Wed Mar 2 2022 01:00:58