SDHLibrary-CPP 0.0.2.10SCHUNK GmbH & Co. KG
C++ access library for SCHUNK Dextrous Hand SDH

SDH Namespace Reference

Classes

class  cCANSerial_ESD_Internal
 internal hardware specific implementation details of the lowlevel ESD CAN interface More...
class  cCANSerial_ESDException
 Derived exception class for low-level CAN ESD related exceptions. More...
class  cCANSerial_ESD
 Low-level communication class to access a CAN port from company ESD (http://www.esd.eu/) More...
class  cCANSerial_PEAK_Internal
 internal hardware specific implementation details of the lowlevel PEAK CAN interface More...
class  cCANSerial_PEAKException
 Derived exception class for low-level CAN PEAK related exceptions. More...
class  cCANSerial_PEAK
 Low-level communication class to access a CAN port from company PEAK (http://www.peak-system.com) More...
class  cCRC
 Cyclic Redundancy Code checker class, used for protecting communication against transmission errors. More...
class  cCRC_DSACON32m
 A derived CRC class that uses a CRC table and initial value suitable for the Weiss Robotics DSACON32m controller. More...
class  cCRC_SDH
 A derived CRC class that uses a CRC table and initial value suitable for protecing the binary communication with SDH via RS232. More...
class  cDBG
 A class to print colored debug messages. More...
class  cHexByteString
 dummy class for (debug) stream output of bytes as list of hex values More...
class  cDSAException
 Derived exception class for low-level DSA related exceptions. More...
class  cDSA
 SDH::cDSA is the end user interface class to access the DSACON32m, the tactile sensor controller of the SDH. More...
class  cRS232Exception
 Derived exception class for low-level RS232 related exceptions. More...
class  cRS232
 Low-level communication class to access a serial port on Cygwin and Linux. More...
class  cSDH
 SDH::cSDH is the end user interface class to control a SDH (SCHUNK Dexterous Hand). More...
class  cSDHErrorInvalidParameter
 Derived exception class for exceptions related to invalid parameters. More...
class  cSDHBase
 The base class to control the SCHUNK Dexterous Hand. More...
class  cMsg
 Class for short, fixed maximum length text messages. More...
class  cSDHLibraryException
 Base class for exceptions in the SDHLibrary-CPP. More...
class  cSDHErrorCommunication
 Derived exception class for exceptions related to communication between the SDHLibrary and the SDH. More...
struct  sSDHBinaryRequest
 data structure with binary data for request from PC to SDH More...
struct  sSDHBinaryResponse
 data structure with binary data for response from SDH to PC More...
class  cSDHSerial
 The class to communicate with a SDH via RS232. More...
class  cSerialBaseException
 Derived exception class for low-level serial communication related exceptions. More...
class  cSerialBase
 Low-level communication class to access a serial port. More...
class  cSimpleStringList
 A simple string list. (Fixed maximum number of strings of fixed maximum length) More...
class  cSimpleTime
 Very simple class to measure elapsed time. More...
class  cSimpleVectorException
 Derived exception class for low-level simple vector related exceptions. More...
class  cSimpleVector
 A simple vector implementation. More...
class  cTCPSerialException
 Derived exception class for low-level CAN ESD related exceptions. More...
class  cTCPSerial
 Low-level communication class to access a CAN port. More...
class  cUnitConverter
 Unit conversion class to convert values between physical unit systems. More...
class  cSetValueTemporarily
 helper class to set value on construction and reset to previous value on destruction. (RAII-idiom) More...

Typedefs

typedef int8_t Int8
 signed integer, size 1 Byte (8 Bit)
typedef uint8_t UInt8
 unsigned integer, size 1 Byte (8 Bit)
typedef int16_t Int16
 signed integer, size 2 Byte (16 Bit)
typedef uint16_t UInt16
 unsigned integer, size 2 Byte (16 Bit)
typedef int32_t Int32
 signed integer, size 4 Byte (32 Bit)
typedef uint32_t UInt32
 unsigned integer, size 4 Byte (32 Bit)
typedef void * PCAN_HANDLE
 Linux libpcan uses HANDLE where Windows Pcan_usb.h uses no handle at all:
typedef UInt16 tCRCValue
 the data type used to calculate and exchange CRC values with DSACON32m (16 bit integer)
typedef cSimpleVector(cSDHSerial::* pSetFunction )(int, double *)
 Type of a pointer to a "set-axis-values" function like cSDHSerial::p, cSDHSerial::pos, ..., cSDHSerial::igrip, cSDHSerial::ihold or cSDHSerial::ilim.
typedef cSimpleVector(cSDHSerial::* pGetFunction )(int, double *)
 Type of a pointer to a "get-axis-values" function like cSDHSerial::p, cSDHSerial::pos, ..., cSDHSerial::igrip, cSDHSerial::ihold or cSDHSerial::ilim.
typedef void * tDeviceHandle
 generic device handle for CAN devices
typedef time_t tTimevalSec
typedef suseconds_t tTimevalUSec
typedef double(cUnitConverter::* pDoubleUnitConverterFunction )(double) const
 Type of a pointer to a function like 'double SDH::cUnitConverter::ToExternal( double ) const' or 'double SDH::cUnitConverter::ToInternal( double ) const'.

Enumerations

enum  { eNUMBER_OF_ELEMENTS = cSimpleVector::eNUMBER_OF_ELEMENTS }

Functions

VCC_EXPORT std::ostream & operator<< (std::ostream &stream, cHexByteString const &s)
 output the bytes in s to stream as a list of space separated hex bytes (without 0x prefix)
std::ostream & operator<< (std::ostream &stream, cDSA::sResponse const &response)
VCC_EXPORT std::ostream & operator<< (std::ostream &stream, cDSA::sControllerInfo const &controller_info)
VCC_EXPORT std::ostream & operator<< (std::ostream &stream, cDSA::sSensorInfo const &sensor_info)
VCC_EXPORT std::ostream & operator<< (std::ostream &stream, cDSA::sMatrixInfo const &matrix_info)
VCC_EXPORT std::ostream & operator<< (std::ostream &stream, cDSA const &dsa)
char const * SDHCommandCodeToString (eCommandCode cc)
char const * SDHReturnCodeToString (eReturnCode rc)
std::ostream & operator<< (std::ostream &stream, cMsg const &msg)
std::ostream & operator<< (std::ostream &stream, cSDHLibraryException const &e)
struct SDH::sSDHBinaryRequest __attribute__ ((packed))
std::ostream & operator<< (std::ostream &stream, sSDHBinaryRequest const &request)
 helper functions to insert a human readable form of the request into stream
std::ostream & operator<< (std::ostream &stream, sSDHBinaryResponse const &response)
 helper functions to insert a human readable form of the restore into stream
std::ostream & operator<< (std::ostream &stream, cSimpleStringList const &ssl)
 Output of cSimpleStringList objects in 'normal' output streams.
std::vector< int > NumerifyRelease (char const *rev)
Auxiliary functions

bool InIndex (int v, int max)
bool InRange (double v, double min, double max)
bool InRange (int n, double const *v, double const *min, double const *max)
double ToRange (double v, double min, double max)
void ToRange (int n, double *v, double const *min, double const *max)
void ToRange (std::vector< double > &v, std::vector< double > const &min, std::vector< double > const &max)
void ToRange (cSimpleVector &v, std::vector< double > const &min, std::vector< double > const &max)
double Approx (double a, double b, double eps)
bool Approx (int n, double *a, double *b, double *eps)
double DegToRad (double d)
double RadToDeg (double r)
void SleepSec (double t)
int CompareReleases (char const *rev1, char const *rev2)
 compare release strings
template<typename Function , typename Tp >
void apply (Function f, Tp &sequence)
template<typename Function , typename InputIterator >
Function apply (Function f, InputIterator first, InputIterator last)
template<typename Function , typename Tp >
Tp map (Function f, Tp sequence)
template<typename T >
std::ostream & operator<< (std::ostream &stream, std::vector< T > const &v)

Variables

SDH::cRS232Exception SDH__attribute__
std::ostream * g_sdh_debug_log = &std::cerr
cUnitConverter const uc_identity ("any","any","?", 1.0, 0.0, 4)
 Identity converter (internal = external)

Detailed Description

A namespace for all classes and functions in the SDHLibrary.

The use of the namespace can be disabled at compile time of the library by setting SDH_USE_NAMESPACE to 0.


Typedef Documentation

typedef int16_t SDH::Int16

signed integer, size 2 Byte (16 Bit)

typedef int32_t SDH::Int32

signed integer, size 4 Byte (32 Bit)

typedef int8_t SDH::Int8

signed integer, size 1 Byte (8 Bit)

typedef void* SDH::PCAN_HANDLE

Linux libpcan uses HANDLE where Windows Pcan_usb.h uses no handle at all:

typedef double(cUnitConverter::* SDH::pDoubleUnitConverterFunction)(double) const
typedef cSimpleVector(cSDHSerial::* SDH::pGetFunction)(int, double *)

Type of a pointer to a "get-axis-values" function like cSDHSerial::p, cSDHSerial::pos, ..., cSDHSerial::igrip, cSDHSerial::ihold or cSDHSerial::ilim.

typedef cSimpleVector(cSDHSerial::* SDH::pSetFunction)(int, double *)

Type of a pointer to a "set-axis-values" function like cSDHSerial::p, cSDHSerial::pos, ..., cSDHSerial::igrip, cSDHSerial::ihold or cSDHSerial::ilim.

the data type used to calculate and exchange CRC values with DSACON32m (16 bit integer)

typedef void* SDH::tDeviceHandle

generic device handle for CAN devices

typedef time_t SDH::tTimevalSec
typedef suseconds_t SDH::tTimevalUSec
typedef uint16_t SDH::UInt16

unsigned integer, size 2 Byte (16 Bit)

typedef uint32_t SDH::UInt32

unsigned integer, size 4 Byte (32 Bit)

typedef uint8_t SDH::UInt8

unsigned integer, size 1 Byte (8 Bit)


Enumeration Type Documentation

anonymous enum
Enumerator:
eNUMBER_OF_ELEMENTS 

Function Documentation

struct SDH::sSDHBinaryResponse SDH::__attribute__ ( (packed)  )
template<typename Function , typename Tp >
void SDH::apply ( Function  f,
Tp &  sequence 
)

Apply a function to every element of a sequence, the elements of the sequence are modified by f

Parameters:
fA unary function object.
sequenceThe iterable sequence to modify.

Applies the function object f to each element of the sequence.

template<typename Function , typename InputIterator >
Function SDH::apply ( Function  f,
InputIterator  first,
InputIterator  last 
)

Apply a function to every element of a sequence.

Parameters:
firstAn input iterator.
lastAn input iterator.
fA unary function object.
Returns:
f.

Applies the function object f to each element in the range [first,last). f must not modify the order of the sequence. If f has a return value it is ignored.

VCC_EXPORT double SDH::Approx ( double  a,
double  b,
double  eps 
)

Return True if a is approximately the same as b. I.E. |a-b| < eps

VCC_EXPORT bool SDH::Approx ( int  n,
double *  a,
double *  b,
double *  eps 
)

Return True if list/tuple/array a=(a1,a2,...) is approximately the same as b=(b1,b2,...). I.E. |a_i-b_i| < eps[i]

VCC_EXPORT int SDH::CompareReleases ( char const *  rev1,
char const *  rev2 
)

compare release strings

compare release strings rev1 and rev2.

Returns:
-1,0, or 1 if rev1 is older, equal or newer than rev2
Parameters:
rev1- a release string like "0.0.1.5" or "0.0.1.11-a"
rev2- another release string

Example:

  • CompareReleases( "0.0.1.5", "0.0.1.5" ) ==> 0
  • CompareReleases( "0.0.1.5", "0.0.1.4" ) ==> 1
  • CompareReleases( "0.0.1.5", "0.0.2.1" ) ==> -1
  • CompareReleases( "0.0.1.5", "0.0.1.5-a" ) ==> -1
VCC_EXPORT double SDH::DegToRad ( double  d)

Return d in deg converted to rad

VCC_EXPORT bool SDH::InIndex ( int  v,
int  max 
)

Return True if v is in range [0 .. max[

VCC_EXPORT bool SDH::InRange ( int  n,
double const *  v,
double const *  min,
double const *  max 
)

Return True if in list/tuple/array v=(v1,v2,...) each v_i is in range [min_i..max_i] with min = (min1, min2,...) max = (max1, max2, ..)

VCC_EXPORT bool SDH::InRange ( double  v,
double  min,
double  max 
)

Return True if v is in range [min .. max]

template<typename Function , typename Tp >
Tp SDH::map ( Function  f,
Tp  sequence 
)

map a function to every element of a sequence, returning a copy with the mapped elements

Parameters:
f- A unary function object.
sequence- An iterable object.
Returns:
copy of sequence with the mapped elements
std::vector<int> SDH::NumerifyRelease ( char const *  rev)

return a vector of integer numbers for a release string rev

Parameters:
revrelease string like "0.0.1.11-a"
Returns:
a vector of integer numbers like [0,0,1,11,1]
std::ostream & SDH::operator<< ( std::ostream &  stream,
sSDHBinaryRequest const &  request 
)

helper functions to insert a human readable form of the request into stream

VCC_EXPORT std::ostream& SDH::operator<< ( std::ostream &  stream,
cHexByteString const &  s 
) [inline]

output the bytes in s to stream as a list of space separated hex bytes (without 0x prefix)

template<typename T >
std::ostream& SDH::operator<< ( std::ostream &  stream,
std::vector< T > const &  v 
)

Overloaded insertion operator for vectors: a comma and space separated list of the vector elements of v is inserted into stream

Parameters:
stream- the output stream to insert into
v- the vector of objects to insert into stream
Returns:
the stream with the inserted objects
Attention:
If you use the SDH namespace then you should be aware that using this overloaded insertion operator can get tricky:
  • If you use a using namespace SDH directive then things are easy and intuitive:
         #include <sdh/util.h>
         using namespace SDH;
         std::vector<int> v;
         std::cout << "this is a std::vector: " << v << "\n";
    
  • But without the using namespace SDH accessing the operator is tricky, you have to use the 'functional' access operator<<(s,v) in order to be able to apply the scope resolution operator :: correctly:
         #include <sdh/util.h>
         std::vector<int> v;
         SDH::operator<<( std::cout << "this is a std::vector: ", v ) << "\n";
    
  • The more intuitive approaches do not work:
         std::cout << faa ;                // obviously fails with "no match for >>operator<<<< in >>std::cout << faa<<", as expected
         std::cout SDH::<< faa ;           // is a syntax error
         std::cout SDH::operator<< faa ;   // is a syntax error
         std::cout operator SDH::<< faa ;  // is a syntax error
    
std::ostream & SDH::operator<< ( std::ostream &  stream,
cDSA::sSensorInfo const &  sensor_info 
)
VCC_EXPORT std::ostream & SDH::operator<< ( std::ostream &  stream,
cMsg const &  msg 
)
VCC_EXPORT std::ostream & SDH::operator<< ( std::ostream &  stream,
cSDHLibraryException const &  e 
)
VCC_EXPORT std::ostream & SDH::operator<< ( std::ostream &  stream,
cSimpleStringList const &  ssl 
)

Output of cSimpleStringList objects in 'normal' output streams.

std::ostream & SDH::operator<< ( std::ostream &  stream,
cDSA::sMatrixInfo const &  matrix_info 
)
std::ostream & SDH::operator<< ( std::ostream &  stream,
sSDHBinaryResponse const &  response 
)

helper functions to insert a human readable form of the restore into stream

VCC_EXPORT std::ostream & SDH::operator<< ( std::ostream &  stream,
cDSA::sResponse const &  response 
)
std::ostream & SDH::operator<< ( std::ostream &  stream,
cDSA const &  dsa 
)
std::ostream & SDH::operator<< ( std::ostream &  stream,
cDSA::sControllerInfo const &  controller_info 
)
VCC_EXPORT double SDH::RadToDeg ( double  r)

Return r in rad converted to deg

char const * SDH::SDHCommandCodeToString ( eCommandCode  cc)
char const * SDH::SDHReturnCodeToString ( eReturnCode  rc)
VCC_EXPORT void SDH::SleepSec ( double  t)

Sleep for t seconds. (t is a double!)

VCC_EXPORT void SDH::ToRange ( int  n,
double *  v,
double const *  min,
double const *  max 
)

Limit each v_i in v to range [min_i..max_i] with min = (min1, min2,...) max = (max1, max2, ..) This modifies *v!

VCC_EXPORT double SDH::ToRange ( double  v,
double  min,
double  max 
)

Return v limited to range [min .. max]. I.e. if v is < min then min is returned, or if v > max then max is returned, else v is returned

VCC_EXPORT void SDH::ToRange ( std::vector< double > &  v,
std::vector< double > const &  min,
std::vector< double > const &  max 
)

Limit each v_i in v to range [min_i..max_i] with min = (min1, min2,...) max = (max1, max2, ..) This modifies v!

VCC_EXPORT void SDH::ToRange ( cSimpleVector &  v,
std::vector< double > const &  min,
std::vector< double > const &  max 
)

Limit each v_i in v to range [min_i..max_i] with min = (min1, min2,...) max = (max1, max2, ..) This modifies v!


Variable Documentation

VCC_EXPORT std::ostream * SDH::g_sdh_debug_log = &std::cerr

Identity converter (internal = external)