#SDH::cSDH is the end user interface class to control a SDH (SCHUNK Dexterous Hand). More...
#include <sdh.h>
Public Member Functions | |
cSDH (bool _use_radians=false, bool _use_fahrenheit=false, int _debug_level=0) | |
Constructor of cSDH class. More... | |
virtual | ~cSDH () |
Communication methods | |
void | OpenRS232 (int _port=0, unsigned long _baudrate=115200, double _timeout=-1, char const *_device_format_string="/dev/ttyS%d") |
void | OpenCAN_ESD (int _net=0, unsigned long _baudrate=1000000, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42) |
void | OpenCAN_ESD (tDeviceHandle _ntcan_handle, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42) |
void | OpenCAN_PEAK (unsigned long _baudrate=1000000, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42, const char *_device="/dev/pcanusb0") |
void | OpenCAN_PEAK (tDeviceHandle _handle, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42) |
void | OpenTCP (char const *_tcp_adr="192.168.1.1", int _tcp_port=23, double _timeout=0.0) |
void | Close (bool leave_enabled=false) |
virtual bool | IsOpen (void) throw () |
Auxiliary movement methods | |
void | EmergencyStop (void) |
void | Stop (void) |
void | SetController (cSDHBase::eControllerType controller) |
eControllerType | GetController (void) |
void | SetVelocityProfile (eVelocityProfile velocity_profile) |
eVelocityProfile | GetVelocityProfile (void) |
Methods to access SDH on axis-level | |
void | SetAxisMotorCurrent (std::vector< int > const &axes, std::vector< double > const &motor_currents, eMotorCurrentMode mode=eMCM_MOVE) |
void | SetAxisMotorCurrent (int iAxis, double motor_current, eMotorCurrentMode mode=eMCM_MOVE) |
std::vector< double > | GetAxisMotorCurrent (std::vector< int > const &axes, eMotorCurrentMode mode=eMCM_MOVE) |
double | GetAxisMotorCurrent (int iAxis, eMotorCurrentMode mode=eMCM_MOVE) |
void | SetAxisEnable (std::vector< int > const &axes, std::vector< double > const &states) |
void | SetAxisEnable (int iAxis=All, double state=1.0) |
void | SetAxisEnable (std::vector< int > const &axes, std::vector< bool > const &states) |
void | SetAxisEnable (int iAxis=All, bool state=true) |
std::vector< double > | GetAxisEnable (std::vector< int > const &axes) |
double | GetAxisEnable (int iAxis) |
std::vector< eAxisState > | GetAxisActualState (std::vector< int > const &axes) |
eAxisState | GetAxisActualState (int iAxis) |
void | WaitAxis (std::vector< int > const &axes, double timeout=-1.0) |
void | WaitAxis (int iAxis, double timeout=-1.0) |
void | SetAxisTargetAngle (std::vector< int > const &axes, std::vector< double > const &angles) |
void | SetAxisTargetAngle (int iAxis, double angle) |
std::vector< double > | SetAxisTargetGetAxisActualAngle (std::vector< int > const &axes, std::vector< double > const &angles) |
std::vector< double > | GetAxisTargetAngle (std::vector< int > const &axes) |
double | GetAxisTargetAngle (int iAxis) |
std::vector< double > | GetAxisActualAngle (std::vector< int > const &axes) |
double | GetAxisActualAngle (int iAxis) |
void | SetAxisTargetVelocity (std::vector< int > const &axes, std::vector< double > const &velocities) |
void | SetAxisTargetVelocity (int iAxis, double velocity) |
std::vector< double > | SetAxisTargetGetAxisActualVelocity (std::vector< int > const &axes, std::vector< double > const &velocities) |
std::vector< double > | GetAxisTargetVelocity (std::vector< int > const &axes) |
double | GetAxisTargetVelocity (int iAxis) |
std::vector< double > | GetAxisLimitVelocity (std::vector< int > const &axes) |
double | GetAxisLimitVelocity (int iAxis) |
std::vector< double > | GetAxisLimitAcceleration (std::vector< int > const &axes) |
double | GetAxisLimitAcceleration (int iAxis) |
std::vector< double > | GetAxisActualVelocity (std::vector< int >const &axes) |
double | GetAxisActualVelocity (int iAxis) |
std::vector< double > | GetAxisReferenceVelocity (std::vector< int >const &axes) |
double | GetAxisReferenceVelocity (int iAxis) |
void | SetAxisTargetAcceleration (std::vector< int >const &axes, std::vector< double >const &accelerations) |
void | SetAxisTargetAcceleration (int iAxis, double acceleration) |
std::vector< double > | GetAxisTargetAcceleration (std::vector< int >const &axes) |
double | GetAxisTargetAcceleration (int iAxis) |
std::vector< double > | GetAxisMinAngle (std::vector< int > const &axes) |
double | GetAxisMinAngle (int iAxis) |
std::vector< double > | GetAxisMaxAngle (std::vector< int > const &axes) |
double | GetAxisMaxAngle (int iAxis) |
std::vector< double > | GetAxisMaxVelocity (std::vector< int > const &axes) |
double | GetAxisMaxVelocity (int iAxis) |
std::vector< double > | GetAxisMaxAcceleration (std::vector< int > const &axes) |
double | GetAxisMaxAcceleration (int iAxis) |
double | MoveAxis (std::vector< int >const &axes, bool sequ=true) |
double | MoveAxis (int iAxis, bool sequ=true) |
Methods to access SDH on finger-level | |
void | SetFingerEnable (std::vector< int > const &fingers, std::vector< double > const &states) |
void | SetFingerEnable (int iFinger, double state=1.0) |
void | SetFingerEnable (std::vector< int > const &fingers, std::vector< bool > const &states) |
void | SetFingerEnable (int iFinger, bool state) |
std::vector< double > | GetFingerEnable (std::vector< int > const &fingers) |
double | GetFingerEnable (int iFinger) |
void | SetFingerTargetAngle (int iFinger, std::vector< double > const &angles) |
void | SetFingerTargetAngle (int iFinger, double a0, double a1, double a2) |
std::vector< double > | GetFingerTargetAngle (int iFinger) |
void | GetFingerTargetAngle (int iFinger, double &a0, double &a1, double &a2) |
std::vector< double > | GetFingerActualAngle (int iFinger) |
void | GetFingerActualAngle (int iFinger, double &a0, double &a1, double &a2) |
std::vector< double > | GetFingerMinAngle (int iFinger) |
void | GetFingerMinAngle (int iFinger, double &a0, double &a1, double &a2) |
std::vector< double > | GetFingerMaxAngle (int iFinger) |
void | GetFingerMaxAngle (int iFinger, double &a0, double &a1, double &a2) |
std::vector< double > | GetFingerXYZ (int iFinger, std::vector< double > const &angles) |
std::vector< double > | GetFingerXYZ (int iFinger, double a0, double a1, double a2) |
double | MoveFinger (std::vector< int >const &fingers, bool sequ=true) |
double | MoveFinger (int iFinger, bool sequ=true) |
double | MoveHand (bool sequ=true) |
Methods to access %SDH grip skills | |
double | GetGripMaxVelocity (void) |
double | GripHand (eGraspId grip, double close, double velocity, bool sequ=true) |
Public Member Functions inherited from cSDHBase | |
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 | ~cSDHBase () |
Public Attributes | |
Predefined index vector objects | |
std::vector< int > | all_axes |
A vector with indices of all axes (in natural order), including the virtual axis. More... | |
std::vector< int > | all_real_axes |
A vector with indices of all real axes (in natural order), excluding the virtual axis. More... | |
std::vector< int > | all_fingers |
A vector with indices of all fingers (in natural order) More... | |
std::vector< int > | all_temperature_sensors |
A vector with indices of all temperature sensors. More... | |
Predefined unit conversion objects | |
Pointers to the unit converter objects used by this cSDH object. The refered objects convert values between different unit systems. Example: convert angle values between degrees and radians, temperatures between degrees celsius and degrees fahrenheit or the like. A cSDH object uses these converter objects to convert between external (user) and internal (SDH) units. The user can easily change the converter object that is used for a certain kind of unit. This way a cSDH object can easily report and accept parameters in the user or application specific unit system. Additionally, users can easily add conversion objects for their own, even more user- or application-specific unit systems. | |
const cUnitConverter * | uc_angle |
unit convert for (axis) angles: default = #SDH::cSDH::uc_angle_degrees More... | |
const cUnitConverter * | uc_angular_velocity |
unit convert for (axis) angular velocities: default = #SDH::cSDH::uc_angular_velocity_degrees_per_second More... | |
const cUnitConverter * | uc_angular_acceleration |
unit convert for (axis) angular accelerations: default = #SDH::cSDH::uc_angular_acceleration_degrees_per_second_squared More... | |
const cUnitConverter * | uc_time |
unit convert for times: default = uc_time_seconds More... | |
const cUnitConverter * | uc_temperature |
unit convert for temperatures: default = #SDH::cSDH::uc_temperature_celsius More... | |
const cUnitConverter * | uc_motor_current |
unit converter for motor curent: default = #SDH::cSDH::uc_motor_current_ampere More... | |
const cUnitConverter * | uc_position |
unit converter for position: default = #SDH::cSDH::uc_position_millimeter More... | |
Static Public Attributes | |
Predefined unit conversion objecs | |
Some predefined cUnitConverter unit conversion objects to convert values between different unit systems. These are static members since the converter objects do not depend on the individiual cSDH object. For every physical unit used in the cSDH class there is at least one (most of the time more than one) predefined unit converter. For example for angles there are radians and degrees. | |
static cUnitConverter const | uc_angle_degrees |
Default converter for angles (internal unit == external unit): degrees. More... | |
static cUnitConverter const | uc_angle_radians |
Converter for angles: external unit = radians. More... | |
static cUnitConverter const | uc_time_seconds |
Default converter for times (internal unit == external unit): seconds. More... | |
static cUnitConverter const | uc_time_milliseconds |
Converter for times: external unit = milliseconds. More... | |
static cUnitConverter const | uc_temperature_celsius |
Default converter for temparatures (internal unit == external unit): degrees celsius. More... | |
static cUnitConverter const | uc_temperature_fahrenheit |
Converter for temperatures: external unit = degrees fahrenheit. More... | |
static cUnitConverter const | uc_angular_velocity_degrees_per_second |
Default converter for angular velocities (internal unit == external unit): degrees / second. More... | |
static cUnitConverter const | uc_angular_velocity_radians_per_second |
Converter for angular velocieties: external unit = radians/second. More... | |
static cUnitConverter const | uc_angular_acceleration_degrees_per_second_squared |
Default converter for angular accelerations (internal unit == external unit): degrees / second. More... | |
static cUnitConverter const | uc_angular_acceleration_radians_per_second_squared |
Converter for angular velocieties: external unit = radians/second. More... | |
static cUnitConverter const | uc_motor_current_ampere |
Default converter for motor current (internal unit == external unit): Ampere. More... | |
static cUnitConverter const | uc_motor_current_milliampere |
Converter for motor current: external unit = milli Ampere. More... | |
static cUnitConverter const | uc_position_millimeter |
Default converter for position (internal unit == external unit): millimeter. More... | |
static cUnitConverter const | uc_position_meter |
Converter for position: external unit = meter. More... | |
Protected Member Functions | |
Internal helper methods | |
std::vector< double > | SetAxisValueVector (std::vector< int > const &axes, std::vector< double > const &values, pSetFunction ll_set, pGetFunction ll_get, cUnitConverter const *uc, std::vector< double > const &min_values, std::vector< double > const &max_values, char const *name) |
std::vector< double > | GetAxisValueVector (std::vector< int > const &axes, pGetFunction ll_get, cUnitConverter const *uc, char const *name) |
std::vector< int > | ToIndexVector (int index, std::vector< int > &all_replacement, int maxindex, char const *name) |
pSetFunction | GetMotorCurrentModeFunction (eMotorCurrentMode mode) |
std::vector< double > | _GetFingerXYZ (int fi, std::vector< double > r_angles) |
Protected Attributes | |
std::vector< double > | f_max_acceleration_v |
Maximum allowed axis acceleration (in internal units (degrees/(second * second))), including the virtual axis. More... | |
std::vector< double > | f_max_angle_v |
Maximum allowed axis angles (in internal units (degrees)), including the virtual axis. More... | |
std::vector< double > | f_max_motor_current_v |
Maximum allowed motor currents (in internal units (Ampere)), including the virtual axis. More... | |
std::vector< double > | f_max_velocity_v |
Maximum allowed axis velocity (in internal units (degrees/second)), including the virtual axis. More... | |
std::vector< double > | f_min_acceleration_v |
Minimum allowed axis acceleration (in internal units (degrees/(second * second))), including the virtual axis. More... | |
std::vector< double > | f_min_angle_v |
Minimum allowed axis angles (in internal units (degrees)), including the virtual axis. More... | |
std::vector< double > | f_min_motor_current_v |
Minimum allowed motor currents (in internal units (Ampere)), including the virtual axis. More... | |
std::vector< double > | f_min_velocity_v |
Minimum allowed axis velocity (in internal units (degrees/second)), including the virtual axis. More... | |
std::vector< double > | f_ones_v |
Vector of 3 1.0 values. More... | |
std::vector< double > | f_zeros_v |
Vector of 3 epsilon values. More... | |
std::vector< std::vector< int > > | finger_axis_index |
Mapping of finger index, finger axis index to axis index: More... | |
std::vector< int > | finger_number_of_axes |
Mapping of finger index to number of real axes of fingers: More... | |
double | grip_max_velocity |
Maximum allowed grip velocity (in internal units (degrees/second)) More... | |
int | nb_all_axes |
The number of all axes including virtual axes. More... | |
int | NUMBER_OF_AXES_PER_FINGER |
The number of axis per finger (for finger 1 this includes the "virtual" base axis) More... | |
int | NUMBER_OF_VIRTUAL_AXES |
The number of virtual axes. More... | |
std::vector< double > | ones_v |
Vector of nb_all_axes 1.0 values. More... | |
std::vector< double > | zeros_v |
Vector of nb_all_axes 0.0 values. More... | |
Protected Attributes inherited from cSDHBase | |
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... | |
Private Member Functions | |
void | AdjustLimits (cSDHBase::eControllerType controller) |
void | UpdateSettingsFromSDH () |
Private Attributes | |
eControllerType | controller_type |
cached value of the axis controller type More... | |
std::string | release_firmware |
string containing the SDH firmware release of the attaced SDH (something like "0.0.2.7") More... | |
Kinematic parameters of the Hand | |
double | l1 |
length of limb 1 (proximal joint to distal joint) in mm More... | |
double | l2 |
length of limb 2 (distal joint to fingertip) in mm More... | |
double | d |
double | h |
std::vector< std::vector< double > > | offset |
cSerialBase * | com |
cSDHSerial | comm_interface |
The object to interface with the SDH attached via serial RS232 or CAN or TCP. More... | |
virtual void | SetDebugOutput (std::ostream *debuglog) |
change the stream to use for debug messages More... | |
Miscellaneous methods | |
bool | IsVirtualAxis (int iAxis) |
Return true if index iAxis refers to a virtual axis. More... | |
void | UseRadians (void) |
void | UseDegrees (void) |
int | GetFingerNumberOfAxes (int iFinger) |
int | GetFingerAxisIndex (int iFinger, int iFingerAxis) |
char const * | GetFirmwareRelease (void) |
bool | CheckFirmwareRelease (void) |
char const * | GetInfo (char const *what) |
std::vector< double > | GetTemperature (std::vector< int > const &sensors) |
double | GetTemperature (int iSensor) |
static char const * | GetLibraryRelease (void) |
static char const * | GetLibraryName (void) |
static char const * | GetFirmwareReleaseRecommended (void) |
Additional Inherited Members | |
Static Public Member Functions inherited from cSDHBase | |
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... | |
Static Protected Attributes inherited from cSDHBase | |
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... | |
#SDH::cSDH is the end user interface class to control a SDH (SCHUNK Dexterous Hand).
A general overview of the structure and architecture used is given here.
int
or double
values. This way the same (overloaded) interface function can address a single axis individually or multiple axes in a call, as required by the application. Such parameters are herein refered to as "vectors".enum cSDH::eAxisState |
The state of an axis (see TPOSCON_STATE in global.h of the SDH firmware)
the motor current can be set specifically for these modes:
Enumerator | |
---|---|
eMCM_MOVE | The motor currents used while "moving" with a MoveHand() or MoveFinger() command. |
eMCM_GRIP | The motor currents used while "gripping" with a GripHand() command. |
eMCM_HOLD | The motor currents used after "gripping" with a GripHand() command (i.e. "holding") |
eMCM_DIMENSION | Endmarker and Dimension. |
cSDH::cSDH | ( | bool | _use_radians = false , |
bool | _use_fahrenheit = false , |
||
int | _debug_level = 0 |
||
) |
Constructor of cSDH class.
Creates an new object of type cSDH. One such object is needed for each SDH that you want to control. The constructor initializes internal data structures. A connection the SDH is not yet established, see OpenRS232() on how to do that.
After an object is created the user can adjust the unit systems used to set/report parameters to/from SDH. This is shown in the example code below. The default units used (if not overwritten by constructor parameters) are:
degrees
[deg] for (axis) anglesdegrees
per
second
[deg/s] for (axis) angular velocitiesseconds
[s] for timesdegrees
celsius
[deg C] for temperatures_use_radians | : Flag, if true then use radians and radians/second to set/report (axis) angles and angular velocities instead of default degrees and degrees/s. |
_use_fahrenheit | : Flag, if true then use degrees fahrenheit to report temperatures instead of default degrees celsius. |
_debug_level | : The level of debug messages to print
|
Common use:
The mentioned change of a unit system can be done like this:
For convenience the most common settings can be specified as bool parameters for the constructor, like in:
unit convert for times: default = uc_time_seconds
unit convert for temperatures: default = uc_temperature_celsius
unit converter for motor curent: default = uc_motor_current_ampere
unit converter for position: default = uc_position_millimeter
The number of axis per finger (for finger 1 this includes the "virtual" base axis)
The number of virtual axes
Mapping of finger index to number of real axes of fingers:
Mapping of finger index, finger axis index to axis index:
Maximum allowed grip velocity (in internal units (degrees/second))
|
virtual |
|
protected |
|
private |
Adjust the limits for the velocity and acceleration according to the controller type.
bool cSDH::CheckFirmwareRelease | ( | void | ) |
Check the actual release of the firmware of the connected SDH against the recommended firmware release.
This will throw a (cSDHErrorCommunication*) exception if the connection to the SDH is not yet opened.
void cSDH::Close | ( | bool | leave_enabled = false | ) |
Close connection to SDH.
The default behaviour is to not leave the controllers of the SDH enabled (to prevent overheating). To keep the controllers enabled (e.g. to keep the finger axes actively in position) set leave_enabled to true
. Only already enabled axes will be left enabled.
leave_enabled | - Flag: true to leave the controllers on, false (default) to disable the controllers (switch powerless) |
This throws a (cSDHErrorCommunication*) exception if the connection was not opened before.
void cSDH::EmergencyStop | ( | void | ) |
Stop movement of all axes of the SDH and switch off the controllers
This command will always be executed sequentially: it will return only after the SDH has confirmed the emergency stop.
std::vector< double > cSDH::GetAxisActualAngle | ( | std::vector< int > const & | axes | ) |
Get the current actual angle(s) of axis(axes).
The actual angles are read from the SDH.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisActualAngle(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisActualAngle | ( | int | iAxis | ) |
Like GetAxisActualAngle(std::vector<int>const&), just for a single axis iAxis and returning a single angle, see there for details and examples.
std::vector< cSDH::eAxisState > cSDH::GetAxisActualState | ( | std::vector< int > const & | axes | ) |
Get the current actual state(s) of axis(axes).
The actual axis states are read from the SDH.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisActualState(int) for an overloaded variant to access a single axis.
cSDH::eAxisState cSDH::GetAxisActualState | ( | int | iAxis | ) |
Like GetAxisActualState(std::vector<int>const&), just for a single axis iAxis, see there for details and examples.
std::vector< double > cSDH::GetAxisActualVelocity | ( | std::vector< int >const & | axes | ) |
Get the actual velocity(s) of axis(axes).
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisActualVelocity(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisActualVelocity | ( | int | iAxis | ) |
Like GetAxisActualVelocity(std::vector<int>const&), just for a single axis iAxis and returning a single velocity, see there for details and examples.
std::vector< double > cSDH::GetAxisEnable | ( | std::vector< int > const & | axes | ) |
Get enabled/disabled state of axis controller(s).
The enabled/disabled state of the controllers of the selected axes is read from the SDH.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisEnable(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisEnable | ( | int | iAxis | ) |
Like GetAxisEnable(std::vector<int>const&), just for a single axis iAxis, see there for details and examples.
std::vector< double > cSDH::GetAxisLimitAcceleration | ( | std::vector< int > const & | axes | ) |
Get the acceleration limit(s) of axis(axes).
The acceleration limit(s) are read from the SDH.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisLimitAcceleration(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisLimitAcceleration | ( | int | iAxis | ) |
Like GetAxisLimitAcceleration(std::vector<int>const&), just for a single axis iAxis and returning a single acceleration limit, see there for details and examples.
std::vector< double > cSDH::GetAxisLimitVelocity | ( | std::vector< int > const & | axes | ) |
Get the velocity limit(s) of axis(axes).
The velocity limit(s) are read from the SDH.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisLimitVelocity(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisLimitVelocity | ( | int | iAxis | ) |
Like GetAxisLimitVelocity(std::vector<int>const&), just for a single axis iAxis and returning a single velocity limit, see there for details and examples.
std::vector< double > cSDH::GetAxisMaxAcceleration | ( | std::vector< int > const & | axes | ) |
Get the maximum acceleration(s) of axis(axes).
The maximum accelerations are currently not read from the SDH, but are stored in the library.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisMaxAcceleration(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisMaxAcceleration | ( | int | iAxis | ) |
Like GetAxisMaxAcceleration(std::vector<int>const&), just for a single axis iAxis and returning a single minimum angle, see there for details and examples.
std::vector< double > cSDH::GetAxisMaxAngle | ( | std::vector< int > const & | axes | ) |
Get the maximum angle(s) of axis(axes).
The maximum angles are currently not read from the SDH, but are stored in the library.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisMaxAngle(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisMaxAngle | ( | int | iAxis | ) |
Like GetAxisMaxAngle(std::vector<int>const&), just for a single axis iAxis and returning a single maximum angle, see there for details and examples.
std::vector< double > cSDH::GetAxisMaxVelocity | ( | std::vector< int > const & | axes | ) |
Get the maximum velocity(s) of axis(axes). These are the (theoretical) maximum velocities as determined by the maximum motor velocity and gear box ratio. The values do not take things like friction or inertia into account. So it is likely that these maximum velocities cannot be reached by the real hardware in reality.
The maximum velocities are currently read once from the SDH when the communication to the SDH is opened. Later queries of this maximum velocities will use the values stored in the library.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisMaxVelocity(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisMaxVelocity | ( | int | iAxis | ) |
Like GetAxisMaxVelocity(std::vector<int>const&), just for a single axis iAxis and returning a single minimum angle, see there for details and examples.
std::vector< double > cSDH::GetAxisMinAngle | ( | std::vector< int > const & | axes | ) |
Get the minimum angle(s) of axis(axes).
The minimum angles are currently not read from the SDH, but are stored in the library.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisMinAngle(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisMinAngle | ( | int | iAxis | ) |
Like GetAxisMinAngle(std::vector<int>const&), just for a single axis iAxis and returning a single minimum angle, see there for details and examples.
std::vector< double > cSDH::GetAxisMotorCurrent | ( | std::vector< int > const & | axes, |
eMotorCurrentMode | mode = eMCM_MOVE |
||
) |
Get the maximum allowed motor current(s) of axis(axes).
The maximum allowed motor currents are read from the SDH. The motor currents are stored:
axes | - A vector of axis indices to access. |
mode | - the mode to set the maximum motor current for. One of the eMotorCurrentMode modes. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisMotorCurrent(int,eMotorCurrentMode) for an overloaded variant to access a single axis.
double cSDH::GetAxisMotorCurrent | ( | int | iAxis, |
eMotorCurrentMode | mode = eMCM_MOVE |
||
) |
Like GetAxisMotorCurrent(std::vector<int>const&,eMotorCurrentMode), just for a single axis, see there for details and examples.
std::vector< double > cSDH::GetAxisReferenceVelocity | ( | std::vector< int >const & | axes | ) |
Get the current reference velocity(s) of axis(axes). (This velocity is used internally by the SDH in eCT_VELOCITY_ACCELERATION mode).
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisReferenceVelocity(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisReferenceVelocity | ( | int | iAxis | ) |
Like GetAxisReferenceVelocity(std::vector<int>const&), just for a single axis iAxis and returning a single velocity, see there for details and examples.
std::vector< double > cSDH::GetAxisTargetAcceleration | ( | std::vector< int >const & | axes | ) |
Get the target acceleration(s) of axis(axes).
The currently set target accelerations are read from the SDH.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisTargetAcceleration(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisTargetAcceleration | ( | int | iAxis | ) |
Like GetAxisTargetAcceleration(std::vector<int>const&), just for a single axis iAxis and returning a single acceleration, see there for details and examples.
std::vector< double > cSDH::GetAxisTargetAngle | ( | std::vector< int > const & | axes | ) |
Get the target angle(s) of axis(axes).
The currently set target angles are read from the SDH.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisTargetAngle(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisTargetAngle | ( | int | iAxis | ) |
Like GetAxisTargetAngle(std::vector<int>const&), just for a single axis iAxis and returning a single angle, see there for details and examples.
std::vector< double > cSDH::GetAxisTargetVelocity | ( | std::vector< int > const & | axes | ) |
Get the target velocity(s) of axis(axes).
The currently set target velocities are read from the SDH.
axes | - A vector of axis indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisTargetVelocity(int) for an overloaded variant to access a single axis.
double cSDH::GetAxisTargetVelocity | ( | int | iAxis | ) |
Like GetAxisTargetVelocity(std::vector<int>const&), just for a single axis iAxis and returning a single velocity, see there for details and examples.
|
protected |
Generic get function: get some given axes values
axes | - a vector of axis indices |
ll_get | - a pointer to the low level get function to use |
uc | - a pointer to the unit converter object to apply before returning values |
name | - a string with the name of the values (for constructing error message) |
rv
[i] will be the value of axis axes
[i] (not axis i
). cSDHBase::eControllerType cSDH::GetController | ( | void | ) |
Get the type of axis controller used in the SDH
The currently set controller type will be queried and returned (One of eControllerType)
std::vector< double > cSDH::GetFingerActualAngle | ( | int | iFinger | ) |
Get the current actual axis angles of a single finger.
The current actual axis angles of finger iFinger are read from the SDH.
iFinger | - index of finger to access. This must be a single index. |
See also GetFingerActualAngle(int,double&,double&,double&) for an overloaded variant to get finger axis actual angles into single double
values.
void cSDH::GetFingerActualAngle | ( | int | iFinger, |
double & | a0, | ||
double & | a1, | ||
double & | a2 | ||
) |
Like GetFingerActualAngle(int), just returning the actual axis angles in the a0, a1 and a2 parameters which are given by reference.
int cSDH::GetFingerAxisIndex | ( | int | iFinger, |
int | iFingerAxis | ||
) |
Return axis index of iFingerAxis axis of finger with index iFinger
For iFinger=2, iFingerAxis=0 this will return the index of the virtual base axis of the finger
iFinger | - index of finger in range [0..NUMBER_OF_FINGERS-1] |
iFingerAxis | - index of finger axis in range [0..NUMBER_OF_AXES_PER_FINGER-1] |
std::vector< double > cSDH::GetFingerEnable | ( | std::vector< int > const & | fingers | ) |
Get enabled/disabled state of axis controllers of finger(s).
The enabled/disabled state of the controllers of the selected fingers is read from the SDH. A finger is reported disabled if any of its axes is disabled and reported enabled if all its axes are enabled.
fingers | - A vector of finger indices to access. |
rv
[i] will be the value of axis axes
[i] (not axis i
).See also GetAxisEnable(int) for an overloaded variant to access a single axis.
double cSDH::GetFingerEnable | ( | int | iFinger | ) |
Like GetFingerEnable(std::vector<int>const&), just for a single finger iFinger and returning a single double value
std::vector< double > cSDH::GetFingerMaxAngle | ( | int | iFinger | ) |
Get the maximum axis angles of a single finger.
The maximum axis angles of finger iFingers axes, stored in the library, are returned.
iFinger | - index of finger to access. This must be a single index |
See also GetFingerMaxAngle(int,double&,double&,double&) for an overloaded variant to get finger axis max angles into single double
values.
void cSDH::GetFingerMaxAngle | ( | int | iFinger, |
double & | a0, | ||
double & | a1, | ||
double & | a2 | ||
) |
Like GetFingerMaxAngle(int), just returning the finger axis max angles in the a0, a1 and a2 parameters which are given by reference.
std::vector< double > cSDH::GetFingerMinAngle | ( | int | iFinger | ) |
Get the minimum axis angles of a single finger.
The minimum axis angles of finger iFingers axes, stored in the library, are returned.
iFinger | - index of finger to access. This must be a single index |
See also GetFingerMinAngle(int,double&,double&,double&) for an overloaded variant to get finger axis min angles into single double
values.
void cSDH::GetFingerMinAngle | ( | int | iFinger, |
double & | a0, | ||
double & | a1, | ||
double & | a2 | ||
) |
Like GetFingerMinAngle(int), just returning the finger axis min angles in the a0, a1 and a2 parameters which are given by reference.
int cSDH::GetFingerNumberOfAxes | ( | int | iFinger | ) |
Return the number of real axes of finger with index iFinger.
iFinger | - index of finger in range [0..NUMBER_OF_FINGERS-1] |
std::vector< double > cSDH::GetFingerTargetAngle | ( | int | iFinger | ) |
Get the target axis angles of a single finger.
The target axis angles of finger iFinger are read from the SDH.
iFinger | - index of finger to access. This must be a single index |
See also GetFingerTargetAngle(int,double&,double&,double&) for an overloaded variant to get finger axis target angles into single double
values.
void cSDH::GetFingerTargetAngle | ( | int | iFinger, |
double & | a0, | ||
double & | a1, | ||
double & | a2 | ||
) |
Like GetFingerTargetAngle(int), just returning the target axis angles in the a0, a1 and a2 parameters which are given by reference.
std::vector< double > cSDH::GetFingerXYZ | ( | int | iFinger, |
std::vector< double > const & | angles | ||
) |
Get the cartesian xyz finger tip position of a single finger from the given axis angles (forward kinematics).
iFinger | - index of finger to access. This must be a single index |
angles | - a vector of NUMBER_OF_AXES_PER_FINGER angles. The values are expected in the configured angle unit system uc_angle. |
angles
[i], converted to internal units, is in
[0 .. f_max_angle_v
[finger_axis_index[iFinger][i]]].See also GetFingerXYZ(int,double,double,double) for an overloaded variant to get finger tip position from single double
values.
std::vector< double > cSDH::GetFingerXYZ | ( | int | iFinger, |
double | a0, | ||
double | a1, | ||
double | a2 | ||
) |
Like SetFingerTargetAngle(int,std::vector<double>const&), just with individual finger axis angles a0, a1 and a2.
char const * cSDH::GetFirmwareRelease | ( | void | ) |
Return the actual release name of the firmware of the SDH (not the library) as string.
This will throw a (cSDHErrorCommunication*) exception if the connection to the SDH is not yet opened.
|
static |
Return the recommended release of the firmware of the SDH by this library as string.
double cSDH::GetGripMaxVelocity | ( | void | ) |
Get the maximum velocity of grip skills
The maximum velocity is currently not read from the SDH, but is stored in the library.
char const * cSDH::GetInfo | ( | char const * | what | ) |
Return info according to what #
# #
|
static |
Return the name of the library as string.
|
static |
|
protected |
std::vector< double > cSDH::GetTemperature | ( | std::vector< int > const & | sensors | ) |
Return temperature(s) measured within the SDH.
sensors | - A vector of indices of temperature sensors to access.
|
To access a single temperature sensor use GetTemperature(int), see there.
double cSDH::GetTemperature | ( | int | iSensor | ) |
Like GetTemperature(std::vector<int>const&), just for one sensor iSensor and returning a single temperature as double.
cSDHBase::eVelocityProfile cSDH::GetVelocityProfile | ( | void | ) |
Get the type of velocity profile used in the SDH
double cSDH::GripHand | ( | eGraspId | grip, |
double | close, | ||
double | velocity, | ||
bool | sequ = true |
||
) |
Perform one of the internal eGraspId "grips" or "grasps"
grip | - The index of the grip to perform 0..eGID_DIMENSION-1 |
close | - close-ratio: [0.0 .. 1.0] where 0.0 is 'fully opened' and 1.0 is 'fully closed' |
velocity | - maximum allowed angular axis velocity in the chosen external unit system uc_angular_velocity |
sequ | - flag: if true (default) then the function executes sequentially and returns not until after the SDH has finished the movement. If false then the function returns immediately after the movement command has been sent to the SDH. |
|
virtual |
bool cSDH::IsVirtualAxis | ( | int | iAxis | ) |
double cSDH::MoveAxis | ( | std::vector< int >const & | axes, |
bool | sequ = true |
||
) |
Move selected axis/axes to the previously set target pose with the previously set velocity profile, (maximum) target velocities and target accelerations
axes | - A vector of axis indices to access. |
sequ | - flag: if true (default) then the function executes sequentially and returns not until after the SDH has finished the movement. If false then the function returns immediately after the movement command has been sent to the SDH (the currently set target axis angles for other axes will then be overwritten with their current actual axis angles). |
See also MoveAxis(int,bool) for an overloaded variant to move a single axis.
double cSDH::MoveAxis | ( | int | iAxis, |
bool | sequ = true |
||
) |
Like MoveAxis(std::vector<int>const&,bool), just for a single axis iAxis (or all axes if All is given).
double cSDH::MoveFinger | ( | std::vector< int >const & | fingers, |
bool | sequ = true |
||
) |
Move selected finger(s) to the previously set target pose with the previously set velocity profile, (maximum) target velocities and target accelerations.
fingers | - A vector of finger indices to access. |
sequ | - flag: if true (default) then the function executes sequentially and returns not until after the SDH has finished the movement. If false then the function returns immediately after the movement command has been sent to the SDH (the currently set target axis angles for other fingers will then be overwritten with their current actual axis angles). |
See also MoveFinger(int,bool) for an overloaded variant to move a single finger.
double cSDH::MoveFinger | ( | int | iFinger, |
bool | sequ = true |
||
) |
Like MoveFinger(std::vector<int>const&,bool), just for a single finger iFinger (or all fingers if All is given).
double cSDH::MoveHand | ( | bool | sequ = true | ) |
Move all fingers to the previously set target pose with the previously set (maximum) velocities.
This is just a shortcut to MoveFinger(int,bool) with iFinger set to hand.All
and sequ as indicated, so see there for details and examples.
void cSDH::OpenCAN_ESD | ( | int | _net = 0 , |
unsigned long | _baudrate = 1000000 , |
||
double | _timeout = 0.0 , |
||
Int32 | _id_read = 43 , |
||
Int32 | _id_write = 42 |
||
) |
Open connection to SDH via CAN using an ESD CAN card. If the library was compiled without ESD CAN support then this will just throw an exception. See setting for WITH_ESD_CAN in the top level makefile.
_net | : The ESD CAN net number of the CAN port to use. (default: 0) |
_baudrate | : the CAN baudrate in bit/s. Only some bitrates are valid: (1000000 (default),800000,500000,250000,125000,100000,50000,20000,10000) |
_timeout | : The timeout to use:
|
_id_read | - the CAN ID to use for reading (The SDH sends data on this ID, default=43=0x02b) |
_id_write | - the CAN ID to use for writing (The SDH receives data on this ID, default=42=0x02a) |
void cSDH::OpenCAN_ESD | ( | tDeviceHandle | _ntcan_handle, |
double | _timeout = 0.0 , |
||
Int32 | _id_read = 43 , |
||
Int32 | _id_write = 42 |
||
) |
Open connection to SDH via CAN using an ESD CAN card using an existing handle. If the library was compiled without ESD CAN support then this will just throw an exception. See setting for WITH_ESD_CAN in the top level makefile.
_ntcan_handle | : the ESD CAN handle to reuse (please cast your NTCAN_HANDLE to tDeviceHandle! It is save to do that!) |
_timeout | : The timeout to use:
|
_id_read | - the CAN ID to use for reading (The SDH sends data on this ID, default=43=0x2a) |
_id_write | - the CAN ID to use for writing (The SDH receives data on this ID, default=42=0x2a) |
void cSDH::OpenCAN_PEAK | ( | unsigned long | _baudrate = 1000000 , |
double | _timeout = 0.0 , |
||
Int32 | _id_read = 43 , |
||
Int32 | _id_write = 42 , |
||
const char * | _device = "/dev/pcanusb0" |
||
) |
Open connection to SDH via CAN using an PEAK CAN card. If the library was compiled without PEAK CAN support then this will just throw an exception. See setting for WITH_PEAK_CAN in the top level makefile.
_baudrate | : the CAN baudrate in bit/s. Only some bitrates are valid: (1000000 (default),800000,500000,250000,125000,100000,50000,20000,10000) |
_timeout | : The timeout to use:
|
_id_read | - the CAN ID to use for reading (The SDH sends data on this ID, default=43=0x02b) |
_id_write | - the CAN ID to use for writing (The SDH receives data on this ID, default=42=0x02a) |
_device | - the PEAK device name. Used for the Linux char dev driver only. default="/dev/pcanusb0" |
void cSDH::OpenCAN_PEAK | ( | tDeviceHandle | _handle, |
double | _timeout = 0.0 , |
||
Int32 | _id_read = 43 , |
||
Int32 | _id_write = 42 |
||
) |
Open connection to SDH via CAN using an PEAK CAN card using an existing handle. If the library was compiled without PEAK CAN support then this will just throw an exception. See setting for WITH_PEAK_CAN in the top level makefile.
_handle | : The PEAK CAN handle to reuse to connect to the PEAK CAN driver (please cast your PEAK_HANDLE to tDeviceHandle! It is save to do that!) |
_timeout | : The timeout to use:
|
_id_read | - the CAN ID to use for reading (The SDH sends data on this ID, default=43=0x2a) |
_id_write | - the CAN ID to use for writing (The SDH receives data on this ID, default=42=0x2a) |
void cSDH::OpenRS232 | ( | int | _port = 0 , |
unsigned long | _baudrate = 115200 , |
||
double | _timeout = -1 , |
||
char const * | _device_format_string = "/dev/ttyS%d" |
||
) |
Open connection to SDH via RS232.
_port | : The number of the serial port to use. The default value port=0 refers to 'COM1' in Windows and to the corresponding '/dev/ttyS0' in Linux. |
_baudrate | the baudrate in bit/s, the default is 115200 which happens to be the default for the SDH too |
_timeout | : The timeout to use:
|
_device_format_string | : a format string (C string) for generating the device name, like "/dev/ttyS%d" (default) or "/dev/ttyUSB%d". Must contain a d where the port number should be inserted. This char array is duplicated on construction When compiled with VCC (MS-Visual C++) then this is not used. |
void cSDH::OpenTCP | ( | char const * | _tcp_adr = "192.168.1.1" , |
int | _tcp_port = 23 , |
||
double | _timeout = 0.0 |
||
) |
Open connection to SDH via TCP using TCP/IP address _tcp_adr and _tcp_port.
_tcp_adr | : The tcp host address of the SDH. Either a numeric IP as string or a hostname |
_tcp_port | : the tcp port number on the SDH to connect to |
_timeout | : The timeout to use:
|
void cSDH::SetAxisEnable | ( | std::vector< int > const & | axes, |
std::vector< double > const & | states | ||
) |
Set enabled/disabled state of axis controller(s).
The controllers of the selected axes are enabled/disabled in the SDH. Disabled axes are not powered and thus might not remain in their current pose due to gravity, inertia or other external influences. But to prevent overheating the axis controllers should be switched of when not needed.
axes | - A vector of axis indices to access. |
states | - A vector of enabled states (0 = disabled, !=0 = enabled) to set. If any of the numbers in the vector is NaN (Not a Number) then the currently set enabled state will be kept for the corresponding axis. |
state
[i] will be applied to axis axes
[i] (not axis i
).See also SetAxisEnable(int,double), SetAxisEnable(int,bool) for overloaded variants to set a single axis enabled/disabled or to set the same state for all axes. See further SetAxisEnable(std::vector<int>const&,std::vector<bool>const&) for a variant that accepts a bool
vector for the states to set.
void cSDH::SetAxisEnable | ( | int | iAxis = All , |
double | state = 1.0 |
||
) |
Like SetAxisEnable(std::vector<int>const&,std::vector<double>const&), just for a single axis iAxis and a single axis state state, see there.
If iAxis is All then state is applied to all axes.
void cSDH::SetAxisEnable | ( | std::vector< int > const & | axes, |
std::vector< bool > const & | states | ||
) |
Like SetAxisEnable(std::vector<int>const&,std::vector<double>const&), just accepting a vector of bool
values as states, see there.
void cSDH::SetAxisEnable | ( | int | iAxis = All , |
bool | state = true |
||
) |
Like SetAxisEnable(std::vector<int>const&,std::vector<double>const&), just for a single axis iAxis and a single axis state state, see there.
If iAxis is All then state is applied to all axes.
void cSDH::SetAxisMotorCurrent | ( | std::vector< int > const & | axes, |
std::vector< double > const & | motor_currents, | ||
eMotorCurrentMode | mode = eMCM_MOVE |
||
) |
Set the maximum allowed motor current(s) for axes.
The maximum allowed motor currents are sent to the SDH. The motor currents can be stored:
axes | - A vector of axis indices to access. |
motor_currents | - A vector of motor currents to set. If any of the numbers in the vector is NaN (Not a Number) then the currently set axis motor current will be kept for the corresponding axis. The value(s) are expected in the configured motor current unit system uc_motor_current. |
mode | - the mode to set the maximum motor current for. One of the eMotorCurrentMode modes. |
motor_currents
[i] will be applied to axis axes
[i] (not axis i
).motor_currents
[i], converted to internal units, is in
[0 .. f_max_motor_currents_v
[axes[i]]].See also SetAxisMotorCurrent(int,double,eMotorCurrentMode) for an overloaded variant to set a single axis motor current or to set the same motor current for all axes.
void cSDH::SetAxisMotorCurrent | ( | int | iAxis, |
double | motor_current, | ||
eMotorCurrentMode | mode = eMCM_MOVE |
||
) |
Like SetAxisMotorCurrent(std::vector<int>const&,std::vector<double>const&,eMotorCurrentMode), just for a single axis iAxis and a single motor current motor_current, see there.
If iAxis is All then motor_current is set for all axes.
void cSDH::SetAxisTargetAcceleration | ( | std::vector< int >const & | axes, |
std::vector< double >const & | accelerations | ||
) |
Set the target acceleration(s) for axis(axes).
The target accelerations are stored in the SDH and are used only for:
Setting the target acceleration will not affect an ongoing movement, nor will it start a new movement. To take effect an additional command must be sent:
axes | - A vector of axis indices to access. |
accelerations | - A vector of axis target accelerations to set. If any of the numbers in the vector is NaN (Not a Number) then the currently set axis target angle will be kept for the corresponding axis. The value(s) are expected in the configured angular acceleration unit system uc_angular_acceleration. |
accelerations
[i] will be applied to axis axes
[i] (not axis i
).accelerations
[i], converted to internal units, is in
[0 .. f_max_velocity_v
[axes[i]]].See also SetAxisTargetAcceleration(int,double) for an overloaded variant to set a single axis target acceleration or to set the same target acceleration for all axes.
void cSDH::SetAxisTargetAcceleration | ( | int | iAxis, |
double | acceleration | ||
) |
Like SetAxisTargetAcceleration(std::vector<int>const&,std::vector<double>const&), just for a single axis iAxis and a single acceleration acceleration, see there for details and examples.
void cSDH::SetAxisTargetAngle | ( | std::vector< int > const & | axes, |
std::vector< double > const & | angles | ||
) |
Set the target angle(s) for axis(axes).
The target angles are stored in the SDH, the movement is not executed until an additional move command is sent.
axes | - A vector of axis indices to access. |
angles | - A vector of axis target angles to set. If any of the numbers in the vector is NaN (Not a Number) then the currently set axis target angle will be kept for the corresponding axis. The value(s) are expected in the configured angle unit system uc_angle. |
angles
[i] will be applied to axis axes
[i] (not axis i
).angles
[i], converted to internal units, is in
[f_min_angle_v[axes[i]] .. f_max_angle_v
[axes[i]]].See also SetAxisTargetAngle(int,double) for an overloaded variant to set a single axis target angle or to set the same target angle for all axes.
void cSDH::SetAxisTargetAngle | ( | int | iAxis, |
double | angle | ||
) |
Like SetAxisTargetAngle(std::vector<int>const&,std::vector<double>const&), just for a single axis iAxis and a single angle angle, see there for details and examples.
If iAxis is All then motor_current is set for all axes.
std::vector< double > cSDH::SetAxisTargetGetAxisActualAngle | ( | std::vector< int > const & | axes, |
std::vector< double > const & | angles | ||
) |
Set the target angle(s) and get the actual angle(s) for axis(axes).
Opposed to SetAxisTargetAngle() this will make the fingers move to the set target angles immediately, if the axis controllers are already enabled!
axes | - A vector of axis indices to access. |
angles | - A vector of axis target angles to set. If any of the numbers in the vector is NaN (Not a Number) then the currently set axis target angle will be kept for the corresponding axis. The value(s) are expected in the configured angle unit system uc_angle. |
angles
[i] will be applied to axis axes
[i] (not axis i
).angles
[i], converted to internal units, is in
[f_min_angle_v[axis[i]] .. f_max_angle_v
[axes[i]]].std::vector< double > cSDH::SetAxisTargetGetAxisActualVelocity | ( | std::vector< int > const & | axes, |
std::vector< double > const & | velocities | ||
) |
Set the target velocity(s) and get the actual velocitiy(s) for axis(axes).
The target velocities are stored in the SDH. The time at which a new target velocities will take effect depends on the current axis controller type:
axes | - A vector of axis indices to access. |
velocities | - A vector of axis target velocities to set. If any of the numbers in the vector is NaN (Not a Number) then the currently set axis target velocity will be kept for the corresponding axis. The value(s) are expected in the configured angular velocity unit system uc_angular_velocity. |
velocities
[i] will be applied to axis axes
[i] (not axis i
).velocities
[i], converted to internal units, is in
[0 .. f_max_velocity_v
[axes[i]]].velocities
[i], converted to internal units, is in
[-f_max_velocity_v[axes[i]] .. f_max_velocity_v
[axes[i]]].void cSDH::SetAxisTargetVelocity | ( | std::vector< int > const & | axes, |
std::vector< double > const & | velocities | ||
) |
Set the target velocity(s) for axis(axes).
The target velocities are stored in the SDH. The time at which a new target velocities will take effect depends on the current axis controller type:
axes | - A vector of axis indices to access. |
velocities | - A vector of axis target angles to set. If any of the numbers in the vector is NaN (Not a Number) then the currently set axis target velocity will be kept for the corresponding axis. The value(s) are expected in the configured angular velocity unit system uc_angular_velocity. |
velocities
[i] will be applied to axis axes
[i] (not axis i
).velocities
[i], converted to internal units, is in
[0 .. f_max_velocity_v
[axes[i]]].velocities
[i], converted to internal units, is in
[-f_max_velocity_v[axes[i]] .. f_max_velocity_v
[axes[i]]].See also SetAxisTargetVelocity(int,double) for an overloaded variant to set a single axis target velocity or to set the same target velocity for all axes.
void cSDH::SetAxisTargetVelocity | ( | int | iAxis, |
double | velocity | ||
) |
Like SetAxisTargetVelocity(std::vector<int>const&,std::vector<double>const&), just for a single axis iAxis and a single velocity velocity, see there for details and examples.
|
protected |
Generic set function: set some given axes to given values
axes | - a vector of axis indices |
values | - a vector of values |
ll_set | - a pointer to the low level set function to use |
ll_get | - a pointer to the low level get function to use (for those axes where the given value is NaN) |
uc | - a pointer to the unit converter object to use before sending values to ll_set |
min_values | - a vector with the minimum allowed values in internal units |
max_values | - a vector with the maximum allowed values in internal units |
name | - a string with the name of the values (for constructing error message) |
values
[i] will be applied to axis axes
[i] (not axis i
)value
[i], converted to the internal unit system by uc->ToInternal(), is in [min_values[axes[i]] .. max_values[axes[i]]].void cSDH::SetController | ( | cSDHBase::eControllerType | controller | ) |
Set the type of axis controller to be used in the SDH
With SDH firmware >= 0.0.2.7 this will automatically set valid default values for all target velocities, accelerations and positions in the SDH firmware, according to the controller type:
This will also adjust the lower limits of the allowed velocities here in the SDHLibrary, since the eCT_POSE controller allows only positive velocities while the eCT_VELOCITY and eCT_VELOCITY_ACCELERATION controllers require also negative velocities.
controller | - identifier of controller to set. Valid values are defined in eControllerType |
|
inlinevirtual |
void cSDH::SetFingerEnable | ( | std::vector< int > const & | fingers, |
std::vector< double > const & | states | ||
) |
Set enabled/disabled state of axis controllers of finger(s).
The controllers of the axes of the selected fingers are enabled/disabled in the SDH. Disabled axes are not powered and thus might not remain in their current pose due to gravity, inertia or other external influences. But to prevent overheating the axis controllers should be switched of when not needed.
fingers | - A vector of finger indices to access. |
states | - A vector of enabled states (0 = disabled, !=0 = enabled) to set. If any of the numbers in the vector is NaN (Not a Number) then the currently set enabled state will be kept for the corresponding axis. |
state
[i] will be applied to finger fingers
[i] (not finger i
).See also SetFingerEnable(int,double), SetFingerEnable(int,bool) for overloaded variants to set a single finger enabled/disabled or to set the same state for all fingers. See further SetFingerEnable(std::vector<int>const&,std::vector<bool>const&) for a variant that accepts a bool
vector for the states to set.
void cSDH::SetFingerEnable | ( | int | iFinger, |
double | state = 1.0 |
||
) |
Like SetFingerEnable(std::vector<int>const&,std::vector<double>const&), just for a single finger iAxis and a single angle angle, see there for details and examples.
void cSDH::SetFingerEnable | ( | std::vector< int > const & | fingers, |
std::vector< bool > const & | states | ||
) |
Like SetFingerEnable(std::vector<int>const&,std::vector<double>const&), just with states as vector of bool
values, see there for details and examples.
void cSDH::SetFingerEnable | ( | int | iFinger, |
bool | state | ||
) |
Like SetFingerEnable(std::vector<int>const&,std::vector<double>const&), just for a single finger iAxis and a single angle angle, see there for details and examples.
void cSDH::SetFingerTargetAngle | ( | int | iFinger, |
std::vector< double > const & | angles | ||
) |
Set the target angle(s) for a single finger.
The target axis angles angle of finger iFinger are stored in the SDH. The movement is not executed until an additional move command is sent.
iFinger | - index of finger to access. This must be a single index. |
angles | - the angle(s) to set or None to set the current actual axis angles of the finger as target angle. This can be a single number or a vector of numbers. The value(s) are expected in the configured angle unit system uc_angle. |
angles
[i], converted to internal units, is in
[0 .. f_max_angle_v
[finger_axis_index[iFinger][i]]].See also SetFingerTargetAngle(int,double,double,double) for an overloaded variant to set finger axis target angles from single double
values.
void cSDH::SetFingerTargetAngle | ( | int | iFinger, |
double | a0, | ||
double | a1, | ||
double | a2 | ||
) |
Like SetFingerTargetAngle(int,std::vector<double>const&), just with individual finger axis angles a0, a1 and a2.
void cSDH::SetVelocityProfile | ( | eVelocityProfile | velocity_profile | ) |
Set the type of velocity profile to be used in the SDH
velocity_profile | - Name or number of velocity profile to set. Valid values are defined in eVelocityProfileType |
void cSDH::Stop | ( | void | ) |
Stop movement of all axes but keep controllers on
This command will always be executed sequentially: it will return only after the SDH has confirmed the stop
|
protected |
Internal helper function: return a vector of checked indices according to index.
index | - The index to vectorize or All |
all_replacement | - a vector to return if index is All |
maxindex | - the index is checked if in [0..\ maxindex[ (i.e. not including maxindex) |
name | - A name for the things index, used to report out of bounds errors |
|
private |
void cSDH::UseDegrees | ( | void | ) |
Shortcut to set the unit system to degrees.
After calling this (axis) angles are set/reported in degrees and angular velocities are set/reported in degrees/second
void cSDH::UseRadians | ( | void | ) |
Shortcut to set the unit system to radians.
After calling this axis angles are set/reported in radians and angular velocities are set/reported in radians/second
void cSDH::WaitAxis | ( | std::vector< int > const & | axes, |
double | timeout = -1.0 |
||
) |
Wait until the movement(s) of of axis(axes) has finished
The state of the given axis(axes) is(are) queried until all axes are no longer moving.
axes | - A vector of axis indices to access. |
timeout | - a timeout in seconds or -1.0 (default) to wait indefinetly. |
See also WaitAxis(int,double) for an overloaded variant to wait for a single axis or all axes.
Example 2, WaitAxis and eCT_VELOCITY_ACCELERATION controller, see also the demo program demo-velocity-acceleration
void cSDH::WaitAxis | ( | int | iAxis, |
double | timeout = -1.0 |
||
) |
Like WaitAxis(std::vector<int>const&,double), just for a single axis iAxis, see there for details and examples.
If iAxis is All then wait for all axes axes.
std::vector<int> cSDH::all_axes |
std::vector<int> cSDH::all_fingers |
std::vector<int> cSDH::all_real_axes |
std::vector<int> cSDH::all_temperature_sensors |
|
protected |
cSDHSerial cSDH::comm_interface |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
const cUnitConverter* cSDH::uc_angle |
|
static |
|
static |
const cUnitConverter* cSDH::uc_angular_acceleration |
|
static |
|
static |
const cUnitConverter* cSDH::uc_angular_velocity |
|
static |
|
static |
const cUnitConverter* cSDH::uc_motor_current |
|
static |
|
static |
const cUnitConverter* cSDH::uc_position |
|
static |
|
static |
const cUnitConverter* cSDH::uc_temperature |
|
static |
|
static |
const cUnitConverter* cSDH::uc_time |
|
static |
|
static |
|
protected |