Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
cSDHBase Class Referenceabstract

The base class to control the SCHUNK Dexterous Hand. More...

#include <sdhbase.h>

Inheritance diagram for cSDHBase:
Inheritance graph
[legend]

Public Types

enum  { All = -1 }
 Anonymous enum (instead of define like macros) More...
 
enum  eControllerType {
  eCT_INVALID = -1, eCT_POSE = 0, eCT_VELOCITY, eCT_VELOCITY_ACCELERATION,
  eCT_DIMENSION
}
 An enum for all possible SDH internal controller types (order must match that in the SDH firmware in inc/sdh2.h) More...
 
enum  eErrorCode {
  eEC_SUCCESS = 0, eEC_NOT_AVAILABLE, eEC_NOT_INITIALIZED, eEC_ALREADY_RUNNING,
  eEC_FEATURE_NOT_SUPPORTED, eEC_INCONSISTENT_DATA, eEC_TIMEOUT, eEC_READ_ERROR,
  eEC_WRITE_ERROR, eEC_INSUFFICIENT_RESOURCES, eEC_CHECKSUM_ERROR, eEC_NOT_ENOUGH_PARAMS,
  eEC_NO_PARAMS_EXPECTED, eEC_CMD_UNKNOWN, eEC_CMD_FORMAT_ERROR, eEC_ACCESS_DENIED,
  eEC_ALREADY_OPEN, eEC_CMD_FAILED, eEC_CMD_ABORTED, eEC_INVALID_HANDLE,
  eEC_DEVICE_NOT_FOUND, eEC_DEVICE_NOT_OPENED, eEC_IO_ERROR, eEC_INVALID_PARAMETER,
  eEC_RANGE_ERROR, eEC_NO_DATAPIPE, eEC_INDEX_OUT_OF_BOUNDS, eEC_HOMING_ERROR,
  eEC_AXIS_DISABLED, eEC_OVER_TEMPERATURE, eEC_MAX_COMMANDS_EXCEEDED, eEC_INVALID_PASSWORD,
  eEC_MAX_COMMANDLINE_EXCEEDED, eEC_CRC_ERROR, eEC_NO_COMMAND, eEC_INTERNAL,
  eEC_UNKNOWN_ERROR, eEC_DIMENSION
}
 
enum  eGraspId {
  eGID_INVALID = -1, eGID_CENTRICAL = 0, eGID_PARALLEL = 1, eGID_CYLINDRICAL = 2,
  eGID_SPHERICAL = 3, eGID_DIMENSION
}
 The enum values of the known grasps. More...
 
enum  eVelocityProfile { eVP_INVALID = -1, eVP_SIN_SQUARE, eVP_RAMP, eVP_DIMENSION }
 An enum for all possible SDH internal velocity profile types. More...
 

Public Member Functions

void CheckIndex (int index, int maxindex, char const *name="")
 Check if index is in [0 .. maxindex-1] or All. Throw a cSDHErrorInvalidParameter exception if not. More...
 
void CheckRange (double value, double minvalue, double maxvalue, char const *name="")
 Check if value is in [minvalue .. maxvalue]. Throw a cSDHErrorInvalidParameter exception if not. More...
 
void CheckRange (double *values, double *minvalues, double *maxvalues, char const *name="")
 Check if any value[i] in array values is in [minvalue[i] .. maxvalue[i]]. Throw a cSDHErrorInvalidParameter exception if not. More...
 
 cSDHBase (int debug_level)
 
double GetEps (void)
 Return the eps value. More...
 
cSimpleVector const & GetEpsVector (void)
 Return simple vector of number of axes epsilon values. More...
 
eErrorCode GetFirmwareState (void)
 Return the last known state of the SDH firmware. More...
 
int GetNumberOfAxes (void)
 Return the number of axes of the SDH. More...
 
int GetNumberOfFingers (void)
 Return the number of fingers of the SDH. More...
 
int GetNumberOfTemperatureSensors (void)
 Return the number of temperature sensors of the SDH. More...
 
virtual bool IsOpen (void)=0
 Return true if connection to SDH firmware/hardware is open. More...
 
virtual void SetDebugOutput (std::ostream *debuglog)
 change the stream to use for debug messages More...
 
virtual ~cSDHBase ()
 

Static Public Member Functions

static char const * GetStringFromControllerType (eControllerType controller_type)
 Return a ptr to a (static) string describing controller type controller_Type. More...
 
static char const * GetStringFromErrorCode (eErrorCode error_code)
 Return a ptr to a (static) string describing error code error_code. More...
 
static char const * GetStringFromGraspId (eGraspId grasp_id)
 Return a ptr to a (static) string describing grasp id grasp_id. More...
 

Protected Attributes

int all_axes_used
 Bit field with the bits for all axes set. More...
 
cDBG cdbg
 debug stream to print colored debug messages More...
 
int debug_level
 debug level of this object More...
 
double eps
 epsilon value (max absolute deviation of reported values from actual hardware values) (needed since SDH firmware limits number of digits reported) More...
 
cSimpleVector eps_v
 simple vector of 7 epsilon values More...
 
eErrorCode firmware_state
 the last known state of the SDH firmware More...
 
cSimpleVector max_angle_v
 Maximum allowed axis angles (in internal units (degrees)) More...
 
cSimpleVector min_angle_v
 simple vector of 7 0 values ??? More...
 
int NUMBER_OF_AXES
 The number of axes. More...
 
int NUMBER_OF_FINGERS
 The number of fingers. More...
 
int NUMBER_OF_TEMPERATURE_SENSORS
 The number of temperature sensors. More...
 

Static Protected Attributes

static char const * controller_type_name []
 A mapping from eControllerType controller type enums to strings with human readable controller type names. More...
 
static char const * firmware_error_codes []
 A mapping from eErrorCode error code enums to strings with human readable error messages. More...
 
static char const * grasp_id_name []
 A mapping from eGraspId grasp id enums to strings with human readable grasp id names. More...
 

Detailed Description

The base class to control the SCHUNK Dexterous Hand.

End-Users should NOT use this class directly, as it only provides some common settings and no function interface. End users should use the class cSDH instead, as it provides the end-user functions to control the SDH.


Definition at line 97 of file sdhbase.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Anonymous enum (instead of define like macros)

Enumerator
All 

A meta-value that means "access all possible values".

Definition at line 102 of file sdhbase.h.

◆ eControllerType

An enum for all possible SDH internal controller types (order must match that in the SDH firmware in inc/sdh2.h)

Enumerator
eCT_INVALID 

invalid controller_type (needed for cSDHSerial::con() to indicate "read current controller type")

eCT_POSE 

coordinated position controller (position per axis => "pose controller"), all axes start and stop moving at the same time

eCT_VELOCITY 

velocity controller, velocities of axes are controlled independently (not implemented in SDH firmwares up to and including 0.0.2.5)

eCT_VELOCITY_ACCELERATION 

velocity controller with acceleration ramp, velocities and accelerations of axes are controlled independently (not implemented in SDH firmwares up to and including 0.0.2.5)

eCT_DIMENSION 

Endmarker and dimension.

Definition at line 176 of file sdhbase.h.

◆ eErrorCode

The error codes of the SDH firmware

Enumerator
eEC_SUCCESS 
eEC_NOT_AVAILABLE 
eEC_NOT_INITIALIZED 
eEC_ALREADY_RUNNING 
eEC_FEATURE_NOT_SUPPORTED 
eEC_INCONSISTENT_DATA 
eEC_TIMEOUT 
eEC_READ_ERROR 
eEC_WRITE_ERROR 
eEC_INSUFFICIENT_RESOURCES 
eEC_CHECKSUM_ERROR 
eEC_NOT_ENOUGH_PARAMS 
eEC_NO_PARAMS_EXPECTED 
eEC_CMD_UNKNOWN 
eEC_CMD_FORMAT_ERROR 
eEC_ACCESS_DENIED 
eEC_ALREADY_OPEN 
eEC_CMD_FAILED 
eEC_CMD_ABORTED 
eEC_INVALID_HANDLE 
eEC_DEVICE_NOT_FOUND 
eEC_DEVICE_NOT_OPENED 
eEC_IO_ERROR 
eEC_INVALID_PARAMETER 
eEC_RANGE_ERROR 
eEC_NO_DATAPIPE 
eEC_INDEX_OUT_OF_BOUNDS 
eEC_HOMING_ERROR 
eEC_AXIS_DISABLED 
eEC_OVER_TEMPERATURE 
eEC_MAX_COMMANDS_EXCEEDED 
eEC_INVALID_PASSWORD 
eEC_MAX_COMMANDLINE_EXCEEDED 
eEC_CRC_ERROR 
eEC_NO_COMMAND 
eEC_INTERNAL 
eEC_UNKNOWN_ERROR 
eEC_DIMENSION 

Endmarker and dimension.

Definition at line 112 of file sdhbase.h.

◆ eGraspId

The enum values of the known grasps.

Enumerator
eGID_INVALID 

invalid grasp id

eGID_CENTRICAL 

centrical grasp: ???

eGID_PARALLEL 

parallel grasp: ???

eGID_CYLINDRICAL 

cylindrical grasp: ???

eGID_SPHERICAL 

spherecial grasp: ???

eGID_DIMENSION 

Endmarker and dimension.

Definition at line 162 of file sdhbase.h.

◆ eVelocityProfile

An enum for all possible SDH internal velocity profile types.

Enumerator
eVP_INVALID 

not a valid velocity profile, used to make #SDH::cSDHSerial::vp() read the velocity profile from the SDH firmware

eVP_SIN_SQUARE 

sin square velocity profile

eVP_RAMP 

ramp velocity profile

eVP_DIMENSION 

endmarker and dimension

Definition at line 191 of file sdhbase.h.

Constructor & Destructor Documentation

◆ cSDHBase()

cSDHBase::cSDHBase ( int  debug_level)

Constructor of cSDHBase class, initilize internal variables and settings

Parameters
debug_level: debug level of the created object. If the debug_level of an object is > 0 then it will output debug messages.

Definition at line 137 of file sdhbase.cpp.

◆ ~cSDHBase()

virtual cSDHBase::~cSDHBase ( )
inlinevirtual

virtual destructor to make compiler happy

Definition at line 217 of file sdhbase.h.

Member Function Documentation

◆ CheckIndex()

void cSDHBase::CheckIndex ( int  index,
int  maxindex,
char const *  name = "" 
)

Check if index is in [0 .. maxindex-1] or All. Throw a cSDHErrorInvalidParameter exception if not.

Definition at line 169 of file sdhbase.cpp.

◆ CheckRange() [1/2]

void cSDHBase::CheckRange ( double  value,
double  minvalue,
double  maxvalue,
char const *  name = "" 
)

Check if value is in [minvalue .. maxvalue]. Throw a cSDHErrorInvalidParameter exception if not.

Definition at line 177 of file sdhbase.cpp.

◆ CheckRange() [2/2]

void cSDHBase::CheckRange ( double *  values,
double *  minvalues,
double *  maxvalues,
char const *  name = "" 
)

Check if any value[i] in array values is in [minvalue[i] .. maxvalue[i]]. Throw a cSDHErrorInvalidParameter exception if not.

Definition at line 185 of file sdhbase.cpp.

◆ GetEps()

double cSDHBase::GetEps ( void  )

Return the eps value.

Definition at line 254 of file sdhbase.cpp.

◆ GetEpsVector()

cSimpleVector const & cSDHBase::GetEpsVector ( void  )

Return simple vector of number of axes epsilon values.

Definition at line 261 of file sdhbase.cpp.

◆ GetFirmwareState()

cSDHBase::eErrorCode cSDHBase::GetFirmwareState ( void  )

Return the last known state of the SDH firmware.

Definition at line 247 of file sdhbase.cpp.

◆ GetNumberOfAxes()

int cSDHBase::GetNumberOfAxes ( void  )

Return the number of axes of the SDH.

Definition at line 226 of file sdhbase.cpp.

◆ GetNumberOfFingers()

int cSDHBase::GetNumberOfFingers ( void  )

Return the number of fingers of the SDH.

Definition at line 233 of file sdhbase.cpp.

◆ GetNumberOfTemperatureSensors()

int cSDHBase::GetNumberOfTemperatureSensors ( void  )

Return the number of temperature sensors of the SDH.

Definition at line 240 of file sdhbase.cpp.

◆ GetStringFromControllerType()

char const * cSDHBase::GetStringFromControllerType ( eControllerType  controller_type)
static

Return a ptr to a (static) string describing controller type controller_Type.

Definition at line 216 of file sdhbase.cpp.

◆ GetStringFromErrorCode()

char const * cSDHBase::GetStringFromErrorCode ( eErrorCode  error_code)
static

Return a ptr to a (static) string describing error code error_code.

Definition at line 196 of file sdhbase.cpp.

◆ GetStringFromGraspId()

char const * cSDHBase::GetStringFromGraspId ( eGraspId  grasp_id)
static

Return a ptr to a (static) string describing grasp id grasp_id.

Definition at line 206 of file sdhbase.cpp.

◆ IsOpen()

virtual bool cSDHBase::IsOpen ( void  )
pure virtual

Return true if connection to SDH firmware/hardware is open.

Implemented in cSDH, and cSDHSerial.

◆ SetDebugOutput()

virtual void cSDHBase::SetDebugOutput ( std::ostream *  debuglog)
inlinevirtual

change the stream to use for debug messages

Reimplemented in cSDH.

Definition at line 273 of file sdhbase.h.

Member Data Documentation

◆ all_axes_used

int cSDHBase::all_axes_used
protected

Bit field with the bits for all axes set.

Definition at line 306 of file sdhbase.h.

◆ cdbg

cDBG cSDHBase::cdbg
protected

debug stream to print colored debug messages

Definition at line 279 of file sdhbase.h.

◆ controller_type_name

char const * cSDHBase::controller_type_name
staticprotected
Initial value:
=
{
"eCT_POSE: position/pose controller coordinated",
"eCT_VELOCITY: velocity controller",
"eCT_VELOCITY_ACCELERATION: velocity with acceleration ramp controller",
"eCT_DIMENSION: number of controller types"
}

A mapping from eControllerType controller type enums to strings with human readable controller type names.

Definition at line 293 of file sdhbase.h.

◆ debug_level

int cSDHBase::debug_level
protected

debug level of this object

Definition at line 282 of file sdhbase.h.

◆ eps

double cSDHBase::eps
protected

epsilon value (max absolute deviation of reported values from actual hardware values) (needed since SDH firmware limits number of digits reported)

Definition at line 315 of file sdhbase.h.

◆ eps_v

cSimpleVector cSDHBase::eps_v
protected

simple vector of 7 epsilon values

Definition at line 318 of file sdhbase.h.

◆ firmware_error_codes

NAMESPACE_SDH_END char const * cSDHBase::firmware_error_codes
staticprotected

A mapping from eErrorCode error code enums to strings with human readable error messages.

Definition at line 285 of file sdhbase.h.

◆ firmware_state

eErrorCode cSDHBase::firmware_state
protected

the last known state of the SDH firmware

Definition at line 309 of file sdhbase.h.

◆ grasp_id_name

char const * cSDHBase::grasp_id_name
staticprotected
Initial value:
=
{
"eGID_CENTRICAL: centrical grasp",
"eGID_PARALLEL: parallel grasp",
"eGID_CYLINDRICAL: cylindrical grasp",
"eGID_SPHERICAL: spherecial grasp",
"eGID_DIMENSION: number of predefined grasp ids"
}

A mapping from eGraspId grasp id enums to strings with human readable grasp id names.

Definition at line 289 of file sdhbase.h.

◆ max_angle_v

cSimpleVector cSDHBase::max_angle_v
protected

Maximum allowed axis angles (in internal units (degrees))

Definition at line 330 of file sdhbase.h.

◆ min_angle_v

cSimpleVector cSDHBase::min_angle_v
protected

simple vector of 7 0 values ???

simple vector of 7 1 values ??? Minimum allowed axis angles (in internal units (degrees))

Definition at line 327 of file sdhbase.h.

◆ NUMBER_OF_AXES

int cSDHBase::NUMBER_OF_AXES
protected

The number of axes.

Definition at line 297 of file sdhbase.h.

◆ NUMBER_OF_FINGERS

int cSDHBase::NUMBER_OF_FINGERS
protected

The number of fingers.

Definition at line 300 of file sdhbase.h.

◆ NUMBER_OF_TEMPERATURE_SENSORS

int cSDHBase::NUMBER_OF_TEMPERATURE_SENSORS
protected

The number of temperature sensors.

Definition at line 303 of file sdhbase.h.


The documentation for this class was generated from the following files:


sdhlibrary_cpp
Author(s): Dirk Osswald
autogenerated on Mon Feb 28 2022 23:41:52