The base class to control the SCHUNK Dexterous Hand. More...
#include <sdhbase.h>
Public Types | |
enum | { All = -1 } |
Anonymous enum (instead of define like macros) 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 | 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 | 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 | |
cSDHBase (int debug_level) | |
virtual | ~cSDHBase () |
void | CheckIndex (int index, int maxindex, char const *name="") throw (cSDHErrorInvalidParameter*) |
Check if index is in [0 .. maxindex-1] or All. Throw a cSDHErrorInvalidParameter exception if not. | |
void | CheckRange (double value, double minvalue, double maxvalue, char const *name="") throw (cSDHErrorInvalidParameter*) |
Check if value is in [minvalue .. maxvalue]. Throw a cSDHErrorInvalidParameter exception if not. | |
void | CheckRange (double *values, double *minvalues, double *maxvalues, char const *name="") throw (cSDHErrorInvalidParameter*) |
Check if any value[i] in array values is in [minvalue[i] .. maxvalue[i]]. Throw a cSDHErrorInvalidParameter exception if not. | |
int | GetNumberOfAxes (void) |
Return the number of axes of the SDH. | |
int | GetNumberOfFingers (void) |
Return the number of fingers of the SDH. | |
int | GetNumberOfTemperatureSensors (void) |
Return the number of temperature sensors of the SDH. | |
eErrorCode | GetFirmwareState (void) |
Return the last known state of the SDH firmware. | |
double | GetEps (void) |
Return the eps value. | |
cSimpleVector const & | GetEpsVector (void) |
Return simple vector of number of axes epsilon values. | |
virtual bool | IsOpen (void)=0 |
Return true if connection to SDH firmware/hardware is open. | |
virtual void | SetDebugOutput (std::ostream *debuglog) |
change the stream to use for debug messages | |
Static Public Member Functions | |
static char const * | GetStringFromErrorCode (eErrorCode error_code) |
Return a ptr to a (static) string describing error code error_code. | |
static char const * | GetStringFromGraspId (eGraspId grasp_id) |
Return a ptr to a (static) string describing grasp id grasp_id. | |
static char const * | GetStringFromControllerType (eControllerType controller_type) |
Return a ptr to a (static) string describing controller type controller_Type. | |
Protected Attributes | |
cDBG | cdbg |
debug stream to print colored debug messages | |
int | debug_level |
debug level of this object | |
int | NUMBER_OF_AXES |
The number of axes. | |
int | NUMBER_OF_FINGERS |
The number of fingers. | |
int | NUMBER_OF_TEMPERATURE_SENSORS |
The number of temperature sensors. | |
int | all_axes_used |
Bit field with the bits for all axes set. | |
eErrorCode | firmware_state |
the last known state of the SDH firmware | |
double | eps |
epsilon value (max absolute deviation of reported values from actual hardware values) (needed since SDH firmware limits number of digits reported) | |
cSimpleVector | eps_v |
simple vector of 7 epsilon values | |
cSimpleVector | min_angle_v |
simple vector of 7 0 values ??? | |
cSimpleVector | max_angle_v |
Maximum allowed axis angles (in internal units (degrees)) | |
Static Protected Attributes | |
static char const * | firmware_error_codes [] |
A mapping from eErrorCode error code enums to strings with human readable error messages. | |
static char const * | grasp_id_name [] |
A mapping from eGraspId grasp id enums to strings with human readable grasp id names. | |
static char const * | controller_type_name [] |
A mapping from eControllerType controller type enums to strings with human readable controller type names. |
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.
anonymous enum |
An enum for all possible SDH internal controller types (order must match that in the SDH firmware in inc/sdh2.h)
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. |
The error codes of the SDH firmware
An enum for all possible SDH internal velocity profile types.
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 |
cSDHBase::cSDHBase | ( | int | debug_level | ) |
Constructor of cSDHBase class, initilize internal variables and settings
debug_level | : debug level of the created object. If the debug_level of an object is > 0 then it will output debug messages.
|
virtual SDH::cSDHBase::~cSDHBase | ( | ) | [inline, virtual] |
virtual destructor to make compiler happy
void cSDHBase::CheckIndex | ( | int | index, |
int | maxindex, | ||
char const * | name = "" |
||
) | throw (cSDHErrorInvalidParameter*) |
Check if index is in [0 .. maxindex-1] or All. Throw a cSDHErrorInvalidParameter exception if not.
void cSDHBase::CheckRange | ( | double | value, |
double | minvalue, | ||
double | maxvalue, | ||
char const * | name = "" |
||
) | throw (cSDHErrorInvalidParameter*) |
Check if value is in [minvalue .. maxvalue]. Throw a cSDHErrorInvalidParameter exception if not.
void cSDHBase::CheckRange | ( | double * | values, |
double * | minvalues, | ||
double * | maxvalues, | ||
char const * | name = "" |
||
) | throw (cSDHErrorInvalidParameter*) |
Check if any value[i] in array values is in [minvalue[i] .. maxvalue[i]]. Throw a cSDHErrorInvalidParameter exception if not.
double cSDHBase::GetEps | ( | void | ) |
Return the eps value.
cSimpleVector const & cSDHBase::GetEpsVector | ( | void | ) |
Return simple vector of number of axes epsilon values.
cSDHBase::eErrorCode cSDHBase::GetFirmwareState | ( | void | ) |
Return the last known state of the SDH firmware.
int cSDHBase::GetNumberOfAxes | ( | void | ) |
Return the number of axes of the SDH.
int cSDHBase::GetNumberOfFingers | ( | void | ) |
Return the number of fingers of the SDH.
int cSDHBase::GetNumberOfTemperatureSensors | ( | void | ) |
Return the number of temperature sensors of the SDH.
char const * cSDHBase::GetStringFromControllerType | ( | eControllerType | controller_type | ) | [static] |
Return a ptr to a (static) string describing controller type controller_Type.
char const * cSDHBase::GetStringFromErrorCode | ( | eErrorCode | error_code | ) | [static] |
Return a ptr to a (static) string describing error code error_code.
char const * cSDHBase::GetStringFromGraspId | ( | eGraspId | grasp_id | ) | [static] |
Return a ptr to a (static) string describing grasp id grasp_id.
virtual bool SDH::cSDHBase::IsOpen | ( | void | ) | [pure virtual] |
Return true if connection to SDH firmware/hardware is open.
Implemented in SDH::cSDH, and SDH::cSDHSerial.
virtual void SDH::cSDHBase::SetDebugOutput | ( | std::ostream * | debuglog | ) | [inline, virtual] |
change the stream to use for debug messages
Reimplemented in SDH::cSDH.
int SDH::cSDHBase::all_axes_used [protected] |
Bit field with the bits for all axes set.
cDBG SDH::cSDHBase::cdbg [protected] |
debug stream to print colored debug messages
char const * cSDHBase::controller_type_name [static, protected] |
{ "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.
int SDH::cSDHBase::debug_level [protected] |
debug level of this object
double SDH::cSDHBase::eps [protected] |
epsilon value (max absolute deviation of reported values from actual hardware values) (needed since SDH firmware limits number of digits reported)
cSimpleVector SDH::cSDHBase::eps_v [protected] |
simple vector of 7 epsilon values
char const * cSDHBase::firmware_error_codes [static, protected] |
{ "eEC_SUCCESS: No error", "eEC_NOT_AVAILABLE: Service or data is not available", "eEC_NOT_INITIALIZED: The device is not initialized", "eEC_ALREADY_RUNNING: Data acquisition: the acquisition loop is already running", "eEC_FEATUReEC_NOT_SUPPORTED: The asked feature is not supported", "eEC_INCONSISTENT_DATA: One or more dependent parameters mismatch", "eEC_TIMEOUT: Timeout error", "eEC_READ_ERROR: Error while reading from a device", "eEC_WRITE_ERROR: Error while writing to a device", "eEC_INSUFFICIENT_RESOURCES: No memory available", "eEC_CHECKSUM_ERROR: Checksum error", "eEC_NOT_ENOUGH_PARAMS: Not enough parameters", "eEC_NO_PARAMS_EXPECTED: No parameters expected", "eEC_CMD_UNKNOWN: Unknown command", "eEC_CMD_FORMAT_ERROR: Command format error", "eEC_ACCESS_DENIED: Access denied", "eEC_ALREADY_OPEN: Interface already open", "eEC_CMD_FAILED: Command failed", "eEC_CMD_ABORTED: Command aborted", "eEC_INVALID_HANDLE: Invalid handle", "eEC_DEVICE_NOT_FOUND: Device not found", "eEC_DEVICE_NOT_OPENED: Device not open", "eEC_IO_ERROR: General I/O-Error", "eEC_INVALID_PARAMETER: Invalid parameter", "eEC_RANGE_ERROR: Range error", "eEC_NO_DATAPIPE: No datapipe was found to open the specified device path", "eEC_INDEX_OUT_OF_BOUNDS: The passed index is out of bounds", "eEC_HOMING_ERROR: Error while homing", "eEC_AXIS_DISABLED: The selected axis is disabled", "eEC_OVER_TEMPERATURE: Over-temperature", "eEC_MAX_COMMANDS_EXCEEDED: E_MAX_COMMANDS_EXCEEDED: cannot add more than CI_MAX_COMMANDS to interpreter / POSCON_MAX_OSCILLOSCOPE parameters to oscilloscope", "eEC_INVALID_PASSWORD: E_INVALID_PASSWORD: invalid password given for change user command", "eEC_MAX_COMMANDLINE_EXCEEDEDE_COMMANDLINE_EXCEEDED: the command line given is too long", "eEC_CRC_ERROR: Cyclic Redundancy Code error", "eEC_NO_COMMAND: No command available", "eEC_INTERNAL: internal error", "eEC_UNKNOWN_ERROR: unknown error", "eEC_DIMENSION: Number of error codes" }
A mapping from eErrorCode error code enums to strings with human readable error messages.
eErrorCode SDH::cSDHBase::firmware_state [protected] |
the last known state of the SDH firmware
char const * cSDHBase::grasp_id_name [static, protected] |
{ "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.
cSimpleVector SDH::cSDHBase::max_angle_v [protected] |
Maximum allowed axis angles (in internal units (degrees))
cSimpleVector SDH::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))
int SDH::cSDHBase::NUMBER_OF_AXES [protected] |
The number of axes.
int SDH::cSDHBase::NUMBER_OF_FINGERS [protected] |
The number of fingers.
int SDH::cSDHBase::NUMBER_OF_TEMPERATURE_SENSORS [protected] |
The number of temperature sensors.