Haptic SDK: dhdc.cpp File Reference

dhdc.cpp File Reference

Functions
dhdc.cpp File Reference

Haptic SDK documentation. More...

## Functions
ulong __SDK | dhdGetSystemCounter ()
double __SDK | dhdGetTime ()
double __SDK | dhdGetDeviceTime (char ID)
int __SDK | dhdGetDeviceCount ()
int __SDK | dhdGetAvailableCount ()
int __SDK | dhdOpen ()
int __SDK | dhdCheckControllerMemory (char ID)
int __SDK | dhdOpenType (int type)
int __SDK | dhdOpenSerial (int serial)
int __SDK | dhdOpenID (char index)
int __SDK | dhdClose (char ID)
int __SDK | dhdStop (char ID)
int __SDK | dhdSetDevice (char ID)
int __SDK | dhdGetDeviceID ()
int __SDK | dhdGetSerialNumber (ushort *sn, char ID)
bool __SDK | dhdIsLeftHanded (char ID)
bool __SDK | dhdHasBase (char ID)
bool __SDK | dhdHasWrist (char ID)
bool __SDK | dhdHasActiveWrist (char ID)
bool __SDK | dhdHasGripper (char ID)
bool __SDK | dhdHasActiveGripper (char ID)
bool __SDK | dhdHasLocks (char ID)
int __SDK | dhdGetSystemType (char ID)
int __SDK | dhdGetSystemRev (char ID)
const char *__SDK | dhdGetSystemName (char ID)
int __SDK | dhdGetVersion (double *ver, char ID)
int __SDK | dhdGetVersionStr (char *buffer, size_t size, char ID)
void __SDK | dhdGetSDKVersion (int *major, int *minor, int *release, int *revision)
const char *__SDK | dhdGetSDKVersionStr ()
int __SDK | dhdGetComponentVersionStr (uint32_t component, char *buffer, size_t size, char ID)
int __SDK | dhdGetStatus (int status[DHD_MAX_STATUS], char ID)
int __SDK | dhdGetDeviceAngleRad (double *angle, char ID)
int __SDK | dhdGetDeviceAngleDeg (double *angle, char ID)
int __SDK | dhdGetBaseAngleXRad (double *angle, char ID)
int __SDK | dhdGetBaseAngleXDeg (double *angle, char ID)
int __SDK | dhdGetBaseAngleZRad (double *angle, char ID)
int __SDK | dhdGetBaseAngleZDeg (double *angle, char ID)
int __SDK | dhdGetButton (int index, char ID)
unsigned int __SDK | dhdGetButtonMask (char ID)
int __SDK | dhdSetOutput (uint output, char ID)
int __SDK | dhdReset (char ID)
int __SDK | dhdResetWrist (char ID)
int __SDK | dhdWaitForReset (int timeout, char ID)
int __SDK | dhdSetStandardGravity (double g, char ID)
int __SDK | dhdSetGravityCompensation (int val, char ID)
int __SDK | dhdSetEffectorMass (double mass, char ID)
int __SDK | dhdGetEffectorMass (double *mass, char ID)
int __SDK | dhdSetDeviceAngleDeg (double angle, char ID)
int __SDK | dhdSetDeviceAngleRad (double angle, char ID)
int __SDK | dhdSetBaseAngleXDeg (double angle, char ID)
int __SDK | dhdSetBaseAngleXRad (double angle, char ID)
int __SDK | dhdSetBaseAngleZDeg (double angle, char ID)
int __SDK | dhdSetBaseAngleZRad (double angle, char ID)
int __SDK | dhdSetBrakes (int val, char ID)
int __SDK | dhdGetPosition (double *px, double *py, double *pz, char ID)
int __SDK | dhdGetDeltaJacobian (double jacobian[3][3], char ID)
int __SDK | dhdGetForce (double *fx, double *fy, double *fz, char ID)
int __SDK | dhdSetForce (double fx, double fy, double fz, char ID)
int __SDK | dhdGetOrientationRad (double *oa, double *ob, double *og, char ID)
int __SDK | dhdGetOrientationDeg (double *oa, double *ob, double *og, char ID)
int __SDK | dhdGetPositionAndOrientationRad (double *px, double *py, double *pz, double *oa, double *ob, double *og, char ID)
int __SDK | dhdGetPositionAndOrientationDeg (double *px, double *py, double *pz, double *oa, double *ob, double *og, char ID)
int __SDK | dhdGetPositionAndOrientationFrame (double *px, double *py, double *pz, double matrix[3][3], char ID)
int __SDK | dhdGetForceAndTorque (double *fx, double *fy, double *fz, double *tx, double *ty, double *tz, char ID)
int __SDK | dhdSetForceAndTorque (double fx, double fy, double fz, double tx, double ty, double tz, char ID)
int __SDK | dhdSetForceAndTorqueAndGripperForce (double fx, double fy, double fz, double tx, double ty, double tz, double fg, char ID)
int __SDK | dhdGetForceAndTorqueAndGripperForce (double *fx, double *fy, double *fz, double *tx, double *ty, double *tz, double *f, char ID)
int __SDK | dhdControllerSetDevice (int device, char ID)
int __SDK | dhdConfigLinearVelocity (int ms, int mode, char ID)
int __SDK | dhdGetLinearVelocity (double *vx, double *vy, double *vz, char ID)
int __SDK | dhdConfigAngularVelocity (int ms, int mode, char ID)
int __SDK | dhdGetAngularVelocityRad (double *wx, double *wy, double *wz, char ID)
int __SDK | dhdGetAngularVelocityDeg (double *wx, double *wy, double *wz, char ID)
int __SDK | dhdConfigGripperVelocity (int ms, int mode, char ID)
int __SDK | dhdGetGripperLinearVelocity (double *vg, char ID)
int __SDK | dhdGetGripperAngularVelocityRad (double *wg, char ID)
int __SDK | dhdGetGripperAngularVelocityDeg (double *wg, char ID)
int __SDK | dhdSetVibration (double freq, double amplitude, int type, char ID)
int __SDK | dhdSetMaxForce (double f, char ID)
int __SDK | dhdSetMaxTorque (double t, char ID)
int __SDK | dhdSetMaxGripperForce (double f, char ID)
int __SDK | dhdSetMaxUsablePowerRatio (double powerRatio, char ID)
double __SDK | dhdGetMaxUsablePowerRatio (char ID)
double __SDK | dhdGetMaxForce (char ID)
double __SDK | dhdGetMaxTorque (char ID)
double __SDK | dhdGetMaxGripperForce (char ID)
int __SDK | dhdEnableExpertMode ()
int __SDK | dhdDisableExpertMode ()
int __SDK | dhdEmulateButton (uchar val, char ID)
int __SDK | dhdCalibrateWrist (char ID)
int __SDK | dhdSetTimeGuard (int us, char ID)
int __SDK | dhdSetVelocityThreshold (uint val, char ID)
int __SDK | dhdGetVelocityThreshold (uint *val, char ID)
int __SDK | dhdUpdateEncoders (char ID)
int __SDK | dhdGetEncoder (int index, char ID)
int __SDK | dhdGetDeltaEncoders (int *enc0, int *enc1, int *enc2, char ID)
int __SDK | dhdGetWristEncoders (int *enc0, int *enc1, int *enc2, char ID)
int __SDK | dhdSetMotor (int index, ushort val, char ID)
int __SDK | dhdSetDeltaMotor (ushort mot0, ushort mot1, ushort mot2, char ID)
int __SDK | dhdSetJointTorques (double q[DHD_MAX_DOF], uchar mask, char ID)
int __SDK | dhdSetDeltaJointTorques (double q0, double q1, double q2, char ID)
int __SDK | dhdDeltaEncodersToJointAngles (int enc0, int enc1, int enc2, double *j0, double *j1, double *j2, char ID)
int __SDK | dhdDeltaJointAnglesToEncoders (double j0, double j1, double j2, int *enc0, int *enc1, int *enc2, char ID)
int __SDK | dhdGetWristJointAngles (double *j0, double *j1, double *j2, char ID)
int __SDK | dhdGetWristJacobian (double jacobian[3][3], char ID)
int __SDK | dhdWristJointAnglesToJacobian (double j0, double j1, double j2, double jcb[3][3], char ID)
int __SDK | dhdWristJointTorquesExtrema (double j0, double j1, double j2, double minq[3], double maxq[3], char ID)
int __SDK | dhdWristGravityJointTorques (double j0, double j1, double j2, double *q0, double *q1, double *q2, char ID)
int __SDK | dhdSetWristJointTorques (double q0, double q1, double q2, char ID)
int __SDK | dhdSetForceAndWristJointTorques (double fx, double fy, double fz, double q0, double q1, double q2, char ID)
int __SDK | dhdSetForceAndWristJointTorquesAndGripperForce (double fx, double fy, double fz, double q0, double q1, double q2, double fg, char ID)
int __SDK | dhdWristEncodersToJointAngles (int enc0, int enc1, int enc2, double *j0, double *j1, double *j2, char ID)
int __SDK | dhdWristJointAnglesToEncoders (double j0, double j1, double j2, int *enc0, int *enc1, int *enc2, char ID)
int __SDK | dhdSetWristMotor (ushort mot0, ushort mot1, ushort mot2, char ID)
int __SDK | dhdDeltaEncoderToPosition (int enc0, int enc1, int enc2, double *px, double *py, double *pz, char ID)
int __SDK | dhdDeltaPositionToEncoder (double px, double py, double pz, int *enc0, int *enc1, int *enc2, char ID)
int __SDK | dhdDeltaMotorToForce (ushort mot0, ushort mot1, ushort mot2, int enc0, int enc1, int enc2, double *fx, double *fy, double *fz, char ID)
int __SDK | dhdDeltaForceToMotor (double fx, double fy, double fz, int enc0, int enc1, int enc2, ushort *mot0, ushort *mot1, ushort *mot2, char ID)
int __SDK | dhdWristEncoderToOrientation (int enc0, int enc1, int enc2, double *oa, double *ob, double *og, char ID)
int __SDK | dhdWristOrientationToEncoder (double oa, double ob, double og, int *enc0, int *enc1, int *enc2, char ID)
int __SDK | dhdWristMotorToTorque (ushort mot0, ushort mot1, ushort mot2, int enc0, int enc1, int enc2, double *tx, double *ty, double *tz, char ID)
int __SDK | dhdWristTorqueToMotor (double tx, double ty, double tz, int enc0, int enc1, int enc2, ushort *mot0, ushort *mot1, ushort *mot2, char ID)
int __SDK | dhdEnableForce (uchar val, char ID)
int __SDK | dhdEnableGripperForce (uchar val, char ID)
int __SDK | dhdGetEnc (int enc[DHD_MAX_DOF], uchar mask, char ID)
int __SDK | dhdReadConfigFromFile (char *filename, char ID)
int __SDK | dhdSetMot (ushort mot[DHD_MAX_DOF], uchar mask, char ID)
int __SDK | dhdSetBrk (uchar mask, char ID)
int __SDK | dhdGetOrientationFrame (double matrix[3][3], char ID)
int __SDK | dhdGetGripperThumbPos (double *px, double *py, double *pz, char ID)
int __SDK | dhdGetGripperFingerPos (double *px, double *py, double *pz, char ID)
double __SDK | dhdGetComFreq (char ID)
int __SDK | dhdSetForceAndGripperForce (double fx, double fy, double fz, double fg, char ID)
int __SDK | dhdPreset (int val[DHD_MAX_DOF], uchar mask, char ID)
bool __SDK | dhdKbHit ()
char __SDK | dhdKbGet ()
void __SDK | dhdSleep (double sec)
int __SDK | dhdStartThread (void *func(void *), void *arg, int priority)
int __SDK | dhdGetGripperAngleRad (double *a, char ID)
int __SDK | dhdGetGripperAngleDeg (double *a, char ID)
int __SDK | dhdGetGripperGap (double *g, char ID)
int __SDK | dhdGripperEncoderToAngleRad (int enc, double *a, char ID)
int __SDK | dhdGripperEncoderToGap (int enc, double *gap, char ID)
int __SDK | dhdGripperAngleRadToEncoder (double a, int *enc, char ID)
int __SDK | dhdGripperGapToEncoder (double gap, int *enc, char ID)
int __SDK | dhdGripperMotorToForce (ushort mot, double *frc, int enc[4], char ID)
int __SDK | dhdGripperForceToMotor (double frc, ushort *mot, int enc[4], char ID)
int __SDK | dhdSetGripperMotor (ushort mot, char ID)
int __SDK | dhdGetGripperEncoder (int *enc, char ID)
int __SDK | dhdSetComMode (int mode, char ID)
int __SDK | dhdGetComMode (char ID)
int __SDK | dhdSetComModePriority (int priority, char ID)
int __SDK | dhdGetDeltaJointAngles (double *j0, double *j1, double *j2, char ID)
int __SDK | dhdDeltaJointAnglesToJacobian (double j0, double j1, double j2, double jcb[3][3], char ID)
int __SDK | dhdDeltaJointTorquesExtrema (double j0, double j1, double j2, double minq[3], double maxq[3], char ID)
int __SDK | dhdDeltaGravityJointTorques (double j0, double j1, double j2, double *q0, double *q1, double *q2, char ID)
int __SDK | dhdGetJointAngles (double j[DHD_MAX_DOF], char ID)
int __SDK | dhdGetJointVelocities (double v[DHD_MAX_DOF], char ID)
int __SDK | dhdGetEncVelocities (double v[DHD_MAX_DOF], char ID)
int __SDK | dhdGetMot (uint16_t motor[DHD_MAX_DOF], char ID)
int __SDK | dhdGetJointTorques (double q[DHD_MAX_DOF], char ID)
int __SDK | dhdGetGravityJointTorques (double q[DHD_MAX_DOF], char ID)
int __SDK | dhdJointAnglesToGravityJointTorques (double j[DHD_MAX_DOF], double q[DHD_MAX_DOF], uchar mask, char ID)
int __SDK | dhdGetJointTorquesRange (double qMin[DHD_MAX_DOF], double qMax[DHD_MAX_DOF], char ID)
int __SDK | dhdJointAnglesToEncoder (double j[DHD_MAX_DOF], int enc[DHD_MAX_DOF], char ID)
int __SDK | dhdJointAnglesToInertiaMatrix (double j[DHD_MAX_DOF], double inertia[6][6], char ID)
int __SDK | dhdSetWatchdog (uchar val, char ID)
int __SDK | dhdGetWatchdog (uchar *val, char ID)
int __SDK | dhdGetEncRange (int encMin[DHD_MAX_DOF], int encMax[DHD_MAX_DOF], char ID)
int __SDK | dhdGetJointAngleRange (double jmin[DHD_MAX_DOF], double jmax[DHD_MAX_DOF], char ID)
int __SDK | dhdPreloadMot (ushort mot[DHD_MAX_DOF], uchar mask, char ID)
void __SDK | dhdEnableSimulator (bool on)

## Detailed Description

Haptic SDK documentation.

## Function Documentation

## ◆ dhdCalibrateWrist()

int __SDK dhdCalibrateWrist | ( | char | ID | ) |

This function triggers the wrist calibration routine in the device controller.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Deprecated:
  This function is deprecated and is kept for backward compatibility only.

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdCheckControllerMemory()

int __SDK dhdCheckControllerMemory | ( | char | ID | ) |

This function evaluates the integrity of the device controller firmware and internal configuration on supported device types.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  DHD_NO_ERROR on success.
  DHD_ERROR_CONFIGURATION if the firmware or internal configuration health check failed.

## ◆ dhdClose()

int __SDK dhdClose | ( | char | ID | ) |

This function closes the connection to a particular device.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  constraints.cpp, encoders.cpp, gravity.cpp, jacobian.cpp, multithread.cpp, segment.cpp, sphere.cpp, torques.cpp, torus.cpp, and transformations.cpp.

## ◆ dhdConfigAngularVelocity()

int __SDK dhdConfigAngularVelocity | ( | int | ms,
|  | int | mode,
|  | char | ID
| ) |  |

This function configures the internal velocity computation estimator. This only applies to the device wrist.

Parameters

  ms | [default=DHD_VELOCITY_WINDOW] time interval used to compute velocity [ms]
  mode | [default=DHD_VELOCITY_WINDOWING] device ID (see velocity estimator modes section for details)
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  velocity estimator for details
  dhdGetAngularVelocityRad()
  dhdGetAngularVelocityDeg()

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdConfigGripperVelocity()

int __SDK dhdConfigGripperVelocity | ( | int | ms,
|  | int | mode,
|  | char | ID
| ) |  |

This function configures the internal velocity computation estimator. This only applies to the device gripper.

Parameters

  ms | [default=DHD_VELOCITY_WINDOW] time interval used to compute velocity [ms]
  mode | [default=DHD_VELOCITY_WINDOWING] device ID (see velocity estimator modes section for details)
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  velocity estimator for details
  dhdGetGripperLinearVelocity()
  dhdGetGripperAngularVelocityRad()
  dhdGetGripperAngularVelocityDeg()

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdConfigLinearVelocity()

int __SDK dhdConfigLinearVelocity | ( | int | ms,
|  | int | mode,
|  | char | ID
| ) |  |

This function configures the internal velocity computation estimator. This only applies to the device base.

Parameters

  ms | [default=DHD_VELOCITY_WINDOW] time interval used to compute velocity [ms]
  mode | [default=DHD_VELOCITY_WINDOWING] device ID (see velocity estimator modes section for details)
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdGetLinearVelocity() and velocity estimator for details

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdControllerSetDevice()

int __SDK dhdControllerSetDevice | ( | int | device,
|  | char | ID
| ) |  |

If the connected device is a controller, this function lets the programmer define the Force Dimension mechanical structure attached to it. Upon selecting a device model, the routine will attempt to read that particular device configuration from the controller. If this fails, a default configuration will be selected and stored in the controller.

Parameters

  device | the device type to use
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_CONTROLLER
  - DHD_DEVICE_CONTROLLER_HR

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdDeltaEncodersToJointAngles()

int __SDK dhdDeltaEncodersToJointAngles | ( | int | enc0,
|  | int | enc1,
|  | int | enc2,
|  | double * | j0,
|  | double * | j1,
|  | double * | j2,
|  | char | ID
| ) |  |

This function computes and returns the delta joint angles for a given set of encoder readings.

Parameters

  enc0 | DELTA encoder reading on axis 0
  enc1 | DELTA encoder reading on axis 1
  enc2 | DELTA encoder reading on axis 2
  j0 | [out] joint angle for axis 0 in [rad]
  j1 | [out] joint angle for axis 1 in [rad]
  j2 | [out] joint angle for axis 2 in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdDeltaEncoderToPosition()

int __SDK dhdDeltaEncoderToPosition | ( | int | enc0,
|  | int | enc1,
|  | int | enc2,
|  | double * | px,
|  | double * | py,
|  | double * | pz,
|  | char | ID
| ) |  |

This function computes and returns the position of the end-effector for a given set of encoder readings.

Parameters

  enc0 | DELTA encoder reading on axis 0
  enc1 | DELTA encoder reading on axis 1
  enc2 | DELTA encoder reading on axis 2
  px | [out] DELTA end-effector position on the X axis [m]
  py | [out] DELTA end-effector position on the Y axis [m]
  pz | [out] DELTA end-effector position on the Z axis [m]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdDeltaForceToMotor()

int __SDK dhdDeltaForceToMotor | ( | double | fx,
|  | double | fy,
|  | double | fz,
|  | int | enc0,
|  | int | enc1,
|  | int | enc2,
|  | ushort * | mot0,
|  | ushort * | mot1,
|  | ushort * | mot2,
|  | char | ID
| ) |  |

This function computes and returns the motor commands necessary to obtain a given force on the end-effector at a given position (defined by encoder readings).

Parameters

  fx | force on the DELTA end-effector on the X axis [N]
  fy | force on the DELTA end-effector on the Y axis [N]
  fz | force on the DELTA end-effector on the Z axis [N]
  enc0 | DELTA encoder reading on axis 0
  enc1 | DELTA encoder reading on axis 1
  enc2 | DELTA encoder reading on axis 2
  mot0 | [out] motor command on DELTA axis 0
  mot1 | [out] motor command on DELTA axis 1
  mot2 | [out] motor command on DELTA axis 2
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_MOTOR_SATURATED on success, -1 otherwise.
  See error management for details.

## ◆ dhdDeltaGravityJointTorques()

int __SDK dhdDeltaGravityJointTorques | ( | double | j0,
|  | double | j1,
|  | double | j2,
|  | double * | q0,
|  | double * | q1,
|  | double * | q2,
|  | char | ID
| ) |  |

This function computes the DELTA joint torques required to compensate for gravity in a given DELTA joint angle configuration. Please refer to your device user manual for more information on your device coordinate system. This function is deprecated, please use dhdJointAnglesToGravityJointTorques() instead.

Deprecated:
  This function is deprecated and is kept for backward compatibility only.

Parameters

  j0 | joint angle for axis 0 in [rad]
  j1 | joint angle for axis 1 in [rad]
  j2 | joint angle for axis 2 in [rad]
  q0 | [out] gravity compensation joint torque on axis 0 in [Nm]
  q1 | [out] gravity compensation joint torque on axis 1 in [Nm]
  q2 | [out] gravity compensation joint torque on axis 2 in [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdDeltaJointAnglesToEncoders()

int __SDK dhdDeltaJointAnglesToEncoders | ( | double | j0,
|  | double | j1,
|  | double | j2,
|  | int * | enc0,
|  | int * | enc1,
|  | int * | enc2,
|  | char | ID
| ) |  |

This function computes and returns the delta encoder readings for a given set of joint angles.

Parameters

  j0 | joint angle for axis 0 in [rad]
  j1 | joint angle for axis 1 in [rad]
  j2 | joint angle for axis 2 in [rad]
  enc0 | [out] DELTA encoder reading on axis 0
  enc1 | [out] DELTA encoder reading on axis 1
  enc2 | [out] DELTA encoder reading on axis 2
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdDeltaJointAnglesToJacobian()

int __SDK dhdDeltaJointAnglesToJacobian | ( | double | j0,
|  | double | j1,
|  | double | j2,
|  | double | jcb[3][3],
|  | char | ID
| ) |  |

This function retrieves the delta jacobian matrix based on a given joint configuration. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  j0 | joint angle for axis 0 in [rad]
  j1 | joint angle for axis 1 in [rad]
  j2 | joint angle for axis 2 in [rad]
  jcb | [out] device jacobian
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  jacobian.cpp.

## ◆ dhdDeltaJointTorquesExtrema()

int __SDK dhdDeltaJointTorquesExtrema | ( | double | j0,
|  | double | j1,
|  | double | j2,
|  | double | minq[3],
|  | double | maxq[3],
|  | char | ID
| ) |  |

This function computes the range of applicable DELTA joint torques for a given DELTA joint angle configuration. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  j0 | joint angle for axis 0 in [rad]
  j1 | joint angle for axis 1 in [rad]
  j2 | joint angle for axis 2 in [rad]
  minq | [out] array of minimum applicable joint torque in [Nm]
  maxq | [out] array of maximum applicable joint torque in [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdDeltaMotorToForce()

int __SDK dhdDeltaMotorToForce | ( | ushort | mot0,
|  | ushort | mot1,
|  | ushort | mot2,
|  | int | enc0,
|  | int | enc1,
|  | int | enc2,
|  | double * | fx,
|  | double * | fy,
|  | double * | fz,
|  | char | ID
| ) |  |

This function computes and returns the force applied to the end-effector for a given set of motor commands at a given position (defined by encoder readings).

Parameters

  mot0 | motor command on DELTA axis 0
  mot1 | motor command on DELTA axis 1
  mot2 | motor command on DELTA axis 2
  enc0 | DELTA encoder reading on axis 0
  enc1 | DELTA encoder reading on axis 1
  enc2 | DELTA encoder reading on axis 2
  fx | [out] force on the DELTA end-effector on the X axis [N]
  fy | [out] force on the DELTA end-effector on the Y axis [N]
  fz | [out] force on the DELTA end-effector on the Z axis [N]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for detail.

## ◆ dhdDeltaPositionToEncoder()

int __SDK dhdDeltaPositionToEncoder | ( | double | px,
|  | double | py,
|  | double | pz,
|  | int * | enc0,
|  | int * | enc1,
|  | int * | enc2,
|  | char | ID
| ) |  |

This function computes and returns the encoder values for a given end-effector position.

Parameters

  px | DELTA end-effector position on the X axis [m]
  py | DELTA end-effector position on the Y axis [m]
  pz | DELTA end-effector position on the Z axis [m]
  enc0 | [out] DELTA encoder reading on axis 0
  enc1 | [out] DELTA encoder reading on axis 1
  enc2 | [out] DELTA encoder reading on axis 2
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdDisableExpertMode()

int __SDK dhdDisableExpertMode | ( |  | ) |

This function disables the expert mode.

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdEmulateButton()

int __SDK dhdEmulateButton | ( | uchar | val,
|  | char | ID
| ) |  |

This function enables the button behavior emulation in devices that feature a gripper.

Parameters

  val | DHD_ON to emulate button behavior, DHD_OFF to disable it
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT
  For omega.7 devices with firmware versions 2.x, forces need to be enabled for the button emulation to report the emulated button status.

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  constraints.cpp, hold.cpp, jacobian.cpp, segment.cpp, teleoperation.cpp, torus.cpp, and transformations.cpp.

## ◆ dhdEnableExpertMode()

int __SDK dhdEnableExpertMode | ( |  | ) |

This function enables the expert mode.

Note
  READ USER/PROGRAMMING MANUALS FIRST
  USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  encoders.cpp, hold.cpp, and jacobian.cpp.

## ◆ dhdEnableForce()

int __SDK dhdEnableForce | ( | uchar | val,
|  | char | ID
| ) |  |

This function enables the force mode in the device controller.

Parameters

  val | DHD_ON to enable force, DHD_OFF to disable it
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  constraints.cpp, encoders.cpp, gravity.cpp, jacobian.cpp, multithread.cpp, segment.cpp, sphere.cpp, teleoperation.cpp, torques.cpp, torus.cpp, and transformations.cpp.

## ◆ dhdEnableGripperForce()

int __SDK dhdEnableGripperForce | ( | uchar | val,
|  | char | ID
| ) |  |

This function enables the gripper force mode in the device controller. This function is only relevant to devices that have a gripper with a default closed or opened state. It does not apply to the sigma.x and omega.x range of devices, whose gripper does not have a default state. For those devices, the gripper force is enabled/disabled by dhdEnableForce().

Note
  Forces must already have been enabled on the device (by calling dhdEnableForce(DHD_ON)) for dhdEnableGripperForce() to have any effect.

Parameters

  val | DHD_ON to enable gripper force, DHD_OFF to disable it
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdEnableSimulator()

void __SDK dhdEnableSimulator | ( | bool | on | ) |

This function enables the device simulator support. This enables network access on the loopback interface.

Parameters

  on | true to enable, false to disable

## ◆ dhdGetAngularVelocityDeg()

int __SDK dhdGetAngularVelocityDeg | ( | double * | wx,
|  | double * | wy,
|  | double * | wz,
|  | char | ID
| ) |  |

This function retrieves the estimated instantaneous angular velocity in [deg/s]. Velocity computation can be configured by calling dhdConfigAngularVelocity(). By default DHD_VELOCITY_WINDOW and DHD_VELOCITY_WINDOWING are used. See velocity estimator for details.

Parameters

  wx | [out] angular velocity around the X axis [deg/s]
  wy | [out] angular velocity around the Y axis [deg/s]
  wz | [out] angular velocity around the Z axis [deg/s]
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdConfigAngularVelocity() and velocity estimator for details
  dhdGetAngularVelocityRad()

Note
  Please note that the velocity estimator requires at least 2 position updates during the time interval defined in dhdConfigAngularVelocity() in order to be able to compute the estimate. Otherwise, e.g. if there are no calls to dhdGetPosition() or dhdGetAngularVelocityDeg() within the time interval window, dhdGetAngularVelocityDeg() will return an error (DHD_ERROR_TIMEOUT).

Returns
  0 on success, -1 on failure.
  See error management for details.

## ◆ dhdGetAngularVelocityRad()

int __SDK dhdGetAngularVelocityRad | ( | double * | wx,
|  | double * | wy,
|  | double * | wz,
|  | char | ID
| ) |  |

This function retrieves the estimated instantaneous angular velocity in [rad/s]. Velocity computation can be configured by calling dhdConfigAngularVelocity(). By default DHD_VELOCITY_WINDOW and DHD_VELOCITY_WINDOWING are used. See velocity estimator for details.

Parameters

  wx | [out] angular velocity around the X axis [rad/s]
  wy | [out] angular velocity around the Y axis [rad/s]
  wz | [out] angular velocity around the Z axis [rad/s]
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdConfigAngularVelocity() and velocity estimator for details
  dhdGetAngularVelocityDeg()

Note
  Please note that the velocity estimator requires at least 2 position updates during the time interval defined in dhdConfigAngularVelocity() in order to be able to compute the estimate. Otherwise, e.g. if there are no calls to dhdGetPosition() or dhdGetAngularVelocityRad() within the time interval window, dhdGetAngularVelocityRad() will return an error (DHD_ERROR_TIMEOUT).

Returns
  0 on success, -1 on failure.
  See error management for details.

Examples
  constraints.cpp, jacobian.cpp, teleoperation.cpp, and transformations.cpp.

## ◆ dhdGetAvailableCount()

int __SDK dhdGetAvailableCount | ( |  | ) |

This function returns the number of available Force Dimension devices connected to the system. This encompasses all devices connected locally, but excludes devices already locked by other applications. Devices are given a unique identifier, as explained in the multiple devices section.

See also
  dhdGetDeviceCount()

Returns
  the number of devices available on success, -1 otherwise.
  See error management for details.

Examples
  torus.cpp.

## ◆ dhdGetBaseAngleXDeg()

int __SDK dhdGetBaseAngleXDeg | ( | double * | angle,
|  | char | ID
| ) |  |

This function retrieves the device base plate angle around the X axis.

Parameters

  angle | [out] a pointer to a valid `double` to receive the device angle in [deg]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdGetBaseAngleXRad()

## ◆ dhdGetBaseAngleXRad()

int __SDK dhdGetBaseAngleXRad | ( | double * | angle,
|  | char | ID
| ) |  |

This function retrieves the device base plate angle around the X axis.

Parameters

  angle | [out] a pointer to a valid `double` to receive the device angle in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdGetBaseAngleXDeg()

## ◆ dhdGetBaseAngleZDeg()

int __SDK dhdGetBaseAngleZDeg | ( | double * | angle,
|  | char | ID
| ) |  |

This function retrieves the device base plate angle around the vertical Z axis.

Parameters

  angle | [out] a pointer to a valid `double` to receive the device angle in [deg]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdGetBaseAngleZRad()

## ◆ dhdGetBaseAngleZRad()

int __SDK dhdGetBaseAngleZRad | ( | double * | angle,
|  | char | ID
| ) |  |

This function retrieves the device base plate angle around the vertical Z axis.

Parameters

  angle | [out] a pointer to a valid `double` to receive the device angle in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdGetBaseAngleZDeg()

## ◆ dhdGetButton()

int __SDK dhdGetButton | ( | int | index,
|  | char | ID
| ) |  |

This function returns the status of the button located on the end-effector.

Parameters

  index | Button index, 0 for the gripper button (up to DHD_MAX_BUTTONS)
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  DHD_ON if the button is pressed, DHD_OFF otherwise, or -1 on error.
  See error management for details.

Examples
  hold.cpp, segment.cpp, teleoperation.cpp, and torus.cpp.

## ◆ dhdGetButtonMask()

unsigned int __SDK dhdGetButtonMask | ( | char | ID | ) |

This function returns the 32-bit binary mask of the device buttons.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  A 32-bit long bitmask. Each bit is set to 1 if the button is pressed, 0 otherwise.

Examples
  constraints.cpp, and transformations.cpp.

## ◆ dhdGetComFreq()

double __SDK dhdGetComFreq | ( | char | ID | ) |

This function returns the communication refresh rate between the computer and the device. Refresh rate computation is based on function calls that apply a force on the device (e.g. dhdSetForce()).

Note
  The refresh rate counters are reset every time the function is called. Therefore, it is recommended to call this function periodically (typically every second) in order to avoid discretization errors.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  the refresh rate in [kHz], 0.0 otherwise.

Examples
  constraints.cpp, gravity.cpp, jacobian.cpp, sphere.cpp, torques.cpp, torus.cpp, and transformations.cpp.

## ◆ dhdGetComMode()

int __SDK dhdGetComMode | ( | char | ID | ) |

This function retrieves the COM operation mode on compatible devices.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  the current COM operation mode on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetComponentVersionStr()

int __SDK dhdGetComponentVersionStr | ( | uint32_t | component,
|  | char * | buffer,
|  | size_t | size,
|  | char | ID
| ) |  |

This function returns a string that describes an internal component version (if present).

Parameters

  component | Component ID provided by Force Dimension (device-specific).
  buffer | A user-allocated buffer to receive the component version string.
  size | The size of the user-allocated version string buffer.
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  The version string on success, an empty string otherwise.

## ◆ dhdGetDeltaEncoders()

int __SDK dhdGetDeltaEncoders | ( | int * | enc0,
|  | int * | enc1,
|  | int * | enc2,
|  | char | ID
| ) |  |

This function reads all encoders values of the DELTA structure.

Parameters

  enc0 | [out] DELTA axis 0 encoder reading
  enc1 | [out] DELTA axis 1 encoder reading
  enc2 | [out] DELTA axis 2 encoder reading
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetDeltaJacobian()

int __SDK dhdGetDeltaJacobian | ( | double | jacobian[3][3],
|  | char | ID
| ) |  |

This function retrieves the jacobian matrix based on the current end-effector position. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  jacobian | [out] device jacobian
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetDeltaJointAngles()

int __SDK dhdGetDeltaJointAngles | ( | double * | j0,
|  | double * | j1,
|  | double * | j2,
|  | char | ID
| ) |  |

This function retrieves the joint angles in [rad] for the DELTA structure.

Parameters

  j0 | [out] joint angle for axis 0 in [rad]
  j1 | [out] joint angle for axis 1 in [rad]
  j2 | [out] joint angle for axis 2 in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetDeviceAngleDeg()

int __SDK dhdGetDeviceAngleDeg | ( | double * | angle,
|  | char | ID
| ) |  |

This function retrieves the device base plate angle around the Y axis.

Parameters

  angle | [out] a pointer to a valid `double` to receive the device angle in [deg]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdGetDeviceAngleRad()

## ◆ dhdGetDeviceAngleRad()

int __SDK dhdGetDeviceAngleRad | ( | double * | angle,
|  | char | ID
| ) |  |

This function retrieves the device base plate angle around the Y axis.

Parameters

  angle | [out] a pointer to a valid `double` to receive the device angle in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdGetDeviceAngleDeg()

## ◆ dhdGetDeviceCount()

int __SDK dhdGetDeviceCount | ( |  | ) |

This function returns the number of compatible Force Dimension devices connected to the system. This encompasses all devices connected locally, including devices already locked by other applications. Devices are given a unique identifier, as explained in the multiple devices section.

See also
  dhdGetAvailableCount()

Returns
  the number of devices connected on success, -1 otherwise.
  See error management for details.

Examples
  multithread.cpp.

## ◆ dhdGetDeviceID()

int __SDK dhdGetDeviceID | ( |  | ) |

This function returns the ID of the current default device.

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetDeviceTime()

double __SDK dhdGetDeviceTime | ( | char | ID | ) |

This function returns the current value of the time measured by the device.

Returns
  The current time in [s].

## ◆ dhdGetEffectorMass()

int __SDK dhdGetEffectorMass | ( | double * | mass,
|  | char | ID
| ) |  |

This function retrieves the mass of the end-effector currently defined for a device. The gripper mass is used in the gravity compensation feature.

Parameters

  mass | a pointer to the actual end-effector mass in [kg]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetEnc()

int __SDK dhdGetEnc | ( | int | enc[DHD_MAX_DOF],
|  | uchar | mask,
|  | char | ID
| ) |  |

This function retrieves encoder values into encoder array. It is particularly useful when using the the generic controller directly, without a device model attached.

Parameters

  enc | [out] encoder values array
  mask | [default=0xff] bitwise mask of which encoders should be read in
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  encoders.cpp.

## ◆ dhdGetEncoder()

int __SDK dhdGetEncoder | ( | int | index,
|  | char | ID
| ) |  |

This function reads a single encoder value from the haptic device.

Parameters

  index | the encoder index number as defined by DHD_MAX_DOF
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  the (positive) encoder reading on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetEncRange()

int __SDK dhdGetEncRange | ( | int | encMin[DHD_MAX_DOF],
|  | int | encMax[DHD_MAX_DOF],
|  | char | ID
| ) |  |

This function retrieves the expected min and max encoder values for all axis present on the current device. Axis indices that do not exist on the device will return a range of 0.

Parameters

  encMin | [out] minimum encoder values array
  encMax | [out] maximum encoder values array
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetEncVelocities()

int __SDK dhdGetEncVelocities | ( | double | v[DHD_MAX_DOF],
|  | char | ID
| ) |  |

This function retrieves the encoder angle velocities in [increments/s] for all sensed degrees-of-freedom of the current device.

Parameters

  v | [out] array of joint angle velocities in [rad/s]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetForce()

int __SDK dhdGetForce | ( | double * | fx,
|  | double * | fy,
|  | double * | fz,
|  | char | ID
| ) |  |

This function retrieves the force vector applied to the end-effector.

Parameters

  fx | [out] force on the X axis in [N]
  fy | [out] force on the Y axis in [N]
  fz | [out] force on the Z axis in [N]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  gravity.cpp.

## ◆ dhdGetForceAndTorque()

int __SDK dhdGetForceAndTorque | ( | double * | fx,
|  | double * | fy,
|  | double * | fz,
|  | double * | tx,
|  | double * | ty,
|  | double * | tz,
|  | char | ID
| ) |  |

This function retrieves the force and torque vectors applied to the device end-effector.

Parameters

  fx | [out] force on the X axis in [N]
  fy | [out] force on the Y axis in [N]
  fz | [out] force on the Z axis in [N]
  tx | [out] torque around the X axis in [Nm]
  ty | [out] torque around the Y axis in [Nm]
  tz | [out] torque around the Z axis in [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  jacobian.cpp.

## ◆ dhdGetForceAndTorqueAndGripperForce()

int __SDK dhdGetForceAndTorqueAndGripperForce | ( | double * | fx,
|  | double * | fy,
|  | double * | fz,
|  | double * | tx,
|  | double * | ty,
|  | double * | tz,
|  | double * | f,
|  | char | ID
| ) |  |

This function retrieves the force and torque vectors applied to the device end-effector, as well as the force applied to the gripper.

Parameters

  fx | [out] force on the X axis in [N]
  fy | [out] force on the Y axis in [N]
  fz | [out] force on the Z axis in [N]
  tx | [out] torque around the X axis in [Nm]
  ty | [out] torque around the Y axis in [Nm]
  tz | [out] torque around the Z axis in [Nm]
  f | [out] force on the gripper in [N]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetGravityJointTorques()

int __SDK dhdGetGravityJointTorques | ( | double | q[DHD_MAX_DOF],
|  | char | ID
| ) |  |

This function retrieves the joint torques in [Nm] required to provide gravity compensation on all actuated degrees-of-freedom of the current device.

Parameters

  q | [out] array of gravity compensation joint torques in [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetGripperAngleDeg()

int __SDK dhdGetGripperAngleDeg | ( | double * | a,
|  | char | ID
| ) |  |

This function retrieves the gripper opening angle in degrees.

Parameters

  a | [out] gripper opening [deg]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  constraints.cpp, and transformations.cpp.

## ◆ dhdGetGripperAngleRad()

int __SDK dhdGetGripperAngleRad | ( | double * | a,
|  | char | ID
| ) |  |

This function retrieves the gripper opening angle in radians.

Parameters

  a | [out] gripper opening [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetGripperAngularVelocityDeg()

int __SDK dhdGetGripperAngularVelocityDeg | ( | double * | wg,
|  | char | ID
| ) |  |

This function retrieves the estimated instantaneous angular velocity of the gripper in [deg/s]. Velocity computation can be configured by calling dhdConfigGripperVelocity(). By default DHD_VELOCITY_WINDOW and DHD_VELOCITY_WINDOWING are used. See velocity estimator for details.

Parameters

  wg | [out] gripper angular velocity [deg/s]
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdConfigGripperVelocity() and velocity estimator for details
  dhdGetGripperLinearVelocity()
  dhdGetGripperAngularVelocityRad()

Note
  Please note that the velocity estimator requires at least 2 position updates during the time interval defined in dhdConfigGripperVelocity() in order to be able to compute the estimate. Otherwise, e.g. if there are no calls to dhdGetPosition() or dhdGetGripperAngularVelocityDeg() within the time interval window, dhdGetGripperAngularVelocityDeg() will return an error (DHD_ERROR_TIMEOUT).

Returns
  0 on success, -1 on failure.
  See error management for details.

## ◆ dhdGetGripperAngularVelocityRad()

int __SDK dhdGetGripperAngularVelocityRad | ( | double * | wg,
|  | char | ID
| ) |  |

This function retrieves the estimated instantaneous angular velocity of the gripper in [rad/s]. Velocity computation can be configured by calling dhdConfigGripperVelocity(). By default DHD_VELOCITY_WINDOW and DHD_VELOCITY_WINDOWING are used. See velocity estimator for details.

Parameters

  wg | [out] gripper angular velocity [rad/s]
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdConfigGripperVelocity() and velocity estimator for details
  dhdGetGripperLinearVelocity()
  dhdGetGripperAngularVelocityDeg()

Note
  Please note that the velocity estimator requires at least 2 position updates during the time interval defined in dhdConfigGripperVelocity() in order to be able to compute the estimate. Otherwise, e.g. if there are no calls to dhdGetPosition() or dhdGetGripperAngularVelocityRad() within the time interval window, dhdGetGripperAngularVelocityRad() will return an error (DHD_ERROR_TIMEOUT).

Returns
  0 on success, -1 on failure.
  See error management for details.

## ◆ dhdGetGripperEncoder()

int __SDK dhdGetGripperEncoder | ( | int * | enc,
|  | char | ID
| ) |  |

This function retrieves the encoder value of the force gripper.

Parameters

  enc | [out] gripper encoder reading
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetGripperFingerPos()

int __SDK dhdGetGripperFingerPos | ( | double * | px,
|  | double * | py,
|  | double * | pz,
|  | char | ID
| ) |  |

This function retrieves the position in Cartesian coordinates of forefinger rest location of the force gripper structure if present.

Parameters

  px | [out] gripper finger X coord
  py | [out] gripper finger Y coord
  pz | [out] gripper finger Z coord
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  sphere.cpp, and torus.cpp.

## ◆ dhdGetGripperGap()

int __SDK dhdGetGripperGap | ( | double * | g,
|  | char | ID
| ) |  |

This function retrieves the gripper opening distance in meters.

Parameters

  g | [out] gripper opening [m]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  hold.cpp.

## ◆ dhdGetGripperLinearVelocity()

int __SDK dhdGetGripperLinearVelocity | ( | double * | vg,
|  | char | ID
| ) |  |

This function retrieves the estimated instantaneous linear velocity of the gripper in [m/s]. Velocity computation can be configured by calling dhdConfigGripperVelocity(). By default DHD_VELOCITY_WINDOW and DHD_VELOCITY_WINDOWING are used. See velocity estimator for details.

Parameters

  vg | [out] gripper linear velocity [m/s]
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdConfigGripperVelocity() and velocity estimator for details
  dhdGetGripperAngularVelocityRad()
  dhdGetGripperAngularVelocityDeg()

Note
  Please note that the velocity estimator requires at least 2 position updates during the time interval defined in dhdConfigGripperVelocity() in order to be able to compute the estimate. Otherwise, e.g. if there are no calls to dhdGetPosition() or dhdGetGripperLinearVelocity() within the time interval window, dhdGetGripperLinearVelocity() will return an error (DHD_ERROR_TIMEOUT).

Returns
  0 on success, -1 on failure.
  See error management for details.

Examples
  hold.cpp.

## ◆ dhdGetGripperThumbPos()

int __SDK dhdGetGripperThumbPos | ( | double * | px,
|  | double * | py,
|  | double * | pz,
|  | char | ID
| ) |  |

This function retrieves the position in Cartesian coordinates of thumb rest location of the force gripper structure if present.

Parameters

  px | [out] gripper thumb X coord
  py | [out] gripper thumb Y coord
  pz | [out] gripper thumb Z coord
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  sphere.cpp, and torus.cpp.

## ◆ dhdGetJointAngleRange()

int __SDK dhdGetJointAngleRange | ( | double | jmin[DHD_MAX_DOF],
|  | double | jmax[DHD_MAX_DOF],
|  | char | ID
| ) |  |

This function retrieves the expected min and max joint angles in [rad] for all sensed degrees-of-freedom on the current device. Axis indices that do not exist on the device will return a range of 0.0.

Parameters

  jmin | [out] array of min joint angles in [rad]
  jmax | [out] array of max joint angles in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetJointAngles()

int __SDK dhdGetJointAngles | ( | double | j[DHD_MAX_DOF],
|  | char | ID
| ) |  |

This function retrieves the joint angles in [rad] for all sensed degrees-of-freedom of the current device.

Parameters

  j | [out] array of joint angles in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  jacobian.cpp.

## ◆ dhdGetJointTorques()

int __SDK dhdGetJointTorques | ( | double | q[DHD_MAX_DOF],
|  | char | ID
| ) |  |

This function retrieves the joint torques in [Nm] for all actuated degrees-of-freedom of the current device.

Parameters

  q | [out] array of joint torques in [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetJointTorquesRange()

int __SDK dhdGetJointTorquesRange | ( | double | qMin[DHD_MAX_DOF],
|  | double | qMax[DHD_MAX_DOF],
|  | char | ID
| ) |  |

This function retrieves the range of joint torques in [Nm] available at the current joint configuration on all actuated degrees-of-freedom of the current device.

Parameters

  qMin | [out] array of min available joint torques in [Nm]
  qMax | [out] array of max available joint torques in [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetJointVelocities()

int __SDK dhdGetJointVelocities | ( | double | v[DHD_MAX_DOF],
|  | char | ID
| ) |  |

This function retrieves the joint angle velocities in [rad/s] for all sensed degrees-of-freedom of the current device.

Parameters

  v | [out] array of joint angle velocities in [rad/s]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  hold.cpp.

## ◆ dhdGetLinearVelocity()

int __SDK dhdGetLinearVelocity | ( | double * | vx,
|  | double * | vy,
|  | double * | vz,
|  | char | ID
| ) |  |

This function retrieves the estimated instantaneous translational velocity. Velocity computation can be configured by calling dhdConfigLinearVelocity(). By default DHD_VELOCITY_WINDOW and DHD_VELOCITY_WINDOWING are used. See velocity estimator for details.

Parameters

  vx | [out] velocity along the X axis [m/s]
  vy | [out] velocity along the Y axis [m/s]
  vz | [out] velocity along the Z axis [m/s]
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdConfigLinearVelocity() and velocity estimator for details

Note
  Please note that the velocity estimator requires at least 2 position updates during the time interval defined in dhdConfigLinearVelocity() in order to be able to compute the estimate. Otherwise, e.g. if there are no calls to dhdGetPosition() or dhdGetLinearVelocity() within the time interval window, dhdGetLinearVelocity() will return an error (DHD_ERROR_TIMEOUT).

Returns
  0 on success, -1 on failure.
  See error management for details.

Examples
  constraints.cpp, hold.cpp, jacobian.cpp, segment.cpp, teleoperation.cpp, and transformations.cpp.

## ◆ dhdGetMaxForce()

double __SDK dhdGetMaxForce | ( | char | ID | ) |

This function retrieves the current limit (in N) to the force magnitude that can be applied by the haptic device. If the return value is negative, the limit is disabled and the full range of force available can be applied.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdSetMaxForce()
  dhdGetMaxTorque()
  dhdGetMaxGripperForce()
  dhdGetMaxPower()
  dhdGetMaxUsablePower()

Returns
  The current force limit (in N) if set, -1.0 if no limit is enforced.

## ◆ dhdGetMaxGripperForce()

double __SDK dhdGetMaxGripperForce | ( | char | ID | ) |

This function retrieves the current limit (in N) to the force magnitude that can be applied by the haptic device gripper. If the return value is negative, the limit is disabled and the full range of gripper force available can be applied.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdSetMaxGripperForce()
  dhdGetMaxForce()
  dhdGetMaxTorque()
  dhdGetMaxPower()
  dhdGetMaxUsablePower()

Returns
  The current gripper force limit (in N) if set, -1.0 if no limit is enforced.

## ◆ dhdGetMaxTorque()

double __SDK dhdGetMaxTorque | ( | char | ID | ) |

This function retrieves the current limit (in Nm) to the torque magnitude that can be applied by the haptic device. If the return value is negative, the limit is disabled and the full range of torque available can be applied.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdSetMaxTorque()
  dhdGetMaxForce()
  dhdGetMaxGripperForce()
  dhdGetMaxPower()
  dhdGetMaxUsablePower()

Returns
  The current torque limit (in Nm) if set, -1.0 if no limit is enforced.

## ◆ dhdGetMaxUsablePowerRatio()

double __SDK dhdGetMaxUsablePowerRatio | ( | char | ID | ) |

This function retrieves the usable power limit that can is currently enforced on the device. The usable power is defined as the power used for force/torque feedback independently of (that is, on top of) the power required to maintain gravity compensation.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  The current power ratio enforced on the device.

## ◆ dhdGetMot()

int __SDK dhdGetMot | ( | uint16_t | motor[DHD_MAX_DOF],
|  | char | ID
| ) |  |

This function retrieves the motor DAC value in [dac] units for all actuated degrees-of-freedom of the current device.

Parameters

  motor | [out] array of motor DAC values in [dac]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetOrientationDeg()

int __SDK dhdGetOrientationDeg | ( | double * | oa,
|  | double * | ob,
|  | double * | og,
|  | char | ID
| ) |  |

For devices with a wrist structure, This function retrieves individual angle of each joint, starting with the one located nearest to the wrist base plate. For the DHD_DEVICE_OMEGA6_RIGHT and DHD_DEVICE_OMEGA6_LEFT devices, angles are computed with respect to their internal reference frame, which is rotated 45 degrees around the Y axis. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  oa | [out] device orientation around the first wrist joint in [deg]
  ob | [out] device orientation around the second wrist joint in [deg]
  og | [out] device orientation around the third wrist joint in [deg]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA6_RIGHT
  - DHD_DEVICE_OMEGA6_LEFT
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA6_RIGHT
  - DHD_DEVICE_LAMBDA6_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

See also
  dhdGetOrientationRad()

## ◆ dhdGetOrientationFrame()

int __SDK dhdGetOrientationFrame | ( | double | matrix[3][3],
|  | char | ID
| ) |  |

This function retrieves the rotation matrix of the wrist structure. The identity matrix is returned for devices that do not support orientations.

Parameters

  matrix | [out] orientation matrix frame
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  sphere.cpp, torques.cpp, and torus.cpp.

## ◆ dhdGetOrientationRad()

int __SDK dhdGetOrientationRad | ( | double * | oa,
|  | double * | ob,
|  | double * | og,
|  | char | ID
| ) |  |

For devices with a wrist structure, this function retrieves individual angle of each joint, starting with the one located nearest to the wrist base plate. For the DHD_DEVICE_OMEGA6_RIGHT and DHD_DEVICE_OMEGA6_LEFT devices, angles are computed with respect to their internal reference frame, which is rotated 45 degrees around the Y axis. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  oa | [out] device orientation around the first wrist joint in [rad]
  ob | [out] device orientation around the second wrist joint in [rad]
  og | [out] device orientation around the third wrist joint in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA6_RIGHT
  - DHD_DEVICE_OMEGA6_LEFT
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA6_RIGHT
  - DHD_DEVICE_LAMBDA6_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

See also
  dhdGetOrientationDeg()

## ◆ dhdGetPosition()

int __SDK dhdGetPosition | ( | double * | px,
|  | double * | py,
|  | double * | pz,
|  | char | ID
| ) |  |

This function retrieves the position of the end-effector in Cartesian coordinates. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  px | [out] device position on the X axis in [m]
  py | [out] device position on the Y axis in [m]
  pz | [out] device position on the Z axis in [m]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  gravity.cpp, segment.cpp, sphere.cpp, torques.cpp, and torus.cpp.

## ◆ dhdGetPositionAndOrientationDeg()

int __SDK dhdGetPositionAndOrientationDeg | ( | double * | px,
|  | double * | py,
|  | double * | pz,
|  | double * | oa,
|  | double * | ob,
|  | double * | og,
|  | char | ID
| ) |  |

This function retrieves the position and orientation of the end-effector in Cartesian coordinates. For devices with a wrist structure, the orientation is expressed as the individual angle of each joint, starting with the one located nearest to the wrist base plate. For the DHD_DEVICE_OMEGA6_RIGHT and DHD_DEVICE_OMEGA6_LEFT devices, angles are computed with respect to their internal reference frame, which is rotated 45 degrees around the Y axis. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  px | [out] device position on the X axis in [m]
  py | [out] device position on the Y axis in [m]
  pz | [out] device position on the Z axis in [m]
  oa | [out] device orientation around the first wrist joint in [deg]
  ob | [out] device orientation around the second wrist joint in [deg]
  og | [out] device orientation around the thrid wrist joint in [deg]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  hold.cpp.

## ◆ dhdGetPositionAndOrientationFrame()

int __SDK dhdGetPositionAndOrientationFrame | ( | double * | px,
|  | double * | py,
|  | double * | pz,
|  | double | matrix[3][3],
|  | char | ID
| ) |  |

This function retrieves the position and orientation matrix of the end-effector in Cartesian coordinates. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  px | [out] device position on the X axis in [m]
  py | [out] device position on the Y axis in [m]
  pz | [out] device position on the Z axis in [m]
  matrix | [out] orientation matrix frame
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  constraints.cpp, jacobian.cpp, teleoperation.cpp, torques.cpp, and transformations.cpp.

## ◆ dhdGetPositionAndOrientationRad()

int __SDK dhdGetPositionAndOrientationRad | ( | double * | px,
|  | double * | py,
|  | double * | pz,
|  | double * | oa,
|  | double * | ob,
|  | double * | og,
|  | char | ID
| ) |  |

This function retrieves the position and orientation of the end-effector in Cartesian coordinates. For devices with a wrist structure, the orientation is expressed as the individual angle of each joint, starting with the one located nearest to the wrist base plate. For the DHD_DEVICE_OMEGA6_RIGHT and DHD_DEVICE_OMEGA6_LEFT devices, angles are computed with respect to their internal reference frame, which is rotated 45 degrees around the Y axis. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  px | [out] device position on the X axis in [m]
  py | [out] device position on the Y axis in [m]
  pz | [out] device position on the Z axis in [m]
  oa | [out] device orientation around the first wrist joint in [rad]
  ob | [out] device orientation around the second wrist joint in [rad]
  og | [out] device orientation around the third wrist joint in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetSDKVersion()

void __SDK dhdGetSDKVersion | ( | int * | major,
|  | int * | minor,
|  | int * | release,
|  | int * | revision
| ) |  |

This function returns the SDK complete set of version numbers.

Parameters

  major | major version number
  minor | minor version number
  release | release number
  revision | revision number

See also
  dhdGetSDKVersionStr()

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetSDKVersionStr()

const char *__SDK dhdGetSDKVersionStr | ( |  | ) |

This function returns a string that fully describes the SDK version.

Returns
  The version string on success, an empty string otherwise.

Examples
  constraints.cpp, encoders.cpp, gravity.cpp, hold.cpp, jacobian.cpp, multithread.cpp, segment.cpp, sphere.cpp, teleoperation.cpp, torques.cpp, torus.cpp, and transformations.cpp.

## ◆ dhdGetSerialNumber()

int __SDK dhdGetSerialNumber | ( | ushort * | sn,
|  | char | ID
| ) |  |

This function returns the device serial number.

Parameters

  sn | [out] a pointer to a valid `unsigned` `char` to receive the device serial number
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  multithread.cpp, and teleoperation.cpp.

## ◆ dhdGetStatus()

int __SDK dhdGetStatus | ( | int | status[DHD_MAX_STATUS],
|  | char | ID
| ) |  |

This function returns the status vector of the haptic device. The status is described in the status section.

Parameters

  status | [out] an array that will receive the status vector
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetSystemCounter()

ulong __SDK dhdGetSystemCounter | ( |  | ) |

This function returns a timestamp computed from the high-resolution system counter, expressed in microseconds. This function is deprecated, please use dhdGetTime() instead.

Deprecated:
  This function is deprecated and is kept for backward compatibility only.

Returns
  A timestamp in [us].

See also
  See dhdGetTime()

## ◆ dhdGetSystemName()

const char *__SDK dhdGetSystemName | ( | char | ID | ) |

This function returns the haptic device type. As this SDK can be used to control all of Force Dimension haptic products, this can help programmers ensure that their application is running on the appropriate target haptic device.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  The device type string on success, NULL otherwise.
  See error management for details.

Examples
  constraints.cpp, encoders.cpp, gravity.cpp, hold.cpp, jacobian.cpp, multithread.cpp, segment.cpp, sphere.cpp, teleoperation.cpp, torques.cpp, and torus.cpp.

## ◆ dhdGetSystemRev()

int __SDK dhdGetSystemRev | ( | char | ID | ) |

This function returns the revision associated with this instance of haptic device type. As this SDK can be used to control all of Force Dimension haptic products, this can help programmers ensure that their application is running on the appropriate target haptic device.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  The device type revision on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetSystemType()

int __SDK dhdGetSystemType | ( | char | ID | ) |

This function returns the haptic device type. As this SDK can be used to control all of Force Dimension haptic products, this can help programmers ensure that their application is running on the appropriate target haptic device.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  The device type on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetTime()

double __SDK dhdGetTime | ( |  | ) |

This function returns the current value from the high-resolution system counter in [s]. The resolution of the system counter may be machine-dependent, as it is usually derived from one of the CPU clocks signals. The time returned is guaranteed to be monotonic.

Note
  On QNX platforms, the time granularity is defined by the system tick resolution. Please take a look at QNX ClockPeriod() documentation for details.

Returns
  The current time in [s].

Examples
  constraints.cpp, encoders.cpp, gravity.cpp, hold.cpp, jacobian.cpp, sphere.cpp, torques.cpp, torus.cpp, and transformations.cpp.

## ◆ dhdGetVelocityThreshold()

int __SDK dhdGetVelocityThreshold | ( | uint * | val,
|  | char | ID
| ) |  |

This function retrieves the current velocity threshold of the device. Velocity threshold is a safety feature that prevents the device from accelerating to high velocities without control. If the velocity of one of the device axis passes the threshold, the device enters BRAKES mode.

Parameters

  val | an arbitrary value of velocity threshold the range of threshold values is device dependent, it is recommended NOT to modify factory settings
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetVersion()

int __SDK dhdGetVersion | ( | double * | ver,
|  | char | ID
| ) |  |

This function returns the device controller version. As this SDK can be used to control all of Force Dimension haptic products, this can help programmers ensure that their application is running on the appropriate version of the haptic controller.

Parameters

  ver | [out] pointer to a variable that will receive the controller release version number
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetVersionStr()

int __SDK dhdGetVersionStr | ( | char * | buffer,
|  | size_t | size,
|  | char | ID
| ) |  |

This function returns the device controller version string. As this SDK can be used to control all of Force Dimension haptic products, this can help programmers ensure that their application is running on the appropriate version of the haptic controller.

Parameters

  buffer | A user-allocated buffer to receive the device controller version string.
  size | The size of the user-allocated version string buffer.
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetWatchdog()

int __SDK dhdGetWatchdog | ( | uchar * | val,
|  | char | ID
| ) |  |

This function retrieves the watchdog duration in multiples of 125 microseconds on compatible devices.

Parameters

  val | [out]watchdog duration in multiples of 125 [us]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

See also
  dhdSetWatchdog()

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetWristEncoders()

int __SDK dhdGetWristEncoders | ( | int * | enc0,
|  | int * | enc1,
|  | int * | enc2,
|  | char | ID
| ) |  |

This function reads the encoders values of the wrist structure.

Parameters

  enc0 | [out] wrist joint 0 encoder reading
  enc1 | [out] wrist joint 1 encoder reading
  enc2 | [out] wrist joint 2 encoder reading
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA6_RIGHT
  - DHD_DEVICE_OMEGA6_LEFT
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA6_RIGHT
  - DHD_DEVICE_LAMBDA6_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetWristJacobian()

int __SDK dhdGetWristJacobian | ( | double | jacobian[3][3],
|  | char | ID
| ) |  |

This function retrieves the wrist jacobian matrix based on the current end-effector position. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  jacobian | [out] device jacobian
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGetWristJointAngles()

int __SDK dhdGetWristJointAngles | ( | double * | j0,
|  | double * | j1,
|  | double * | j2,
|  | char | ID
| ) |  |

This function retrieves the joint angles in [rad] for the wrist structure.

Parameters

  j0 | [out] joint angle for joint 0 in [rad]
  j1 | [out] joint angle for joint 1 in [rad]
  j2 | [out] joint angle for joint 2 in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGripperAngleRadToEncoder()

int __SDK dhdGripperAngleRadToEncoder | ( | double | a,
|  | int * | enc,
|  | char | ID
| ) |  |

This function computes and returns the gripper encoder value for a given gripper angle in [rad]

Parameters

  a | gripper opening in [rad]
  enc | [out] gripper encoder reading
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGripperEncoderToAngleRad()

int __SDK dhdGripperEncoderToAngleRad | ( | int | enc,
|  | double * | a,
|  | char | ID
| ) |  |

This function computes and returns the opening of the gripper as an angle in [rad] for a given encoder reading.

Parameters

  enc | gripper encoder reading
  a | [out] gripper opening [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdGripperEncoderToGap()

int __SDK dhdGripperEncoderToGap | ( | int | enc,
|  | double * | gap,
|  | char | ID
| ) |  |

This function computes and returns the opening of the gripper as a distance in [m] for a given encoder reading.

Parameters

  enc | gripper encoder reading
  gap | [out] gripper opening [m]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGripperForceToMotor()

int __SDK dhdGripperForceToMotor | ( | double | frc,
|  | ushort * | mot,
|  | int | enc[4],
|  | char | ID
| ) |  |

Given a desired force to be displayed by the force gripper, this function computes and returns the corresponding motor command.

Parameters

  frc | force on the gripper end-effector [N]
  mot | [out] motor command on gripper axis
  enc | encoder reading for wrist (at indices 0,1,2) and gripper (at index 3)
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 or DHD_MOTOR_SATURATED on success, -1 otherwise.
  See error management for details.

## ◆ dhdGripperGapToEncoder()

int __SDK dhdGripperGapToEncoder | ( | double | gap,
|  | int * | enc,
|  | char | ID
| ) |  |

This function computes and returns the gripper encoder value for a given gripper opening distance in [m]

Parameters

  gap | gripper opening in [m]
  enc | [out] gripper encoder reading
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdGripperMotorToForce()

int __SDK dhdGripperMotorToForce | ( | ushort | mot,
|  | double * | frc,
|  | int | enc[4],
|  | char | ID
| ) |  |

This function computes and returns the force applied to the end-effector for a given motor command.

Parameters

  mot | motor command on gripper axis
  frc | [out] force on the gripper end-effector [N]
  enc | encoder reading for wrist (at indices 0,1,2) and gripper (at index 3)
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdHasActiveGripper()

bool __SDK dhdHasActiveGripper | ( | char | ID | ) |

This function returns true if the device has an active gripper, false otherwise.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  true if the device has an active gripper, false otherwise.

Examples
  constraints.cpp, hold.cpp, jacobian.cpp, segment.cpp, teleoperation.cpp, torus.cpp, and transformations.cpp.

## ◆ dhdHasActiveWrist()

bool __SDK dhdHasActiveWrist | ( | char | ID | ) |

This function returns true if the device has an active wrist, false otherwise.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA6_RIGHT
  - DHD_DEVICE_OMEGA6_LEFT
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA6_RIGHT
  - DHD_DEVICE_LAMBDA6_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  true if the device has an active wrist, false otherwise.

## ◆ dhdHasBase()

bool __SDK dhdHasBase | ( | char | ID | ) |

This function returns true if the device has a base, false otherwise.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_DELTA3
  - DHD_DEVICE_OMEGA3
  - DHD_DEVICE_RJB_RED3
  - DHD_DEVICE_OMEGA6_RIGHT
  - DHD_DEVICE_OMEGA6_LEFT
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA6_RIGHT
  - DHD_DEVICE_LAMBDA6_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT
  - DHD_DEVICE_FALCON

Returns
  true if the device is configure for left-handed use, false otherwise.

## ◆ dhdHasGripper()

bool __SDK dhdHasGripper | ( | char | ID | ) |

This function returns true if the device has a gripper, false otherwise.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  true if the device has a gripper, false otherwise.

Examples
  sphere.cpp, and torus.cpp.

## ◆ dhdHasLocks()

bool __SDK dhdHasLocks | ( | char | ID | ) |

This function returns true if the device has locks on some of its axes, false otherwise.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  true if the device has locks, false otherwise.

## ◆ dhdHasWrist()

bool __SDK dhdHasWrist | ( | char | ID | ) |

This function returns true if the device has a wrist, false otherwise.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA6_RIGHT
  - DHD_DEVICE_OMEGA6_LEFT
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA6_RIGHT
  - DHD_DEVICE_LAMBDA6_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  true if the device has a wrist, false otherwise.

Examples
  encoders.cpp, jacobian.cpp, sphere.cpp, and torus.cpp.

## ◆ dhdIsLeftHanded()

bool __SDK dhdIsLeftHanded | ( | char | ID | ) |

This function returns true if the device is configured for left-handed use, false otherwise.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA6_RIGHT
  - DHD_DEVICE_OMEGA6_LEFT
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA6_RIGHT
  - DHD_DEVICE_LAMBDA6_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  true if the device is configure for left-handed use, false otherwise.

Examples
  sphere.cpp, and torus.cpp.

## ◆ dhdJointAnglesToEncoder()

int __SDK dhdJointAnglesToEncoder | ( | double | j[DHD_MAX_DOF],
|  | int | enc[DHD_MAX_DOF],
|  | char | ID
| ) |  |

This function computes the encoder values that match a given joint angles configuration on the current device.

Parameters

  j | array of joint angles in [rad]
  enc | [out] array matching encoder values
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

## ◆ dhdJointAnglesToGravityJointTorques()

int __SDK dhdJointAnglesToGravityJointTorques | ( | double | j[DHD_MAX_DOF],
|  | double | q[DHD_MAX_DOF],
|  | uchar | mask,
|  | char | ID
| ) |  |

This function computes the joint torques in [Nm] required to provide gravity compensation on all actuated degrees-of-freedom of the current device for a given joint angles configuration in [rad].

Parameters

  j | array of joint angles in [rad]
  q | [out] array of gravity compensation joint torques in [Nm]
  mask | [default=0xff] bitwise mask of which joints should be computed
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 or DHD_TIMEGUARD on success, -1 otherwise.
  See error management for details.

Examples
  jacobian.cpp.

## ◆ dhdJointAnglesToInertiaMatrix()

int __SDK dhdJointAnglesToInertiaMatrix | ( | double | j[DHD_MAX_DOF],
|  | double | inertia[6][6],
|  | char | ID
| ) |  |

This function retrieves the (Cartesian) inertia matrix based on a given joint configuration. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  j | array of joint angles in [rad]
  inertia | [out] device inertia matrix
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

See also
  dhdGetJointAngles()

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdKbGet()

char __SDK dhdKbGet | ( |  | ) |

This function retrieves a character from the keyboard (OS independent).

Returns
  The matching keyboard character.

Examples
  encoders.cpp, gravity.cpp, hold.cpp, jacobian.cpp, multithread.cpp, and segment.cpp.

## ◆ dhdKbHit()

bool __SDK dhdKbHit | ( |  | ) |

This function checks the keyboard for a key hit (OS independent).

Returns
  true on key pressed, false otherwise.

Examples
  encoders.cpp, gravity.cpp, hold.cpp, jacobian.cpp, multithread.cpp, and segment.cpp.

## ◆ dhdOpen()

int __SDK dhdOpen | ( |  | ) |

This function opens a connection to the first available device connected to the system. The order in which devices are opened persists until devices are added or removed.

Note
  If this call is successful, the default device ID is set to the newly opened device. See the multiple device section for more information on using multiple devices on the same computer.

Returns
  The device ID on success, -1 otherwise.
  See error management for details.

See also
  dhdOpenID()

Examples
  constraints.cpp, encoders.cpp, gravity.cpp, jacobian.cpp, segment.cpp, sphere.cpp, torques.cpp, and transformations.cpp.

## ◆ dhdOpenID()

int __SDK dhdOpenID | ( | char | index | ) |

This function opens a connection to one particular device connected to the system. The order in which devices are opened persists until devices are added or removed. If the device at the specified index is already opened, its device ID is returned.

Parameters

  index | the device enumeration index, as assigned by the underlying operating system (must be between 0 and the number of devices connected to the system)

Note
  If this call is successful, the default device ID is set to the newly opened device. See the multiple device section for more information on using multiple devices on the same computer.

Returns
  The device ID on success, -1 otherwise.
  See error management for details.

See also
  dhdOpen()

Examples
  multithread.cpp, and torus.cpp.

## ◆ dhdOpenSerial()

int __SDK dhdOpenSerial | ( | int | serial | ) |

This function opens a connection to the device with a given serial number (available on recent models only).

Parameters

  serial | requested system serial number

Note
  If this call is successful, the default device ID is set to the newly opened device. See the multiple device section for more information on using multiple devices on the same computer.

Returns
  The device ID on success, -1 otherwise.
  See error management for details.

See also
  dhdOpenID()

## ◆ dhdOpenType()

int __SDK dhdOpenType | ( | int | type | ) |

This function opens a connection to the first device of a given type connected to the system. The order in which devices are opened persists until devices are added or removed.

Parameters

  type | requested system Device Types type

Note
  If this call is successful, the default device ID is set to the newly opened device. See the multiple device section for more information on using multiple devices on the same computer.

Returns
  The device ID on success, -1 otherwise.
  See error management for details.

See also
  dhdOpenID()

## ◆ dhdPreloadMot()

int __SDK dhdPreloadMot | ( | ushort | mot[DHD_MAX_DOF],
|  | uchar | mask,
|  | char | ID
| ) |  |

This function programs motor commands to a selection of motor channels. Unlike dhdSetMot(), this function saves the requested commands internally for later application by calling dhdSetForce() and the likes.

Parameters

  mot | motor values array
  mask | [default=0xff] bitwise mask of which motor should be set
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdPreset()

int __SDK dhdPreset | ( | int | val[DHD_MAX_DOF],
|  | uchar | mask,
|  | char | ID
| ) |  |

This function sets selected encoder offsets to a given value. Intended for use with the the generic controller when no RESET button is available.

Parameters

  val | motor values array
  mask | bitwise mask of which encoder should be set
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdReadConfigFromFile()

int __SDK dhdReadConfigFromFile | ( | char * | filename,
|  | char | ID
| ) |  |

This function loads a specific device calibration/configuration data from a file. Particularly useful when using the generic controller connected to a Force Dimension device without using the dhdControllerSetDevice() call.

Parameters

  filename | configuration file
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdReset()

int __SDK dhdReset | ( | char | ID | ) |

This function puts the device in RESET mode.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdResetWrist()

int __SDK dhdResetWrist | ( | char | ID | ) |

This function resets the wrist calibration on a delta.6 haptic device.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Deprecated:
  This function is deprecated and is kept for backward compatibility only.

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetBaseAngleXDeg()

int __SDK dhdSetBaseAngleXDeg | ( | double | angle,
|  | char | ID
| ) |  |

This function sets the device base plate angle around the X axis. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  angle | device base plate angle around X [deg]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdSetBaseAngleXRad()

## ◆ dhdSetBaseAngleXRad()

int __SDK dhdSetBaseAngleXRad | ( | double | angle,
|  | char | ID
| ) |  |

This function sets the device base plate angle around the X axis. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  angle | device base plate angle around X [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdSetBaseAngleXDeg()

## ◆ dhdSetBaseAngleZDeg()

int __SDK dhdSetBaseAngleZDeg | ( | double | angle,
|  | char | ID
| ) |  |

This function sets the device base plate angle around the vertical Z axis. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  angle | device base plate angle around Z [deg]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdSetBaseAngleZRad()

## ◆ dhdSetBaseAngleZRad()

int __SDK dhdSetBaseAngleZRad | ( | double | angle,
|  | char | ID
| ) |  |

This function sets the device base plate angle around the vertical Z axis. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  angle | device base plate angle around Z [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdSetBaseAngleZDeg()

## ◆ dhdSetBrakes()

int __SDK dhdSetBrakes | ( | int | val,
|  | char | ID
| ) |  |

This function toggles the device electromagnetic brakes state.

Parameters

  val | desired state of the brakes (DHD_ON or DHD_OFF)
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetBrk()

int __SDK dhdSetBrk | ( | uchar | mask,
|  | char | ID
| ) |  |

This function sets brakes electromagnetic brakes status on selective motor groups. Only applies when using the generic controller directly, without a device model attached.

Parameters

  mask | [default=0xff] bitwise mask of which motor group should the brakes be set on.
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  The motors on the dhd_controller are grouped as follows:
  - group1 - [mot0,mot1,mot2]
  - group2 - [mot3,mot4,mot5]
  - group3 - [mot6]
  - group4 - [mot7]
    The `mask` argument addresses all 8 motors bitwise. I a single bit within a motor group address is enabled, the entire motor group dhd_brakes will be activated.

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetComMode()

int __SDK dhdSetComMode | ( | int | mode,
|  | char | ID
| ) |  |

This function sets the COM operation mode on compatible devices.

Parameters

  mode | desired COM operation mode
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdSetComModePriority()

## ◆ dhdSetComModePriority()

int __SDK dhdSetComModePriority | ( | int | priority,
|  | char | ID
| ) |  |

This function sets the priority of the thread (if any) that supports the current COM operation mode on compatible devices. Currently unused.

Parameters

  priority | desired thread priority
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdSetComMode()

## ◆ dhdSetDeltaJointTorques()

int __SDK dhdSetDeltaJointTorques | ( | double | q0,
|  | double | q1,
|  | double | q2,
|  | char | ID
| ) |  |

This function sets all joint torques of the DELTA structure.

Parameters

  q0 | DELTA axis 0 torque command [Nm]
  q1 | DELTA axis 1 torque command [Nm]
  q2 | DELTA axis 2 torque command [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetDeltaMotor()

int __SDK dhdSetDeltaMotor | ( | ushort | mot0,
|  | ushort | mot1,
|  | ushort | mot2,
|  | char | ID
| ) |  |

This function sets desired motor commands to the amplifier channels commanding the DELTA motors.

Parameters

  mot0 | DELTA axis 0 motor command
  mot1 | DELTA axis 1 motor command
  mot2 | DELTA axis 2 motor command
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetDevice()

int __SDK dhdSetDevice | ( | char | ID | ) |

This function selects the default device that will receive the SDK commands. The SDK supports multiple devices. This routine allows the programmer to decide which device the SDK dhd_single_device_call single-device calls will address. Any subsequent SDK call that does not specifically mention the device ID in its parameter list will be sent to that device.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  torus.cpp.

## ◆ dhdSetDeviceAngleDeg()

int __SDK dhdSetDeviceAngleDeg | ( | double | angle,
|  | char | ID
| ) |  |

This function sets the device base plate angle around the (inverted) Y axis. Please refer to your device user manual for more information on your device coordinate system. An angle value of 0 corresponds to the device "upright" position, with its base plate perpendicular to axis X. An angle value of 90 corresponds to the device base plate resting horizontally.

Parameters

  angle | device base plate angle [deg]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdSetDeviceAngleRad()

## ◆ dhdSetDeviceAngleRad()

int __SDK dhdSetDeviceAngleRad | ( | double | angle,
|  | char | ID
| ) |  |

This function sets the device base plate angle around the (inverted) Y axis. Please refer to your device user manual for more information on your device coordinate system. An angle value of 0 corresponds to the device "upright" position, with its base plate perpendicular to axis X. An angle value of Pi/2 corresponds to the device base plate resting horizontally.

Parameters

  angle | device base plate angle [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

See also
  dhdSetDeviceAngleDeg()

## ◆ dhdSetEffectorMass()

int __SDK dhdSetEffectorMass | ( | double | mass,
|  | char | ID
| ) |  |

This function defines the mass of the end-effector. This function is required to provide accurate gravity compensation when custom-made or modified end-effectors are used.

Parameters

  mass | the actual end-effector mass in [kg]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetForce()

int __SDK dhdSetForce | ( | double | fx,
|  | double | fy,
|  | double | fz,
|  | char | ID
| ) |  |

This function sets the desired force vector in Cartesian coordinates to be applied to the end-effector of the device.

Parameters

  fx | force on the X axis in [N]
  fy | force on the Y axis in [N]
  fz | force on the Z axis in [N]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_MOTOR_SATURATED on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetForceAndGripperForce()

int __SDK dhdSetForceAndGripperForce | ( | double | fx,
|  | double | fy,
|  | double | fz,
|  | double | fg,
|  | char | ID
| ) |  |

This function sets the desired force vector in Cartesian coordinates and the desired grasping force to be applied to the device end-effector and force gripper.

Parameters

  fx | translation force along X axis
  fy | translation force along Y axis
  fz | translation force along Z axis
  fg | grasping force
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_MOTOR_SATURATED on success, -1 otherwise.
  See error management for details.

Examples
  sphere.cpp, and torus.cpp.

## ◆ dhdSetForceAndTorque()

int __SDK dhdSetForceAndTorque | ( | double | fx,
|  | double | fy,
|  | double | fz,
|  | double | tx,
|  | double | ty,
|  | double | tz,
|  | char | ID
| ) |  |

This function sets the desired force and torque vectors to be applied to the device end-effector.

Parameters

  fx | force on the X axis in [N]
  fy | force on the Y axis in [N]
  fz | force on the Z axis in [N]
  tx | torque around the X axis in [Nm]
  ty | torque around the Y axis in [Nm]
  tz | torque around the Z axis in [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_MOTOR_SATURATED on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetForceAndTorqueAndGripperForce()

int __SDK dhdSetForceAndTorqueAndGripperForce | ( | double | fx,
|  | double | fy,
|  | double | fz,
|  | double | tx,
|  | double | ty,
|  | double | tz,
|  | double | fg,
|  | char | ID
| ) |  |

This function sets the desired force and torque vectors in Cartesian coordinates and the desired grasping force to be applied to the device end-effector and force gripper.

Parameters

  fx | force on the X axis in [N]
  fy | force on the Y axis in [N]
  fz | force on the Z axis in [N]
  tx | torque around the X axis in [Nm]
  ty | torque around the Y axis in [Nm]
  tz | torque around the Z axis in [Nm]
  fg | gripper force in [N]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 or DHD_MOTOR_SATURATED on success, -1 otherwise.
  See error management for details.

Examples
  constraints.cpp, encoders.cpp, gravity.cpp, multithread.cpp, segment.cpp, teleoperation.cpp, torques.cpp, and transformations.cpp.

## ◆ dhdSetForceAndWristJointTorques()

int __SDK dhdSetForceAndWristJointTorques | ( | double | fx,
|  | double | fy,
|  | double | fz,
|  | double | q0,
|  | double | q1,
|  | double | q2,
|  | char | ID
| ) |  |

This function sets Cartesian force and wrist joint torques.

Parameters

  fx | translation force along X axis [N]
  fy | translation force along Y axis [N]
  fz | translation force along Z axis [N]
  q0 | wrist joint 0 torque command [Nm]
  q1 | wrist joint 1 torque command [Nm]
  q2 | wrist joint 2 torque command [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetForceAndWristJointTorquesAndGripperForce()

int __SDK dhdSetForceAndWristJointTorquesAndGripperForce | ( | double | fx,
|  | double | fy,
|  | double | fz,
|  | double | q0,
|  | double | q1,
|  | double | q2,
|  | double | fg,
|  | char | ID
| ) |  |

This function sets Cartesian force, wrist joint torques and gripper force.

Parameters

  fx | translation force along X axis [N]
  fy | translation force along Y axis [N]
  fz | translation force along Z axis [N]
  q0 | wrist joint 0 torque command [Nm]
  q1 | wrist joint 1 torque command [Nm]
  q2 | wrist joint 2 torque command [Nm]
  fg | gripper force [N]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  hold.cpp.

## ◆ dhdSetGravityCompensation()

int __SDK dhdSetGravityCompensation | ( | int | val,
|  | char | ID
| ) |  |

This function toggles the use of the gravity compensation feature.

Parameters

  val | desired state of the gravity compensation feature (DHD_ON or DHD_OFF)
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetGripperMotor()

int __SDK dhdSetGripperMotor | ( | ushort | mot,
|  | char | ID
| ) |  |

This function sets a desired motor command to the force gripper.

Parameters

  mot | gripper motor command
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetJointTorques()

int __SDK dhdSetJointTorques | ( | double | q[DHD_MAX_DOF],
|  | uchar | mask,
|  | char | ID
| ) |  |

This function sets all joint torques on all active axes.

Parameters

  q | joint torques array [Nm]
  mask | [default=0xff] bitwise mask of which joints should be set
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  jacobian.cpp.

## ◆ dhdSetMaxForce()

int __SDK dhdSetMaxForce | ( | double | f,
|  | char | ID
| ) |  |

This function defines a limit (in N) to the force magnitude that can be applied by the haptic device. The `f` N limit applies to all dhdSetForce() and related calls, and ensures that the force applied to the device end-effector remains below the requested value. If the `f` argument is negative, the limit is disabled and the full range of force available can be applied.

Parameters

  f | the maximum force that can be displayed by the device in [N]
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdGetMaxForce()
  dhdSetMaxTorque()
  dhdSetMaxGripperForce()

Note
  Note that the force limit enforced by dhdSetMaxForce() only applies to dhdSetForce() and related functions. Setting joint torques or motor DAC values directly will bypass the Cartesian force limit.

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetMaxGripperForce()

int __SDK dhdSetMaxGripperForce | ( | double | f,
|  | char | ID
| ) |  |

This function defines a limit (in N) to the force magnitude that can be applied by the haptic device gripper. The `f` N limit applies to dhdSetForceAndTorqueAndGripperForce() and related calls, and ensures that the force applied to the device gripper remains below the requested value. If the `f` argument is negative, the limit is disabled and the full range of gripper force available can be applied.

Parameters

  f | the maximum force that can be displayed by the device gripper in [N]
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdGetMaxGripperForce()
  dhdSetMaxForce()
  dhdSetMaxTorque()

Note
  Note that the force limit enforced by dhdSetMaxGripperForce() only applies to dhdSetForceAndTorqueAndGripperForce() and related functions. Setting joint torques or motor DAC values directly will bypass the Cartesian force limit.

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetMaxTorque()

int __SDK dhdSetMaxTorque | ( | double | t,
|  | char | ID
| ) |  |

This function defines a limit (in Nm) to the torque magnitude that can be applied by the haptic device. The `t` Nm limit applies to all dhdSetForceAndTorque() and related calls, and ensures that the torque applied to the device end-effector remains below the requested value. If the `t` argument is negative, the limit is disabled and the full range of torque available can be applied.

Parameters

  t | the maximum torque that can be displayed by the device in [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

See also
  dhdGetMaxTorque()
  dhdSetMaxForce()
  dhdSetMaxGripperForce()

Note
  Note that the torque limit enforced by dhdSetMaxTorque() only applies to dhdSetForceAndTorque() and related functions. Setting joint torques or motor DAC values directly will bypass the Cartesian torque limit.

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetMaxUsablePowerRatio()

int __SDK dhdSetMaxUsablePowerRatio | ( | double | powerRatio,
|  | char | ID
| ) |  |

This function limits the usable power that can be applied by the device to a ratio of the maximum power that the device can deliver. The usable power is defined as the power used for force/torque feedback independently of (that is, on top of) the power required to maintain gravity compensation.

Parameters

  powerRatio | the ratio of maximum power that can be displayed by each of the device motor, between 0.0 and 1.0
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetMot()

int __SDK dhdSetMot | ( | ushort | mot[DHD_MAX_DOF],
|  | uchar | mask,
|  | char | ID
| ) |  |

This function programs motor commands to a selection of motor channels. Particularly useful when using the generic controller directly, without a device model attached.

Parameters

  mot | motor values array
  mask | [default=0xff] bitwise mask of which motor should be set
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetMotor()

int __SDK dhdSetMotor | ( | int | index,
|  | ushort | val,
|  | char | ID
| ) |  |

This function programs a command to a single motor channel.

Parameters

  index | the motor index number as defined by DHD_MAX_DOF
  val | the motor DAC value
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetOutput()

int __SDK dhdSetOutput | ( | uint | output,
|  | char | ID
| ) |  |

This function sets the user programmable output bits on devices that support it.

Parameters

  output | a bitwise mask that toggles the programmable output bits
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  This feature only applies to the following devices:
  - DHD_DEVICE_DELTA3
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetStandardGravity()

int __SDK dhdSetStandardGravity | ( | double | g,
|  | char | ID
| ) |  |

This function sets the standard gravity constant used in gravity compensation. By default, the constant is set to 9.81 m/s^2.

Parameters

  g | standard gravity constant [m/s^2]
  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetTimeGuard()

int __SDK dhdSetTimeGuard | ( | int | us,
|  | char | ID
| ) |  |

This function toggles the use of the TimeGuard feature with an arbitrary minimum period.

Parameters

  us | minimum refresh period in [us] a value of 0 disables the TimeGuard feature, while a value of -1 resets the default value (recommended)
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetVelocityThreshold()

int __SDK dhdSetVelocityThreshold | ( | uint | val,
|  | char | ID
| ) |  |

This function adjusts the velocity threshold of the device. Velocity threshold is a safety feature that prevents the device from accelerating to high velocities without control. If the velocity of one of the device axis passes the threshold, the device enters BRAKES mode.

Parameters

  val | an arbitrary value of velocity threshold the range of threshold values is device dependent, it is recommended NOT to modify factory settings
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA3
  - DHD_DEVICE_OMEGA6_RIGHT
  - DHD_DEVICE_OMEGA6_LEFT
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetVibration()

int __SDK dhdSetVibration | ( | double | freq,
|  | double | amplitude,
|  | int | type,
|  | char | ID
| ) |  |

This function applies a vibration to the end-effector. The vibration is added to the force requested by dhdSetForce() and the like. The vibration application mechanism depends on the specific device type, and is currently only available on devices with dedicated vibration actuators.

Parameters

  freq | Vibration frequency in Hz
  amplitude | Vibration amplitude in N
  type | Vibration profile (unused, reserved for future use)
  ID | [default=-1] Device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetWatchdog()

int __SDK dhdSetWatchdog | ( | uchar | val,
|  | char | ID
| ) |  |

This function sets the watchdog duration in multiples of 125 microseconds on compatible devices. If the watchdog duration is exceeded before the device receives a new force command, the device firmware will disable forces. A value of 0 disables the watchdog feature.

Parameters

  val | watchdog duration in multiples of 125 [us]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

See also
  dhdGetWatchdog()

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetWristJointTorques()

int __SDK dhdSetWristJointTorques | ( | double | q0,
|  | double | q1,
|  | double | q2,
|  | char | ID
| ) |  |

This function sets all joint torques of the wrist structure.

Parameters

  q0 | wrist joint 0 torque command [Nm]
  q1 | wrist joint 1 torque command [Nm]
  q2 | wrist joint 2 torque command [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSetWristMotor()

int __SDK dhdSetWristMotor | ( | ushort | mot0,
|  | ushort | mot1,
|  | ushort | mot2,
|  | char | ID
| ) |  |

This function sets desired motor commands to the amplifier channels commanding the wrist motors.

Parameters

  mot0 | wrist joint 0 motor command
  mot1 | wrist joint 1 motor command
  mot2 | wrist joint 2 motor command
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdSleep()

void __SDK dhdSleep | ( | double | sec | ) |

This function sleeps for a given period of time (OS independent).

Parameters

  sec | sleep period in [s]

Examples
  constraints.cpp, encoders.cpp, gravity.cpp, hold.cpp, jacobian.cpp, multithread.cpp, segment.cpp, sphere.cpp, torques.cpp, torus.cpp, and transformations.cpp.

## ◆ dhdStartThread()

int __SDK dhdStartThread | ( | void * | funcvoid *,
|  | void * | arg,
|  | int | priority
| ) |  |

This function creates a thread on any operating systems supported by the SDK.

Note
  This is a convenience function designed for simple, portable, multi-threaded applications. It is not intended to replace native OS functions. Force Dimension recommends using the native OS thread libraries in any application that requires reliable parallel computing.

Parameters

  func | function to run in the thread
  arg | optional pointer to an argument passed to the thread function
  priority | priority given to the thread (see the multi-threading section for details). The SDK will try to set the priority level, but will continue without error if the OS does not accept the request.

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  multithread.cpp.

## ◆ dhdStop()

int __SDK dhdStop | ( | char | ID | ) |

This function stops all forces on the device. This routine disables the force on the haptic device and puts it into BRAKE mode.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdUpdateEncoders()

int __SDK dhdUpdateEncoders | ( | char | ID | ) |

This function forces an update of the internal encoder values in the state vector. This call retrieves the encoder readings from the device and places them into the state vector. No kinematic model is called.

Parameters

  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdWaitForReset()

int __SDK dhdWaitForReset | ( | int | timeout,
|  | char | ID
| ) |  |

This function puts the device in RESET mode and wait for the user to calibrate the device. Optionally, a timeout can be defined after which the call returns even if calibration has not occurred.

Parameters

  timeout | [optional] maximum time to wait for calibration in [ms]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  If the timeout is reached, the call returns an error (-1) and dhdErrno is set to DHD_ERROR_TIMEOUT.

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdWristEncodersToJointAngles()

int __SDK dhdWristEncodersToJointAngles | ( | int | enc0,
|  | int | enc1,
|  | int | enc2,
|  | double * | j0,
|  | double * | j1,
|  | double * | j2,
|  | char | ID
| ) |  |

This function computes and returns the wrist joint angles for a given set of encoder readings.

Parameters

  enc0 | wrist encoder reading on axis 0
  enc1 | wrist encoder reading on axis 1
  enc2 | wrist encoder reading on axis 2
  j0 | [out] joint angle for wrist axis 0 in [rad]
  j1 | [out] joint angle for wrist axis 1 in [rad]
  j2 | [out] joint angle for wrist axis 2 in [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdWristEncoderToOrientation()

int __SDK dhdWristEncoderToOrientation | ( | int | enc0,
|  | int | enc1,
|  | int | enc2,
|  | double * | oa,
|  | double * | ob,
|  | double * | og,
|  | char | ID
| ) |  |

For devices with a wrist structure, this function computes individual angle of each joint, starting with the one located nearest to the wrist base plate. For the DHD_DEVICE_OMEGA6_RIGHT and DHD_DEVICE_OMEGA6_LEFT devices, angles are computed with respect to their internal reference frame, which is rotated 45 degrees around the Y axis. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  enc0 | wrist encoder reading on axis 0
  enc1 | wrist encoder reading on axis 1
  enc2 | wrist encoder reading on axis 2
  oa | [out] wrist end-effector orientation around the first wrist joint [rad]
  ob | [out] wrist end-effector orientation around the second wrist joint [rad]
  og | [out] wrist end-effector orientation around the third wrist joint [rad]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA6_RIGHT
  - DHD_DEVICE_OMEGA6_LEFT
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA6_RIGHT
  - DHD_DEVICE_LAMBDA6_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdWristGravityJointTorques()

int __SDK dhdWristGravityJointTorques | ( | double | j0,
|  | double | j1,
|  | double | j2,
|  | double * | q0,
|  | double * | q1,
|  | double * | q2,
|  | char | ID
| ) |  |

This function computes the wrist joint torques required to compensate for gravity in a given wrist joint angle configuration. Please refer to your device user manual for more information on your device coordinate system. This function is deprecated, please use dhdJointAnglesToGravityJointTorques() instead.

Deprecated:
  This function is deprecated and is kept for backward compatibility only.

Parameters

  j0 | joint angle for wrist axis 0 in [rad]
  j1 | joint angle for wrist axis 1 in [rad]
  j2 | joint angle for wrist axis 2 in [rad]
  q0 | [out] gravity compensation joint torque on axis 0 in [Nm]
  q1 | [out] gravity compensation joint torque on axis 1 in [Nm]
  q2 | [out] gravity compensation joint torque on axis 2 in [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdWristJointAnglesToEncoders()

int __SDK dhdWristJointAnglesToEncoders | ( | double | j0,
|  | double | j1,
|  | double | j2,
|  | int * | enc0,
|  | int * | enc1,
|  | int * | enc2,
|  | char | ID
| ) |  |

This function computes and returns the wrist encoder readings for a given set of joint angles.

Parameters

  j0 | joint angle for axis 0 in [rad]
  j1 | joint angle for axis 1 in [rad]
  j2 | joint angle for axis 2 in [rad]
  enc0 | [out] wrist encoder reading on axis 0
  enc1 | [out] wrist encoder reading on axis 1
  enc2 | [out] wrist encoder reading on axis 2
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdWristJointAnglesToJacobian()

int __SDK dhdWristJointAnglesToJacobian | ( | double | j0,
|  | double | j1,
|  | double | j2,
|  | double | jcb[3][3],
|  | char | ID
| ) |  |

This function retrieves the wrist jacobian matrix based on a given joint configuration. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  j0 | joint angle for wrist axis 0 in [rad]
  j1 | joint angle for wrist axis 1 in [rad]
  j2 | joint angle for wrist axis 2 in [rad]
  jcb | [out] device jacobian
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

Examples
  jacobian.cpp.

## ◆ dhdWristJointTorquesExtrema()

int __SDK dhdWristJointTorquesExtrema | ( | double | j0,
|  | double | j1,
|  | double | j2,
|  | double | minq[3],
|  | double | maxq[3],
|  | char | ID
| ) |  |

This function computes the range of applicable wrist joint torques for a given wrist joint angle configuration. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  j0 | joint angle for wrist axis 0 in [rad]
  j1 | joint angle for wrist axis 1 in [rad]
  j2 | joint angle for wrist axis 2 in [rad]
  minq | [out] array of minimum applicable joint torque in [Nm]
  maxq | [out] array of maximum applicable joint torque in [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdWristMotorToTorque()

int __SDK dhdWristMotorToTorque | ( | ushort | mot0,
|  | ushort | mot1,
|  | ushort | mot2,
|  | int | enc0,
|  | int | enc1,
|  | int | enc2,
|  | double * | tx,
|  | double * | ty,
|  | double * | tz,
|  | char | ID
| ) |  |

This function computes and returns the torque applied to the end-effector for a given set of motor commands at a given orientation (defined by encoder readings).

Parameters

  mot0 | motor command around wrist joint 0
  mot1 | motor command around wrist joint 1
  mot2 | motor command around wrist joint 2
  enc0 | wrist encoder reading around axis 0
  enc1 | wrist encoder reading around axis 1
  enc2 | wrist encoder reading around axis 2
  tx | [out] torque on the wrist end-effector around the X axis [Nm]
  ty | [out] torque on the wrist end-effector around the Y axis [Nm]
  tz | [out] torque on the wrist end-effector around the Z axis [Nm]
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdWristOrientationToEncoder()

int __SDK dhdWristOrientationToEncoder | ( | double | oa,
|  | double | ob,
|  | double | og,
|  | int * | enc0,
|  | int * | enc1,
|  | int * | enc2,
|  | char | ID
| ) |  |

For devices with a wrist structure, this function computes the encoder values from individual angle of each joint, starting with the one located nearest to the wrist base plate. For the DHD_DEVICE_OMEGA6_RIGHT and DHD_DEVICE_OMEGA6_LEFT devices, angles must be expressed with respect to their internal reference frame, which is rotated 45 degrees around the Y axis. Please refer to your device user manual for more information on your device coordinate system.

Parameters

  oa | wrist end-effector orientation around the X axis [rad]
  ob | wrist end-effector orientation around the Y axis [rad]
  og | wrist end-effector orientation around the Z axis [rad]
  enc0 | [out] wrist encoder reading on first joint
  enc1 | [out] wrist encoder reading on second joint
  enc2 | [out] wrist encoder reading on third joint
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_OMEGA6_RIGHT
  - DHD_DEVICE_OMEGA6_LEFT
  - DHD_DEVICE_OMEGA7_RIGHT
  - DHD_DEVICE_OMEGA7_LEFT
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT
  - DHD_DEVICE_LAMBDA6_RIGHT
  - DHD_DEVICE_LAMBDA6_LEFT
  - DHD_DEVICE_LAMBDA7_RIGHT
  - DHD_DEVICE_LAMBDA7_LEFT

Returns
  0 on success, -1 otherwise.
  See error management for details.

## ◆ dhdWristTorqueToMotor()

int __SDK dhdWristTorqueToMotor | ( | double | tx,
|  | double | ty,
|  | double | tz,
|  | int | enc0,
|  | int | enc1,
|  | int | enc2,
|  | ushort * | mot0,
|  | ushort * | mot1,
|  | ushort * | mot2,
|  | char | ID
| ) |  |

This function computes and returns the motor command necessary to obtain a given torque on the end-effector at a given orientation (defined by encoder readings).

Parameters

  tx | torque on the wrist end-effector around the X axis [Nm]
  ty | torque on the wrist end-effector around the Y axis [Nm]
  tz | torque on the wrist end-effector around the Z axis [Nm]
  enc0 | wrist encoder reading on axis 0
  enc1 | wrist encoder reading on axis 1
  enc2 | wrist encoder reading on axis 2
  mot0 | [out] motor command around wrist joint 0
  mot1 | [out] motor command around wrist joint 1
  mot2 | [out] motor command around wrist joint 2
  ID | [default=-1] device ID (see multiple devices section for details)

Note
  expert mode only - USE AT YOUR OWN RISKS
  This feature only applies to the following devices:
  - DHD_DEVICE_SIGMA7_RIGHT
  - DHD_DEVICE_SIGMA7_LEFT

Returns
  0 or DHD_MOTOR_SATURATED on success, -1 otherwise.
  See error management for details.