#SDH::cSDH is the end user interface class to control a SDH (SCHUNK Dexterous Hand). More...
#include <sdh.h>
Public Types | |
enum | eAxisState { eAS_IDLE = 0, eAS_POSITIONING, eAS_SPEED_MODE, eAS_NOT_INITIALIZED, eAS_CW_BLOCKED, eAS_CCW_BLOCKED, eAS_DISABLED, eAS_LIMITS_REACHED, eAS_DIMENSION } |
The state of an axis (see TPOSCON_STATE in global.h of the SDH firmware) More... | |
enum | eMotorCurrentMode { eMCM_MOVE = 0, eMCM_GRIP = 1, eMCM_HOLD = 2, eMCM_DIMENSION } |
the motor current can be set specifically for these modes: More... | |
Public Member Functions | |
cSDH (bool _use_radians=false, bool _use_fahrenheit=false, int _debug_level=0) | |
Constructor of cSDH class. | |
virtual | ~cSDH () |
Communication methods | |
void | OpenRS232 (int _port=0, unsigned long _baudrate=115200, double _timeout=-1, char const *_device_format_string="/dev/ttyS%d") throw (cSDHLibraryException*) |
void | OpenCAN_ESD (int _net=0, unsigned long _baudrate=1000000, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42) throw (cSDHLibraryException*) |
void | OpenCAN_ESD (tDeviceHandle _ntcan_handle, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42) throw (cSDHLibraryException*) |
void | OpenCAN_PEAK (unsigned long _baudrate=1000000, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42, const char *_device="/dev/pcanusb0") throw (cSDHLibraryException*) |
void | OpenCAN_PEAK (tDeviceHandle _handle, double _timeout=0.0, Int32 _id_read=43, Int32 _id_write=42) throw (cSDHLibraryException*) |
void | OpenTCP (char const *_tcp_adr="192.168.1.1", int _tcp_port=23, double _timeout=0.0) throw (cSDHLibraryException*) |
void | Close (bool leave_enabled=false) throw (cSDHLibraryException*) |
virtual bool | IsOpen (void) throw () |
Auxiliary movement methods | |
void | EmergencyStop (void) throw (cSDHLibraryException*) |
void | Stop (void) throw (cSDHLibraryException*) |
void | SetController (cSDHBase::eControllerType controller) throw ( cSDHLibraryException* ) |
eControllerType | GetController (void) throw (cSDHLibraryException*) |
void | SetVelocityProfile (eVelocityProfile velocity_profile) throw (cSDHLibraryException*) |
eVelocityProfile | GetVelocityProfile (void) throw (cSDHLibraryException*) |
Methods to access SDH on axis-level | |
void | SetAxisMotorCurrent (std::vector< int > const &axes, std::vector< double > const &motor_currents, eMotorCurrentMode mode=eMCM_MOVE) throw (cSDHLibraryException*) |
void | SetAxisMotorCurrent (int iAxis, double motor_current, eMotorCurrentMode mode=eMCM_MOVE) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisMotorCurrent (std::vector< int > const &axes, eMotorCurrentMode mode=eMCM_MOVE) throw (cSDHLibraryException*) |
double | GetAxisMotorCurrent (int iAxis, eMotorCurrentMode mode=eMCM_MOVE) throw (cSDHLibraryException*) |
void | SetAxisEnable (std::vector< int > const &axes, std::vector< double > const &states) throw (cSDHLibraryException*) |
void | SetAxisEnable (int iAxis=All, double state=1.0) throw (cSDHLibraryException*) |
void | SetAxisEnable (std::vector< int > const &axes, std::vector< bool > const &states) throw (cSDHLibraryException*) |
void | SetAxisEnable (int iAxis=All, bool state=true) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisEnable (std::vector< int > const &axes) throw (cSDHLibraryException*) |
double | GetAxisEnable (int iAxis) throw (cSDHLibraryException*) |
std::vector< eAxisState > | GetAxisActualState (std::vector< int > const &axes) throw (cSDHLibraryException*) |
eAxisState | GetAxisActualState (int iAxis) throw (cSDHLibraryException*) |
void | WaitAxis (std::vector< int > const &axes, double timeout=-1.0) throw (cSDHLibraryException*) |
void | WaitAxis (int iAxis, double timeout=-1.0) throw (cSDHLibraryException*) |
void | SetAxisTargetAngle (std::vector< int > const &axes, std::vector< double > const &angles) throw (cSDHLibraryException*) |
void | SetAxisTargetAngle (int iAxis, double angle) throw (cSDHLibraryException*) |
std::vector< double > | SetAxisTargetGetAxisActualAngle (std::vector< int > const &axes, std::vector< double > const &angles) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisTargetAngle (std::vector< int > const &axes) throw (cSDHLibraryException*) |
double | GetAxisTargetAngle (int iAxis) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisActualAngle (std::vector< int > const &axes) throw (cSDHLibraryException*) |
double | GetAxisActualAngle (int iAxis) throw (cSDHLibraryException*) |
void | SetAxisTargetVelocity (std::vector< int > const &axes, std::vector< double > const &velocities) throw (cSDHLibraryException*) |
void | SetAxisTargetVelocity (int iAxis, double velocity) throw (cSDHLibraryException*) |
std::vector< double > | SetAxisTargetGetAxisActualVelocity (std::vector< int > const &axes, std::vector< double > const &velocities) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisTargetVelocity (std::vector< int > const &axes) throw (cSDHLibraryException*) |
double | GetAxisTargetVelocity (int iAxis) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisLimitVelocity (std::vector< int > const &axes) throw (cSDHLibraryException*) |
double | GetAxisLimitVelocity (int iAxis) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisLimitAcceleration (std::vector< int > const &axes) throw (cSDHLibraryException*) |
double | GetAxisLimitAcceleration (int iAxis) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisActualVelocity (std::vector< int >const &axes) throw (cSDHLibraryException*) |
double | GetAxisActualVelocity (int iAxis) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisReferenceVelocity (std::vector< int >const &axes) throw (cSDHLibraryException*) |
double | GetAxisReferenceVelocity (int iAxis) throw (cSDHLibraryException*) |
void | SetAxisTargetAcceleration (std::vector< int >const &axes, std::vector< double >const &accelerations) throw (cSDHLibraryException*) |
void | SetAxisTargetAcceleration (int iAxis, double acceleration) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisTargetAcceleration (std::vector< int >const &axes) throw (cSDHLibraryException*) |
double | GetAxisTargetAcceleration (int iAxis) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisMinAngle (std::vector< int > const &axes) throw (cSDHLibraryException*) |
double | GetAxisMinAngle (int iAxis) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisMaxAngle (std::vector< int > const &axes) throw (cSDHLibraryException*) |
double | GetAxisMaxAngle (int iAxis) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisMaxVelocity (std::vector< int > const &axes) throw (cSDHLibraryException*) |
double | GetAxisMaxVelocity (int iAxis) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisMaxAcceleration (std::vector< int > const &axes) throw (cSDHLibraryException*) |
double | GetAxisMaxAcceleration (int iAxis) throw (cSDHLibraryException*) |
double | MoveAxis (std::vector< int >const &axes, bool sequ=true) throw (cSDHLibraryException*) |
double | MoveAxis (int iAxis, bool sequ=true) throw (cSDHLibraryException*) |
Methods to access SDH on finger-level | |
void | SetFingerEnable (std::vector< int > const &fingers, std::vector< double > const &states) throw (cSDHLibraryException*) |
void | SetFingerEnable (int iFinger, double state=1.0) throw (cSDHLibraryException*) |
void | SetFingerEnable (std::vector< int > const &fingers, std::vector< bool > const &states) throw (cSDHLibraryException*) |
void | SetFingerEnable (int iFinger, bool state) throw (cSDHLibraryException*) |
std::vector< double > | GetFingerEnable (std::vector< int > const &fingers) throw (cSDHLibraryException*) |
double | GetFingerEnable (int iFinger) throw (cSDHLibraryException*) |
void | SetFingerTargetAngle (int iFinger, std::vector< double > const &angles) throw (cSDHLibraryException*) |
void | SetFingerTargetAngle (int iFinger, double a0, double a1, double a2) throw (cSDHLibraryException*) |
std::vector< double > | GetFingerTargetAngle (int iFinger) throw (cSDHLibraryException*) |
void | GetFingerTargetAngle (int iFinger, double &a0, double &a1, double &a2) throw (cSDHLibraryException*) |
std::vector< double > | GetFingerActualAngle (int iFinger) throw (cSDHLibraryException*) |
void | GetFingerActualAngle (int iFinger, double &a0, double &a1, double &a2) throw (cSDHLibraryException*) |
std::vector< double > | GetFingerMinAngle (int iFinger) throw (cSDHLibraryException*) |
void | GetFingerMinAngle (int iFinger, double &a0, double &a1, double &a2) throw (cSDHLibraryException*) |
std::vector< double > | GetFingerMaxAngle (int iFinger) throw (cSDHLibraryException*) |
void | GetFingerMaxAngle (int iFinger, double &a0, double &a1, double &a2) throw (cSDHLibraryException*) |
std::vector< double > | GetFingerXYZ (int iFinger, std::vector< double > const &angles) throw (cSDHLibraryException*) |
std::vector< double > | GetFingerXYZ (int iFinger, double a0, double a1, double a2) throw (cSDHLibraryException*) |
double | MoveFinger (std::vector< int >const &fingers, bool sequ=true) throw (cSDHLibraryException*) |
double | MoveFinger (int iFinger, bool sequ=true) throw (cSDHLibraryException*) |
double | MoveHand (bool sequ=true) throw (cSDHLibraryException*) |
Methods to access %SDH grip skills | |
double | GetGripMaxVelocity (void) |
double | GripHand (eGraspId grip, double close, double velocity, bool sequ=true) throw (cSDHLibraryException*) |
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. | |
std::vector< int > | all_real_axes |
A vector with indices of all real axes (in natural order), excluding the virtual axis. | |
std::vector< int > | all_fingers |
A vector with indices of all fingers (in natural order) | |
std::vector< int > | all_temperature_sensors |
A vector with indices of all temperature sensors. | |
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 | |
const cUnitConverter * | uc_angular_velocity |
unit convert for (axis) angular velocities: default = #SDH::cSDH::uc_angular_velocity_degrees_per_second | |
const cUnitConverter * | uc_angular_acceleration |
unit convert for (axis) angular accelerations: default = #SDH::cSDH::uc_angular_acceleration_degrees_per_second_squared | |
const cUnitConverter * | uc_time |
unit convert for times: default = uc_time_seconds | |
const cUnitConverter * | uc_temperature |
unit convert for temperatures: default = #SDH::cSDH::uc_temperature_celsius | |
const cUnitConverter * | uc_motor_current |
unit converter for motor curent: default = #SDH::cSDH::uc_motor_current_ampere | |
const cUnitConverter * | uc_position |
unit converter for position: default = #SDH::cSDH::uc_position_millimeter | |
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. | |
static cUnitConverter const | uc_angle_radians |
Converter for angles: external unit = radians. | |
static cUnitConverter const | uc_time_seconds |
Default converter for times (internal unit == external unit): seconds. | |
static cUnitConverter const | uc_time_milliseconds |
Converter for times: external unit = milliseconds. | |
static cUnitConverter const | uc_temperature_celsius |
Default converter for temparatures (internal unit == external unit): degrees celsius. | |
static cUnitConverter const | uc_temperature_fahrenheit |
Converter for temperatures: external unit = degrees fahrenheit. | |
static cUnitConverter const | uc_angular_velocity_degrees_per_second |
Default converter for angular velocities (internal unit == external unit): degrees / second. | |
static cUnitConverter const | uc_angular_velocity_radians_per_second |
Converter for angular velocieties: external unit = radians/second. | |
static cUnitConverter const | uc_angular_acceleration_degrees_per_second_squared |
Default converter for angular accelerations (internal unit == external unit): degrees / second. | |
static cUnitConverter const | uc_angular_acceleration_radians_per_second_squared |
Converter for angular velocieties: external unit = radians/second. | |
static cUnitConverter const | uc_motor_current_ampere |
Default converter for motor current (internal unit == external unit): Ampere. | |
static cUnitConverter const | uc_motor_current_milliampere |
Converter for motor current: external unit = milli Ampere. | |
static cUnitConverter const | uc_position_millimeter |
Default converter for position (internal unit == external unit): millimeter. | |
static cUnitConverter const | uc_position_meter |
Converter for position: external unit = meter. | |
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) throw (cSDHLibraryException*) |
std::vector< double > | GetAxisValueVector (std::vector< int > const &axes, pGetFunction ll_get, cUnitConverter const *uc, char const *name) throw (cSDHLibraryException*) |
std::vector< int > | ToIndexVector (int index, std::vector< int > &all_replacement, int maxindex, char const *name) throw (cSDHLibraryException*) |
pSetFunction | GetMotorCurrentModeFunction (eMotorCurrentMode mode) throw (cSDHLibraryException*) |
std::vector< double > | _GetFingerXYZ (int fi, std::vector< double > r_angles) throw (cSDHLibraryException*) |
Protected Attributes | |
std::vector< double > | f_max_acceleration_v |
Maximum allowed axis acceleration (in internal units (degrees/(second * second))), including the virtual axis. | |
std::vector< double > | f_max_angle_v |
Maximum allowed axis angles (in internal units (degrees)), including the virtual axis. | |
std::vector< double > | f_max_motor_current_v |
Maximum allowed motor currents (in internal units (Ampere)), including the virtual axis. | |
std::vector< double > | f_max_velocity_v |
Maximum allowed axis velocity (in internal units (degrees/second)), including the virtual axis. | |
std::vector< double > | f_min_acceleration_v |
Minimum allowed axis acceleration (in internal units (degrees/(second * second))), including the virtual axis. | |
std::vector< double > | f_min_angle_v |
Minimum allowed axis angles (in internal units (degrees)), including the virtual axis. | |
std::vector< double > | f_min_motor_current_v |
Minimum allowed motor currents (in internal units (Ampere)), including the virtual axis. | |
std::vector< double > | f_min_velocity_v |
Minimum allowed axis velocity (in internal units (degrees/second)), including the virtual axis. | |
std::vector< double > | f_ones_v |
Vector of 3 1.0 values. | |
std::vector< double > | f_zeros_v |
Vector of 3 epsilon values. | |
std::vector< std::vector< int > > | finger_axis_index |
Mapping of finger index, finger axis index to axis index: | |
std::vector< int > | finger_number_of_axes |
Mapping of finger index to number of real axes of fingers: | |
double | grip_max_velocity |
Maximum allowed grip velocity (in internal units (degrees/second)) | |
int | nb_all_axes |
The number of all axes including virtual axes. | |
int | NUMBER_OF_AXES_PER_FINGER |
The number of axis per finger (for finger 1 this includes the "virtual" base axis) | |
int | NUMBER_OF_VIRTUAL_AXES |
The number of virtual axes. | |
std::vector< double > | ones_v |
Vector of nb_all_axes 1.0 values. | |
std::vector< double > | zeros_v |
Vector of nb_all_axes 0.0 values. | |
Private Member Functions | |
void | AdjustLimits (cSDHBase::eControllerType controller) |
void | UpdateSettingsFromSDH () |
Private Attributes | |
eControllerType | controller_type |
cached value of the axis controller type | |
std::string | release_firmware |
string containing the SDH firmware release of the attaced SDH (something like "0.0.2.7") | |
Kinematic parameters of the Hand | |
double | l1 |
length of limb 1 (proximal joint to distal joint) in mm | |
double | l2 |
length of limb 2 (distal joint to fingertip) in mm | |
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. | |
virtual void | SetDebugOutput (std::ostream *debuglog) |
change the stream to use for debug messages | |
Miscellaneous methods | |
bool | IsVirtualAxis (int iAxis) throw (cSDHLibraryException*) |
Return true if index iAxis refers to a virtual axis. | |
void | UseRadians (void) |
void | UseDegrees (void) |
int | GetFingerNumberOfAxes (int iFinger) throw (cSDHLibraryException*) |
int | GetFingerAxisIndex (int iFinger, int iFingerAxis) throw (cSDHLibraryException*) |
char const * | GetFirmwareRelease (void) throw (cSDHLibraryException*) |
char const * | GetInfo (char const *what) throw (cSDHLibraryException*) |
std::vector< double > | GetTemperature (std::vector< int > const &sensors) throw (cSDHLibraryException*) |
double | GetTemperature (int iSensor) throw (cSDHLibraryException*) |
static char const * | GetLibraryRelease (void) |
static char const * | GetLibraryName (void) |
#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:
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:
// Assuming 'hand' is a cSDH object ... // override default unit converter for (axis) angles: hand.uc_angle = &cSDH::uc_angle_radians; // override default unit converter for (axis) angular velocities: hand.uc_angular_velocity = &cSDH::uc_angular_velocity_radians_per_second; // override default unit converter for (axis) angular accelerations: hand.uc_angular_acceleration = &cSDH::uc_angular_acceleration_radians_per_second_squared; // instead of the last 3 calls the following shortcut could be used: hand.UseRadians(); // override default unit converter for times: hand.uc_time = &cSDH::uc_time_milliseconds; // override default unit converter for temperatures: hand.uc_temperature = &cSDH::uc_temperature_fahrenheit; // override default unit converter for positions: hand.uc_position = &cSDH::uc_position_meter;
For convenience the most common settings can be specified as bool parameters for the constructor, like in:
// Include the cSDH interface #include <sdh.h> // Create a cSDH object 'hand' that uses // - the non default radians and radians/s units, // - the default temperature in degrees celsius, // - A debug level of 2 cSDH hand( true, false, 2 );
virtual cSDH::~cSDH | ( | ) | [virtual] |
Virtual destructor to make compiler happy
If the connection to the SDH hardware/firmware is still open then the connection is closed, which will stop the axis controllers (and thus prevent overheating).
std::vector<double> cSDH::_GetFingerXYZ | ( | int | fi, |
std::vector< double > | r_angles | ||
) | throw (cSDHLibraryException*) [protected] |
return cartesian [x,y,z] position in mm of fingertip for finger fi at angles r_angles (rad)
void cSDH::AdjustLimits | ( | cSDHBase::eControllerType | controller | ) | [private] |
Adjust the limits for the velocity and acceleration according to the controller type.
void cSDH::Close | ( | bool | leave_enabled = false | ) | throw (cSDHLibraryException*) |
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.
// Assuming 'hand' is a cSDH object ... // Close connection to SDH, power off controllers: hand.Close(); // To leave the already enabled controllers enabled: hand.Close( true );
void cSDH::EmergencyStop | ( | void | ) | throw (cSDHLibraryException*) |
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.
// Assuming 'hand' is a cSDH object ... // Perform an emergency stop: hand.EmergencyStop();
std::vector<double> cSDH::GetAxisActualAngle | ( | std::vector< int > const & | axes | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get actual axis angle of all axes std::vector<double> v = hand.GetAxisActualAngle( hand.all_axes ); // now v is something like {0.0, 0.0, 42.0, 0.0, 47.11, 0,0, 0.0} // Get actual axis angle of axis 2 double v2 = hand.GetAxisActualAngle( 2 ); // 2 is now something like 42.0 // Get actual axis angle of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisActualAngle( axes24 ); // now v is something like {42.0, 47.11}
double cSDH::GetAxisActualAngle | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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<eAxisState> cSDH::GetAxisActualState | ( | std::vector< int > const & | axes | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get actual axis state of all axes std::vector<eAxisState> v = hand.GetAxisActualState( hand.all_axes ) // now v is something like {eAS_IDLE, eAS_POSITIONING, eAS_IDLE, eAS_IDLE, eAS_IDLE, eAS_DISABLED, eAS_IDLE} // Get actual axis state of axis 3 eAxisState v3 = hand.GetAxisActualState( 3 ); // v3 is now something like eAS_IDLE // Get actual state of axis 2 and 5 std::vector<int> axes25; axes25.push_back( 2 ); axes25.push_back( 5 ); v = hand.GetAxisActualState( axes25 ); // now v is something like {eAS_IDLE, eAS_DISABLED}
eAxisState cSDH::GetAxisActualState | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get actual axis velocity of all axes std::vector<double> v = hand.GetAxisActualVelocity( hand.all_axes ); // now v is something like {0.1, 0.2, 0.3, 13.2, 0.5, 0.0, 0.7} // Get actual axis velocity of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisActualVelocity( axes24 ); // now v is something like {13.2, 0.0} // Get actual axis velocity of axis 2 double v3 = hand.GetAxisActualVelocity( 2 ); // v3 is now something like 13.2
double cSDH::GetAxisActualVelocity | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming 'hand' is a cSDH object ... // Get enabled state of all axes: std::vector<double> v = hand.GetAxisEnable( hand.all_axes ); // now v is something like {0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0} // Get enabled state of axis 3 and 5 std::vector<int> axes35; axes35.push_back( 3 ); axes35.push_back( 5 ); v = hand.GetAxisEnable( axes35 ); // now v is something like {1.0, 0.0} // Get enabled state of axis 3 double v3 = hand.GetAxisEnable( 3 ); // now v3 is something like 1.0
double cSDH::GetAxisEnable | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get axis acceleration limits of all axes std::vector<double> v = hand.GetAxisLimitAcceleration( hand.all_axes ); // now v is something like {81.0, 140.0, 120.0, 140.0, 120.0, 140.0, 120.0} // Get axis acceleration limit of axis 2 double v2 = hand.GetAxisLimitAcceleration( 2 ); // v2 is now something like 120.0 // Get axis acceleration limits of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisLimitAcceleration( axes24 ); // now v is something like {120.0,120.0}
double cSDH::GetAxisLimitAcceleration | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get axis velocity limits of all axes std::vector<double> v = hand.GetAxisLimitVelocity( hand.all_axes ); // now v is something like {81.0, 140.0, 120.0, 140.0, 120.0, 140.0, 120.0} // Get axis velocity limit of axis 2 double v2 = hand.GetAxisLimitVelocity( 2 ); // v2 is now something like 120.0 // Get axis velocity limits of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisLimitVelocity( axes24 ); // now v is something like {120.0,120.0}
double cSDH::GetAxisLimitVelocity | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get maximum axis angular accelerations of all axes std::vector<double> v = hand.GetAxisMaxAcceleration( hand.all_axes ); // now v is something like {1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0, 1000.0} // Get maximum axis angular acceleration of axis 3 double v3 = hand.GetAxisMaxAcceleration( 3 ); // v3 is now something like 1000.0 // Get maximum axis angular acceleration of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisMaxAcceleration( axes24 ); // now v is something like {1000.0, 1000.0} // Or if you change the angular acceleration unit system: hand.UseRadians(); v = hand.GetAxisMaxAcceleration( hand.all_axes ); // now v is something like {17.453292519943293, 17.453292519943293, 17.453292519943293, 17.453292519943293, 17.453292519943293, 17.453292519943293, 17.453292519943293}
double cSDH::GetAxisMaxAcceleration | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get maximum axis angles of all axes std::vector<double> v = hand.GetAxisMaxAngle( hand.all_axes ); // now v is something like {90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0} // Get maximum axis angle of axis 3 double v3 = hand.GetAxisMaxAngle( 3 ); // v3 is now something like 90.0 // Get maximum axis angle of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisMaxAngle( axes24 ); // now v is something like {90.0, 90.0} // Or if you change the angle unit system: hand.UseRadians(); v = hand.GetAxisMaxAngle( hand.all_axes ); // now v is something like { 1.5707963267948966, 1.5707963267948966, 1.5707963267948966, 1.5707963267948966, 1.5707963267948966, 1.5707963267948966, 1.5707963267948966}
double cSDH::GetAxisMaxAngle | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get maximum axis angular velocities of all axes std::vector<double> v = hand.GetAxisMaxVelocity( hand.all_axes ); // now v is something like {83.857,200.000,157.895,200.000,157.895,200.000,157.895} // Get maximum axis angular velocity of axis 3 double v3 = hand.GetAxisMaxVelocity( 3 ); // v3 is now something like 200.0 // Get maximum axis angular velocity of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisMaxVelocity( axes24 ); // now v is something like {157.895, 157.895} // Or if you change the angular velocity unit system: hand.UseRadians(); v = hand.GetAxisMaxVelocity( hand.all_axes ); // now v is something like {1.46358075084, 3.49065850399, 2.75578762244, 3.49065850399, 2.75578762244, 3.49065850399, 2.75578762244}
double cSDH::GetAxisMaxVelocity | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get minimum axis angles of all axes std::vector<double> v = hand.GetAxisMinAngle( hand.all_axes ); // now v is something like {0.0, -90.0, -90.0, -90.0, -90.0, -90.0, -90.0} // Get minimum axis angle of axis 3 double v3 = hand.GetAxisMinAngle( 3 ); // v3 is now something like -90.0 // Get minimum axis angle of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisMinAngle( axes24 ); // now v is something like {-90.0, -90.0} // Or if you change the angle unit system: hand.UseRadians(); v = hand.GetAxisMinAngle( hand.all_axes ); // now v is something like {0.0, -1.5707963267948966, -1.5707963267948966, -1.5707963267948966, -1.5707963267948966, -1.5707963267948966, -1.5707963267948966}
double cSDH::GetAxisMinAngle | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 |
||
) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get maximum allowed motor currents of all axes std::vector<double> v = hand.GetAxisMotorCurrent( hand.all_axes ); // now v is something like {0.1, 0.2, 0.3, 0.4, 0.5, 0,6, 0.7} // Get maximum allowed motor current of axis 3 in mode "eMCM_MOVE" double mc3 = hand.GetAxisMotorCurrent( 3, eMCM_MOVE ); // mc3 is now something like 0.75 // Get maximum allowed motor current of axis 3 and 5 in mode "eMCM_GRIP" std::vector<int> axes35; axes35.push_back( 3 ); axes35.push_back( 5 ); v = hand.GetAxisMotorCurrent( axes35, eMCM_GRIP ); // now v is something like {0.5,0.5};
double cSDH::GetAxisMotorCurrent | ( | int | iAxis, |
eMotorCurrentMode | mode = eMCM_MOVE |
||
) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Switch to "velocity control with acceleration ramp" controller mode first. // (When in another controller mode like the default eCT_POSE, // then the reference velocities will not be valid): hand.SetController( eCT_VELOCITY_ACCELERATION ); // Get reference axis velocity of all axes std::vector<double> v = hand.GetAxisReferenceVelocity( hand.all_axes ); // now v is something like {0.1, 0.2, 0.3, 13.2, 0.5, 0.0, 0.7} // Get reference axis velocity of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisReferenceVelocity( axes24 ); // now v is something like {13.2, 0.0} // Get reference axis velocity of axis 2 double v3 = hand.GetAxisReferenceVelocity( 2 ); // v3 is now something like 13.2
double cSDH::GetAxisReferenceVelocity | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get target axis acceleration of all axes std::vector<double> v = hand.GetAxisTargetAcceleration( hand.all_axes ); // now v is something like {100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0} // Get target axis acceleration of axis 2 double v2 = hand.GetAxisTargetAcceleration( 2 ); // v2 is now something like 100.0 // Get target axis acceleration of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisTargetAcceleration( axes24 ); // now v is something like {100.0, 100.0}
double cSDH::GetAxisTargetAcceleration | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get target axis angle of all axes std::vector<double> v = hand.GetAxisTargetAngle( hand.all_axes ); // now v is something like {0.0, 0.0, 42.0, 0.0, 47.11, 0,0, 0.0} // Get target axis angle of axis 2 double v2 = hand.GetAxisTargetAngle( 2 ); // v2 is now something like 42.0 // Get target axis angle of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisTargetAngle( axes24 ); // now v is something like {42.0, 47.11}
double cSDH::GetAxisTargetAngle | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get target axis velocity of all axes std::vector<double> v = hand.GetAxisTargetVelocity( hand.all_axes ); // now v is something like {0.0, 0.0, 42.0, 0.0, 47.11, 0,0, 0.0} // Get target axis velocity of axis 2 double v2 = hand.GetAxisTargetVelocity( 2 ); // v2 is now something like 42.0 // Get target axis velocity of axis 2 and 4 std::vector<int> axes24; axes24.push_back( 2 ); axes24.push_back( 4 ); v = hand.GetAxisTargetVelocity( axes24 ); // now v is something like {42.0, 47.11}
double cSDH::GetAxisTargetVelocity | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
Like GetAxisTargetVelocity(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::GetAxisValueVector | ( | std::vector< int > const & | axes, |
pGetFunction | ll_get, | ||
cUnitConverter const * | uc, | ||
char const * | name | ||
) | throw (cSDHLibraryException*) [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
). eControllerType cSDH::GetController | ( | void | ) | throw (cSDHLibraryException*) |
Get the type of axis controller used in the SDH
The currently set controller type will be queried and returned (One of eControllerType)
// Assuming 'hand' is a sdh.cSDH object ... // Get the controller type of the attached SDH: ct = hand.GetController(); // Print result, numerically and symbolically std::cout << "Currently the axis controller type is set to " << ct; std::cout << "(" << GetStringFromControllerType(ct) << ")\n";
std::vector<double> cSDH::GetFingerActualAngle | ( | int | iFinger | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get actual axis angles of finger 0 std::vector<double> v = hand.GetFingerActualAngle( 0 ); // v is now something like {42.0, -10.0, 47.11} // Get actual axis angles of finger 1 double a0, a1, a2; hand.GetFingerTargetAngle( 1, a0, a1, a2 ); // now a0, a1, a2 are something like 0.0, 24.7 and -5.5 respectively.
void cSDH::GetFingerActualAngle | ( | int | iFinger, |
double & | a0, | ||
double & | a1, | ||
double & | a2 | ||
) | throw (cSDHLibraryException*) |
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 | ||
) | throw (cSDHLibraryException*) |
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] |
// Assuming 'hand' is a cSDH object ... cout << "The 1st axis of finger 2 has real axis index " << hand.GetFingerNumberOfAxes( 2, 0 ) << "\n";
std::vector<double> cSDH::GetFingerEnable | ( | std::vector< int > const & | fingers | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get enabled state of all fingers: std::vector<double> v = hand.GetFingerEnable( hand.all_fingers ); // now v is something like {0.0, 1.0, 0.0} // Get enabled state of finger 0 and 2 std::vector<int> fingers02; fingers02.push_back( 0 ); fingers02.push_back( 2 ); v = hand.GetFingerEnable( fingers02 ); // now v is something like {0.0, 0.0} // Get enabled state of finger 1 double v1 = hand.GetFingerEnable( 1 ); // now v1 is something like 1.0
double cSDH::GetFingerEnable | ( | int | iFinger | ) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get maximum axis angles of finger 0 std::vector<double> v = hand.GetFingerMaxAngle( 0 ); // now v is something like {90.0, 90.0, 90.0} // Get target axis angles of finger 1 double a0, a1, a2; hand.GetFingerMaxAngle( 1, a0, a1, a2 ); // now a0, a1, a2 are something like 90.0, 90.0, 90.0 respectively. // Or if you change the angle unit system: hand.UseRadians(); v = hand.GetFingerMaxAngle( 0 ); // now v is something like {1.5707963267948966, 1.5707963267948966, 1.5707963267948966}
void cSDH::GetFingerMaxAngle | ( | int | iFinger, |
double & | a0, | ||
double & | a1, | ||
double & | a2 | ||
) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get minimum axis angles of finger 0 std::vector<double> v = hand.GetFingerMinAngle( 0 ); // now v is something like {0.0, -90.0, -90.0} // Get target axis angles of finger 1 double a0, a1, a2; hand.GetFingerMinAngle( 1, a0, a1, a2 ); // now a0, a1, a2 are something like 0.0, -90.0, -90.0 respectively. // Or if you change the angle unit system: hand.UseRadians(); v = hand.GetFingerMinAngle( 0 ); // now v is something like {0.0, -1.5707963267948966, -1.5707963267948966}
void cSDH::GetFingerMinAngle | ( | int | iFinger, |
double & | a0, | ||
double & | a1, | ||
double & | a2 | ||
) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
Return the number of real axes of finger with index iFinger.
iFinger | - index of finger in range [0..NUMBER_OF_FINGERS-1] |
// Assuming 'hand' is a cSDH object ... cout << "The finger 0 has " << hand.GetFingerNumberOfAxes( 0 ) << " real axes\n";
std::vector<double> cSDH::GetFingerTargetAngle | ( | int | iFinger | ) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get target axis angles of finger 0 std::vector<double> v = hand.GetFingerTargetAngle( 0 ); // now v is something like {42.0, -10.0, 47.11} // Get target axis angles of finger 1 double a0, a1, a2; hand.GetFingerTargetAngle( 1, a0, a1, a2 ); // now a0, a1, a2 are something like 0.0, 24.7 and -5.5 respectively.
void cSDH::GetFingerTargetAngle | ( | int | iFinger, |
double & | a0, | ||
double & | a1, | ||
double & | a2 | ||
) | throw (cSDHLibraryException*) |
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 | ||
) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Get actual finger angles of finger 0: std::vector<double> angles = hand.GetFingerActualAngle( 0 ); // Get actual finger tip position of finger 0: std::vector<double> position = hand.GetFingerXYZ( 0, angles ); // now position is something like {18.821618775581801, 32.600000000000001, 174.0} // (assuming that finger 0 is at axis angles {0,0,0}) // Get finger tip position of finger 2 at axis angles {90,-90,-90}: position = hand.GetFingerXYZ( 2, 90, -90, -90 ); // now position is something like {18.821618775581804, 119.60000000000002, -53.0} // Or if you change the angle unit system: hand.UseRadians(); position = hand.GetFingerXYZ( 0, 1.5707963267948966, -1.5707963267948966, -1.5707963267948966 ); // now position is still something like {18.821618775581804, 119.60000000000002, -53.0} // Or if you change the position unit system too: hand.uc_position = &cSDH::uc_position_meter position = hand.GetFingerXYZ( 0, 1.5707963267948966, -1.5707963267948966, -1.5707963267948966 ); // now position is still something like {0.018821618775581, 0.119.60000000000002, -0.052999999999}
std::vector<double> cSDH::GetFingerXYZ | ( | int | iFinger, |
double | a0, | ||
double | a1, | ||
double | a2 | ||
) | throw (cSDHLibraryException*) |
Like SetFingerTargetAngle(int,std::vector<double>const&), just with individual finger axis angles a0, a1 and a2.
char const* cSDH::GetFirmwareRelease | ( | void | ) | throw (cSDHLibraryException*) |
Return the 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.
// Assuming 'hand' is a cSDH object ... cout << "The SDH firmware reports release " << hand.GetFirmwareRelease() << "\n";
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.
// Assuming "hand" is a cSDH object ... // Get maximum grip skill velocity double v = hand.GetGripMaxVelocity(); // v is now something like 100.0 // Or if you change the velocity unit system: hand.UseRadians(); v = hand.GetGripMaxVelocity(); // now v is something like 1.7453292519943295
char const* cSDH::GetInfo | ( | char const * | what | ) | throw (cSDHLibraryException*) |
Return info according to what # # The following values are valid for what: # - "date-library" : date of the SDHLibrary-python release # - "release-library" : release name of the sdh.py python module # - "release-firmware" : release name of the SDH firmware (requires # an opened communication to the SDH) # - "date-firmware" : date of the SDH firmware (requires # an opened communication to the SDH) # - "release-soc" : release name of the SDH SoC (requires # an opened communication to the SDH) # - "date-soc" : date of the SDH SoC (requires # an opened communication to the SDH) # - "id-sdh" : ID of SDH # - "sn-sdh" : Serial number of SDH # #
# # Assuming 'hand' is a sdh.cSDH object ... # # print "The SDH firmware reports release %s" % ( hand.GetInfo( "release-firmware" ) ) # #
static char const* cSDH::GetLibraryName | ( | void | ) | [static] |
Return the name of the library as string.
// static member functon, so no cSDH object is needed for access: cout << "The SDHLibrary reports name " << cSDH::GetLibraryName() << "\n";
static char const* cSDH::GetLibraryRelease | ( | void | ) | [static] |
Return the release name of the library (not the firmware of the SDH) as string.
// static member functon, so no cSDH object is needed for access: cout << "The SDHLibrary reports release name " << cSDH::GetReleaseLibrary() << "\n";
pSetFunction cSDH::GetMotorCurrentModeFunction | ( | eMotorCurrentMode | mode | ) | throw (cSDHLibraryException*) [protected] |
Internal helper function: return the get/set function of the comm_interface object that is responsible for setting/getting motor currents in mode.
std::vector<double> cSDH::GetTemperature | ( | std::vector< int > const & | sensors | ) | throw (cSDHLibraryException*) |
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.
// Assuming 'hand' is a cSDH object ... // Get measured values of all sensors std::vector<double> temps = hand.GetTemperature( hand.all_temperature_sensors ); // Now temps is something like { 38.500,37.250,35.750,37.250,33.500,36.500,32.250,59.625,52.500 } // Get controller temperature only: double temp_controller = hand.GetTemperature( 0 ); // Now temp_controller is something like 40.5 // If we - for some obscure islandish reason - would want // temperatures reported in degrees fahrenheit, the unit // converter can be changed: hand.uc_temperature = &cSDH::uc_temperature_fahrenheit; // Get all temperaturs again: temps = hand.GetTemperature( hand.all_temperature_sensors ); // Now temps is something like {100.0, 96.8, 92.3, 97.7, 91.8, 96.8, 90.1, 137.5, 125.2}
double cSDH::GetTemperature | ( | int | iSensor | ) | throw (cSDHLibraryException*) |
Like GetTemperature(std::vector<int>const&), just for one sensor iSensor and returning a single temperature as double.
eVelocityProfile cSDH::GetVelocityProfile | ( | void | ) | throw (cSDHLibraryException*) |
Get the type of velocity profile used in the SDH
// Assuming 'hand' is a cSDH object ... // Get the velocity profile from the SDH: velocity_profile = hand.GetVelocityProfile(); // now velocity_profile is something like eVP_SIN_SQUARE or eVP_RAMP
double cSDH::GripHand | ( | eGraspId | grip, |
double | close, | ||
double | velocity, | ||
bool | sequ = true |
||
) | throw (cSDHLibraryException*) |
Perform one of the internal eGraspId "grips" or "grasps"
grip | - The index of the grip to perform [0..eGID_DIMENSION-1] (s.a. eGraspId) |
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. |
// Assuming 'hand' is a cSDH object ... // Perform a fully opened centrical grip at 50 degrees per second: hand.GripHand( hand.eGID_CENTRICAL, 0.0, 50.0, true ); // Now close it 50% with 30 degrees per second: hand.GripHand( hand.eGID_CENTRICAL, 0.5, 30.0, true ); // Then close it completely with 20 degrees per second: hand.GripHand( hand.eGID_CENTRICAL, 1.0, 20.0, true );
virtual bool cSDH::IsOpen | ( | void | ) | throw () [virtual] |
Return true if connection to SDH firmware/hardware is open.
Implements cSDHBase.
bool cSDH::IsVirtualAxis | ( | int | iAxis | ) | throw (cSDHLibraryException*) |
Return true
if index iAxis refers to a virtual axis.
double cSDH::MoveAxis | ( | std::vector< int >const & | axes, |
bool | sequ = true |
||
) | throw (cSDHLibraryException*) |
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.
// Assuming 'hand' is a cSDH object ... // create an index vector for adressing axes 0, 4 and 2 (in that order) std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); // Set a new target pose for axes 0, 4 and 2: std::vector<double> angles042; angles042.push_back( 0.0 ); angles042.push_back( -44.4 ); angles042.push_back( -22.2 ); hand.SetFingerTargetAngle( axes042, angles042 ); // First move Axis 0 only to its new target position: hand.MoveAxis( 0 ); // The axis 0 has now reached its target position 0.0 degrees. The // target poses for axes 4 and 2 are still set since the // last MoveAxes() call was sequentially (und thus it could // restore the previously set target axis angles of not // selected axes after the movement finished) // So move axes 4 and 2 now, this time non-sequentially: std::vector<int> axes42; axes42.push_back( 4 ); axes42.push_back( 2 ); double t = hand.MoveAxes( axis42, false ); // The two axes 4 and 2 are now moving to their target position. // We have to wait until the non-sequential call has finished: SleepSec( t ); // The axes 4 and 2 have now moved to -44.4 and -22.2. // The target angles for other axes have by now been // overwritten since the last MoveAxis() call was // non-sequentially (und thus it could \b NOT restore the // previously set target axis angles of not selected axes // after the movement finished) // Set new target angles for all axes ("home pose"); hand.SetAxisTargetAngle( hand.All, 0.0 ); // Now move all axes back to home pose: hand.MoveAxes( hand.All );
double cSDH::MoveAxis | ( | int | iAxis, |
bool | sequ = true |
||
) | throw (cSDHLibraryException*) |
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 |
||
) | throw (cSDHLibraryException*) |
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.
// Assuming 'hand' is a cSDH object ... // Set a new target pose for finger 0: hand.SetFingerTargetAngle( 0, 0.0, 0.0, 0.0 ); // Set a new target pose for finger 1 hand.SetFingerTargetAngle( 1, 0.0, -10.0, -10.0 ); // Set a new target pose for finger 2 hand.SetFingerTargetAngle( 2, 20.0, -20.0, -20.0 ); // Move finger 0 only (and finger 2 partly as axis 0 also belongs to finger 2); hand.MoveFinger( 0, true ); // The finger 0 has been moved to {20,0,0} // (axis 0 is 'wrong' since the target angle for axis 0 has been overwritten // while setting the target angles for finger 2); // The target poses for finger 1 and 2 are still set since the // last MoveFinger() call was sequentially. // So move finger 1 now: double t = hand.MoveFinger( 1, false ); // wait until the non-sequential call has finished: SleepSec( t ); // The finger 1 has been moved to {0,-10,-10}. // The target angles for finger 2 have been overwritten since the // last MoveFinger() call was non-sequentially. // Therefore this next call will just keep the fingers in their // current positions: hand.MoveFinger( hand.All, true ); // Set new target angles for all axes ("home pose"); hand.SetAxisTargetAngle( hand.All, 0.0 ); // Now move all axes back to home pose: hand.MoveHand();
double cSDH::MoveFinger | ( | int | iFinger, |
bool | sequ = true |
||
) | throw (cSDHLibraryException*) |
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 | ) | throw (cSDHLibraryException*) |
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 |
||
) | throw (cSDHLibraryException*) |
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) |
// Assuming 'hand' is a cSDH object ... // use default parameters for net, baudrate, timeout and IDs hand.OpenCAN_ESD( ); // use non default settings: // net=1, baudrate=500000, timeout=1.0, id_read=0x143, id_write=0x142 hand.OpenCAN_ESD( 1, 500000, 1.0, 0x143, 0x142 );
void cSDH::OpenCAN_ESD | ( | tDeviceHandle | _ntcan_handle, |
double | _timeout = 0.0 , |
||
Int32 | _id_read = 43 , |
||
Int32 | _id_write = 42 |
||
) | throw (cSDHLibraryException*) |
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) |
// Assuming 'hand' is a cSDH object ... // and 'handle' is a valid NTCAN_HANDLE for the ESD device // use default parameters for timeout and IDs hand.OpenCAN_ESD( tDeviceHandle(handle) ); // or use non default settings: // timeout=1.0, id_read=0x143, id_write=0x142 hand.OpenCAN_ESD( handle, 1.0, 0x143, 0x142 );
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" |
||
) | throw (cSDHLibraryException*) |
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" |
// Assuming 'hand' is a cSDH object ... // use default parameters for baudrate, timeout, IDs and device hand.OpenCAN_PEAK( ); // use non default settings: // baudrate=500000, timeout=1.0, id_read=0x143, id_write=0x142, , const char *device="/dev/pcanusb1" hand.OpenCAN_PEAK( 500000, 1.0, 0x143, 0x142, "/dev/pcanusb1" );
void cSDH::OpenCAN_PEAK | ( | tDeviceHandle | _handle, |
double | _timeout = 0.0 , |
||
Int32 | _id_read = 43 , |
||
Int32 | _id_write = 42 |
||
) | throw (cSDHLibraryException*) |
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) |
// Assuming 'hand' is a cSDH object ... // and 'handle' is a valid HANDLE for the PEAK device // use default parameters for timeout and IDs hand.OpenCAN_PEAK( tDeviceHandle(handle) ); // or use non default settings: // timeout=1.0, id_read=0x143, id_write=0x142 hand.OpenCAN_PEAK( handle, 1.0, 0x143, 0x142 );
void cSDH::OpenRS232 | ( | int | _port = 0 , |
unsigned long | _baudrate = 115200 , |
||
double | _timeout = -1 , |
||
char const * | _device_format_string = "/dev/ttyS%d" |
||
) | throw (cSDHLibraryException*) |
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. |
// Assuming 'hand' is a cSDH object ... // Open connection to SDH via default port: hand.OpenRS232(); // Use a different port 2 == COM3 == /dev/ttyS2 for a second hand "hand2": cSDH hand2(); hand2.OpenRS232( 2 ); // Linux only: Use a different USB to RS232 device on port 3 /dev/ttyUSB3 for a third hand "hand3": cSDH hand3(); hand2.OpenRS232( 3, 115200, -1, "/dev/ttyUSB%d" );
void cSDH::OpenTCP | ( | char const * | _tcp_adr = "192.168.1.1" , |
int | _tcp_port = 23 , |
||
double | _timeout = 0.0 |
||
) | throw (cSDHLibraryException*) |
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:
|
// Assuming 'hand' is a cSDH object ... // IP-address 192.168.1.1, port 23, timeout=0.0 hand.OpenTCP( "192.168.1.1.", 23, 0.0 );
void cSDH::SetAxisEnable | ( | std::vector< int > const & | axes, |
std::vector< double > const & | states | ||
) | throw (cSDHLibraryException*) |
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.
// Assuming 'hand' is a cSDH object ... // Enable all axes: hand.SetAxisEnable( hand.all_axes, hand.ones_v ); // Disable all axes: hand.SetAxisEnable( All, 0 ); // Enable axis 0 and 2 while disabling axis 4: std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> states042; states042.push_back( 1.0 ); states042.push_back( 0.0 ); states042.push_back( 1.0 ); hand.SetAxisEnable( axes042, states042 ); // Disable axis 2 hand.SetAxisEnable( 2, false );
void cSDH::SetAxisEnable | ( | int | iAxis = All , |
double | state = 1.0 |
||
) | throw (cSDHLibraryException*) |
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 | ||
) | throw (cSDHLibraryException*) |
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 |
||
) | throw (cSDHLibraryException*) |
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 |
||
) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Set maximum allowed motor current of all axes to the given values in mode "eMCM_MOVE":: std::vector<double> all_motor_currents; all_motor_currents.push_back( 0.0 ); all_motor_currents.push_back( 0.1 ); all_motor_currents.push_back( 0.2 ); all_motor_currents.push_back( 0.3 ); all_motor_currents.push_back( 0.4 ); all_motor_currents.push_back( 0.5 ); all_motor_currents.push_back( 0.6 ); hand.SetAxisMotorCurrent( hand.all_axes, all_motor_currents ); // Set maximum allowed motor current of all axes to 0.1 A in mode "eMCM_HOLD": hand.SetAxisMotorCurrent( hand.All, 1.0, eMCM_HOLD ); // Set maximum allowed motor current of axis 3 to 0.75 A in mode "eMCM_MOVE": hand.SetAxisMotorCurrent( 3, 0.75, eMCM_MOVE ); // Set maximum allowed motor current of for axis 0, 4 and 2 to 0.0 A, // 0.4 A and 0.2 A respectively in mode "eMCM_GRIP" std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> motor_currents042; motor_currents042.push_back( 0.0 ); motor_currents042.push_back( 0.4 ); motor_currents042.push_back( 0.2 ); hand.SetAxisMotorCurrent( axes042, states042, eMCM_GRIP );
void cSDH::SetAxisMotorCurrent | ( | int | iAxis, |
double | motor_current, | ||
eMotorCurrentMode | mode = eMCM_MOVE |
||
) | throw (cSDHLibraryException*) |
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 | ||
) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Set target axis acceleration of all axes to the given values: std::vector<double> all_accelerations; all_accelerations.push_back( 100.0 ); all_accelerations.push_back( 101.0 ); all_accelerations.push_back( 102.0 ); all_accelerations.push_back( 103.0 ); all_accelerations.push_back( 104.0 ); all_accelerations.push_back( 105.0 ); all_accelerations.push_back( 106.0 ); hand.SetAxisTargetAcceleration( hand.all_axes, all_accelerations ); // Set target axis acceleration of axis 3 to 420 degrees per square-second: hand.SetAxisTargetAcceleration( 3, 420.0 ); // Set target acceleration of for axis 0,4 and 2 to 0.0, 444.0 and 222 degrees per square-second respectively: std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> accelerations042; accelerations042.push_back( 100.0 ); accelerations042.push_back( 104.0 ); accelerations042.push_back( 102.0 ); hand.SetAxisTargetAcceleration( axes042, accelerations042 ); // Set target axis acceleration of all axes to 142.1 degrees per square-second hand.SetAxisTargetAcceleration( hand.All, 142.1 );
void cSDH::SetAxisTargetAcceleration | ( | int | iAxis, |
double | acceleration | ||
) | throw (cSDHLibraryException*) |
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 | ||
) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Set target axis angle of all axes to the given values: std::vector<double> all_angles; all_angles.push_back( 0.0 ); all_angles.push_back( -11.0 ); all_angles.push_back( -22.0 ); all_angles.push_back( -33.0 ); all_angles.push_back( -44.0 ); all_angles.push_back( -55.0 ); all_angles.push_back( -66.0 ); hand.SetAxisTargetAngle( hand.all_axes, all_angles ); // Set target axis angle of axis 3 to -42 degrees: hand.SetAxisTargetAngle( 3, -42.0 ); // Set target angle of for axis 0, 4 and 2 to 0.0, -44.4 and -2.22 degrees respectively: std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> angles042; angles042.push_back( 0.0 ); angles042.push_back( -44.4 ); angles042.push_back( -2.22 ); hand.SetAxisTargetAngle( axes042, angles042 ); // Set target axis angle of all axes to 0 degrees (home-position) hand.SetAxisTargetAngle( hand.All, 0.0 );
void cSDH::SetAxisTargetAngle | ( | int | iAxis, |
double | angle | ||
) | throw (cSDHLibraryException*) |
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 | ||
) | throw (cSDHLibraryException*) |
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]]].// Assuming "hand" is a cSDH object ... // Set target axis angles of all axes to the given values and read back the actual angle: std::vector<double> all_target_angles; all_target_angles.push_back( 0.0 ); all_target_angles.push_back( 11.0 ); all_target_angles.push_back( 22.0 ); all_target_angles.push_back( 33.0 ); all_target_angles.push_back( 44.0 ); all_target_angles.push_back( 55.0 ); all_target_angles.push_back( 66.0 ); std::vector<double> all_acutal_angles; all_acutal_angles = hand.SetAxisTargetGetAxisActualAngle( hand.all_axes, all_target_angles ); // Set target angle of for axis 0,4 and 2 to 0.0, 44.4 and 2.22 degrees per second respectively: std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> target_angles042; target_angles042.push_back( 0.0 ); target_angles042.push_back( 44.4 ); target_angles042.push_back( 2.22 ); std::vector<double> actual_angles042; actual_angles042 = hand.SetAxisTargetGetAxisActualAngle( axes042, target_angles042 );
std::vector<double> cSDH::SetAxisTargetGetAxisActualVelocity | ( | std::vector< int > const & | axes, |
std::vector< double > const & | velocities | ||
) | throw (cSDHLibraryException*) |
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]]].// Assuming "hand" is a cSDH object ... // Set target axis velocity of all axes to the given values and read back the actual velocity: std::vector<double> all_target_velocities; all_target_velocities.push_back( 0.0 ); all_target_velocities.push_back( 11.0 ); all_target_velocities.push_back( 22.0 ); all_target_velocities.push_back( 33.0 ); all_target_velocities.push_back( 44.0 ); all_target_velocities.push_back( 55.0 ); all_target_velocities.push_back( 66.0 ); std::vector<double> all_acutal_velocities; all_acutal_velocities = hand.SetAxisTargetGetAxisActualVelocity( hand.all_axes, all_target_velocities ); // Set target velocity of for axis 0,4 and 2 to 0.0, 44.4 and 2.22 degrees per second respectively: std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> target_velocities042; target_velocities042.push_back( 0.0 ); target_velocities042.push_back( 44.4 ); target_velocities042.push_back( 2.22 ); std::vector<double> actual_velocities042; actual_velocities042 = hand.SetAxisTargetGetAxisActualVelocity( axes042, target_velocities042 );
void cSDH::SetAxisTargetVelocity | ( | std::vector< int > const & | axes, |
std::vector< double > const & | velocities | ||
) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Set target axis velocity of all axes to the given values: std::vector<double> all_velocities; all_velocities.push_back( 0.0 ); all_velocities.push_back( 11.0 ); all_velocities.push_back( 22.0 ); all_velocities.push_back( 33.0 ); all_velocities.push_back( 44.0 ); all_velocities.push_back( 55.0 ); all_velocities.push_back( 66.0 ); hand.SetAxisTargetVelocity( hand.all_axes, all_velocities ); // Set target axis velocity of axis 3 to 42 degrees per second: hand.SetAxisTargetVelocity( 3, 42.0 ); // Set target velocity of for axis 0,4 and 2 to 0.0, 44.4 and 2.22 degrees per second respectively: std::vector<int> axes042; axes042.push_back( 0 ); axes042.push_back( 4 ); axes042.push_back( 2 ); std::vector<double> velocities042; velocities042.push_back( 0.0 ); velocities042.push_back( 44.4 ); velocities042.push_back( 2.22 ); hand.SetAxisTargetVelocity( axes042, velocities042 ); // Set target axis velocity of all axes to 47.11 degrees per second hand.SetAxisTargetVelocity( hand.All, 47.11 );
void cSDH::SetAxisTargetVelocity | ( | int | iAxis, |
double | velocity | ||
) | throw (cSDHLibraryException*) |
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.
std::vector<double> cSDH::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 | ||
) | throw (cSDHLibraryException*) [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 |
max_values | - a vector with the maximum allowed values |
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 | ) | throw ( cSDHLibraryException* ) |
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 |
// Assuming 'hand' is a cSDH object ... // Set the pose controller in the SDH // (see e.g. demo-simple.cpp, demo-simple2.cpp, demo-simple3.cpp for further examples) hand.SetController( hand.eCT_POSE ); // Set the simple velocity controller in the SDH: hand.SetController( hand.eCT_VELOCITY ); // Set the velocity with acceleration ramp controller in the SDH: // (see e.g. demo-velocity-acceleration.cpp for further examples) hand.SetController( hand.eCT_VELOCITY_ACCELERATION );
virtual void cSDH::SetDebugOutput | ( | std::ostream * | debuglog | ) | [inline, virtual] |
void cSDH::SetFingerEnable | ( | std::vector< int > const & | fingers, |
std::vector< double > const & | states | ||
) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Enable finger 1 and 2 while disabling finger 0 : std::vector<double> states012; states012.push_back( 0.0 ); states012.push_back( 1.0 ); states012.push_back( 1.0 ); hand.SetFingerEnable( hand.all_axes, states012 ); // (this will keep axis 0 (used by the disabled finger 0) enabled, // since axis 0 is needed by the enabled finger 2 too); // Enable all fingers: hand.SetFingerEnable( hand.All,true ); // Disable all fingers: hand.SetFingerEnable( hand.All, 0.0 ); // Disable finger 2: hand.SetFingerEnable( 2, false );
void cSDH::SetFingerEnable | ( | int | iFinger, |
double | state = 1.0 |
||
) | throw (cSDHLibraryException*) |
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 | ||
) | throw (cSDHLibraryException*) |
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 | ||
) | throw (cSDHLibraryException*) |
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 | ||
) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... // Set target axis angles of finger 0 to { 10.0, -08.15, 47.11 } degrees std::vector<double> angles; angles.push_back( 10.0 ); angles.push_back( -08.15 ); angles.push_back( 47.11 ); hand.SetFingerTargetAngle( 0, angles ); // Set target axis angles of finger 1 to { 0.0, 24.7, 17.4 } degrees angles[0] = 0.0; // "virtual" base axis of finger 1 angles[1] = 24.7; angles[2] = 17.4; hand.SetFingerTargetAngle( 1, { 0.0, 24.7, 17.4 } ); // Set target axis angles of all axes of finger 0 to 12.34 degrees hand.SetFingerTargetAngle( 0, 12.34, 12.34, 12.34 ); // REMARK: the last command changed the previously set target axis // angle for axis 0, since axis 0 is used as base axis for both // finger 0 and 2!
void cSDH::SetFingerTargetAngle | ( | int | iFinger, |
double | a0, | ||
double | a1, | ||
double | a2 | ||
) | throw (cSDHLibraryException*) |
Like SetFingerTargetAngle(int,std::vector<double>const&), just with individual finger axis angles a0, a1 and a2.
void cSDH::SetVelocityProfile | ( | eVelocityProfile | velocity_profile | ) | throw (cSDHLibraryException*) |
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 |
// Assuming 'hand' is a cSDH object ... // Set the sin square velocity profile in the SDH: hand.SetVelocityProfile( hand.eVP_SIN_SQUARE ); // Or else set the ramp velocity profile in the SDH: hand.SetVelocityProfile( hand.eVP_RAMP )
void cSDH::Stop | ( | void | ) | throw (cSDHLibraryException*) |
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
// Assuming 'hand' is a cSDH object ... // Perform a stop: hand.Stop();
std::vector<int> cSDH::ToIndexVector | ( | int | index, |
std::vector< int > & | all_replacement, | ||
int | maxindex, | ||
char const * | name | ||
) | throw (cSDHLibraryException*) [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 |
void cSDH::UpdateSettingsFromSDH | ( | ) | [private] |
Update settings like min/max velocities and accelerations from the connected SDH
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
// Assuming 'hand' is a cSDH object ... // make hand object use degrees and degrees/second for angles and angular velocities hand.UseDegrees(); // as degrees, degrees/second are the default this is needed only if the // unit system was changed before
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
// Assuming 'hand' is a cSDH object ... // make hand object use radians and radians/second for angles and angular velocities hand.UseRadians();
void cSDH::WaitAxis | ( | std::vector< int > const & | axes, |
double | timeout = -1.0 |
||
) | throw (cSDHLibraryException*) |
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.
// Assuming "hand" is a cSDH object ... hand.SetController( eCT_POSE ); // Set a new target pose for axis 1,2 and 3 std::vector<int> axes123; axes123.push_back( 1 ); axes123.push_back( 2 ); axes123.push_back( 3 ); std::vector<double> angles123; angles123.push_back( -20.0 ); angles123.push_back( -30.0 ); angles123.push_back( -40.0 ); hand.SetAxisTargetAngle( axes123, angles123 ); // Move axes there non sequentially: hand.MoveAxis( axes123, false ); // The last call returned immediately so we now have time to // do something else while the hand is moving: // ... insert any calculation here ... // Before doing something else with the hand make sure the // selected axes have finished the last movement: hand.WaitAxis( axes123 ); // go back home (all angles to 0.0): hand.SetAxisTargetAngle( hand.All, 0.0 ); // Move all axes there non sequentially: hand.MoveAxis( hand.All, False ); // ... insert any other calculation here ... // Wait until all axes are there, with a timeout of 10s: hand.WaitAxis( hand.All, 10.0 ); // now we are at the desired position.
Example 2, WaitAxis and eCT_VELOCITY_ACCELERATION controller, see also the demo program demo-velocity-acceleration
// Assuming "hand" is a cSDH object ... hand.SetController( eCT_VELOCITY_ACCELERATION); // Set a new target velocity for axis 1,2 and 3 std::vector<int> axes123; axes123.push_back( 1 ); axes123.push_back( 2 ); axes123.push_back( 3 ); std::vector<double> velocities123; velocities123.push_back( -20.0 ); velocities123.push_back( -30.0 ); velocities123.push_back( -40.0 ); hand.SetAxisTargetVelocity( axes123, velocities123 ); // this will make the axes move! // The last call returned immediately so we now have time to // do something else while the hand is moving: // ... insert any calculation here ... // to break and stop the movement just set the target velocities to 0.0 velocities123[0] = 0.0; velocities123[1] = 0.0; velocities123[2] = 0.0; hand.SetAxisTargetVelocity( axes123, velocities123 ); // this will make the axes break with the default (de)acceleration // The previous command returned immediately, so // before doing something else with the hand make sure the // selected axes have stopped: hand.WaitAxis( axes123 ); // now the axes have stopped
void cSDH::WaitAxis | ( | int | iAxis, |
double | timeout = -1.0 |
||
) | throw (cSDHLibraryException*) |
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.
cSerialBase* cSDH::com [protected] |
eControllerType cSDH::controller_type [private] |
std::vector<double> cSDH::f_max_acceleration_v [protected] |
std::vector<double> cSDH::f_max_angle_v [protected] |
std::vector<double> cSDH::f_max_motor_current_v [protected] |
std::vector<double> cSDH::f_max_velocity_v [protected] |
std::vector<double> cSDH::f_min_acceleration_v [protected] |
std::vector<double> cSDH::f_min_angle_v [protected] |
std::vector<double> cSDH::f_min_motor_current_v [protected] |
std::vector<double> cSDH::f_min_velocity_v [protected] |
std::vector<double> cSDH::f_ones_v [protected] |
std::vector<double> cSDH::f_zeros_v [protected] |
std::vector<std::vector<int> > cSDH::finger_axis_index [protected] |
std::vector<int> cSDH::finger_number_of_axes [protected] |
double cSDH::grip_max_velocity [protected] |
double cSDH::l1 [protected] |
double cSDH::l2 [protected] |
int cSDH::nb_all_axes [protected] |
int cSDH::NUMBER_OF_AXES_PER_FINGER [protected] |
int cSDH::NUMBER_OF_VIRTUAL_AXES [protected] |
std::vector<std::vector<double> > cSDH::offset [protected] |
std::vector<double> cSDH::ones_v [protected] |
std::string cSDH::release_firmware [private] |
const cUnitConverter* cSDH::uc_angle |
cUnitConverter const cSDH::uc_angle_degrees [static] |
cUnitConverter const cSDH::uc_angle_radians [static] |
cUnitConverter const cSDH::uc_angular_velocity_degrees_per_second [static] |
cUnitConverter const cSDH::uc_angular_velocity_radians_per_second [static] |
cUnitConverter const cSDH::uc_motor_current_ampere [static] |
cUnitConverter const cSDH::uc_motor_current_milliampere [static] |
const cUnitConverter* cSDH::uc_position |
cUnitConverter const cSDH::uc_position_meter [static] |
cUnitConverter const cSDH::uc_position_millimeter [static] |
cUnitConverter const cSDH::uc_temperature_celsius [static] |
cUnitConverter const cSDH::uc_temperature_fahrenheit [static] |
const cUnitConverter* cSDH::uc_time |
cUnitConverter const cSDH::uc_time_milliseconds [static] |
cUnitConverter const cSDH::uc_time_seconds [static] |
std::vector<double> cSDH::zeros_v [protected] |