chai3d::cDeltaDevice Class Reference

This class implements an interface to all Force Dimension and Novint haptic devices. More...

#include <CDeltaDevices.h>

Inheritance diagram for chai3d::cDeltaDevice:

Public Member Functions

 cDeltaDevice (unsigned int a_deviceNumber=0, bool a_external=false)
 Constructor of cDeltaDevice. More...
 
virtual ~cDeltaDevice ()
 Destructor of cDeltaDevice. More...
 
virtual bool open ()
 This method opens a connection to the haptic device. More...
 
virtual bool close ()
 This method closes the connection to the haptic device. More...
 
virtual bool calibrate (bool a_forceCalibration=false)
 This method calibrates the haptic device. More...
 
virtual bool getPosition (cVector3d &a_position)
 This method returns the position of the haptic device. More...
 
virtual bool getLinearVelocity (cVector3d &a_linearVelocity)
 This method returns the linear velocity of the haptic device. More...
 
virtual bool getRotation (cMatrix3d &a_rotation)
 This method returns the orientation frame of the haptic device. More...
 
virtual bool getJointAnglesRad (double a_jointAnglesRad[C_MAX_DOF])
 This method returns the joint angles of the haptic device. More...
 
virtual bool getGripperAngleRad (double &a_angle)
 This method returns the gripper angle in radian [rad]. More...
 
virtual bool getUserSwitches (unsigned int &a_userSwitches)
 This method returns the status of all user switches [true = ON / false = OFF]. More...
 
virtual bool setForceAndTorqueAndGripperForce (const cVector3d &a_force, const cVector3d &a_torque, double a_gripperForce)
 This method sends a force, torque, and gripper force to the haptic device. More...
 
int getDeviceType ()
 This method returns the type of this haptic device. More...
 
bool enableForces (bool a_value)
 This method enables or disables forces. More...
 
bool setDeviceAngleDeg (double a_angleDeg)
 This method orients the device around the y-axis. More...
 
bool setVibration (double a_freq, double a_amplitude, int a_type=0)
 This method assign a vibration to the devices that support this feature. More...
 
- Public Member Functions inherited from chai3d::cGenericHapticDevice
 cGenericHapticDevice (unsigned int a_deviceNumber=0)
 Constructor of cGenericHapticDevice. More...
 
virtual ~cGenericHapticDevice ()
 Destructor of cGenericHapticDevice. More...
 
virtual bool getAngularVelocity (cVector3d &a_angularVelocity)
 This method returns the angular velocity of haptic device. More...
 
virtual bool getTransform (cTransform &a_transform)
 This method returns the position and orientation of the haptic device through a transformation matrix. More...
 
bool getGripperAngleDeg (double &a_angle)
 This method returns the gripper angle in degrees [deg]. More...
 
virtual bool getGripperAngularVelocity (double &a_gripperAngularVelocity)
 This method returns the angular velocity of the gripper. Units are in radians per second [rad/s]. More...
 
virtual bool getForce (cVector3d &a_force)
 This method returns the sensed force [N] from the haptic device. More...
 
virtual bool getTorque (cVector3d &a_torque)
 This method returns the sensed torque [N*m] from the haptic device. More...
 
virtual bool getGripperForce (double &a_gripperForce)
 This method returns the sensed torque [N*m] from the force gripper. More...
 
virtual bool getUserSwitch (int a_switchIndex, bool &a_status)
 This method returns the status of a selected user switch [true = ON / false = OFF]. More...
 
cHapticDeviceInfo getSpecifications ()
 This method returns the technical specifications of this haptic device. More...
 
virtual void setEnableGripperUserSwitch (const bool a_status)
 This method enables or disables the virtual gripper switch. More...
 
virtual bool getEnableGripperUserSwitch () const
 This method returns the status of the virtual gripper user switch. If true, then gripper is used to emulate a user switch. Return false otherwise. More...
 
bool setForce (const cVector3d &a_force)
 This method sends a force [N] command to the haptic device. More...
 
bool setForceAndTorque (const cVector3d &a_force, const cVector3d &a_torque)
 This method sends a force [N] and torque [N*m] command to the haptic device. More...
 
- Public Member Functions inherited from chai3d::cGenericDevice
 cGenericDevice (unsigned int a_deviceNumber=0)
 Constructor of cGenericDevice. More...
 
virtual ~cGenericDevice ()
 Destructor of cGenericDevice. More...
 
bool isDeviceAvailable ()
 This method returns true if the device is available for communication, false otherwise. More...
 
bool isDeviceReady ()
 This method returns true if the connection to the device has been established by calling method open(), false otherwise. More...
 

Static Public Member Functions

static cDeltaDevicePtr create (unsigned int a_deviceNumber=0, bool a_external=false)
 Shared cDeltaDevice allocator. More...
 
static unsigned int getNumDevices ()
 This method returns the number of haptic devices available for this class of devices. More...
 
- Static Public Member Functions inherited from chai3d::cGenericHapticDevice
static cGenericHapticDevicePtr create (unsigned int a_deviceNumber=0)
 Shared cGenericHapticDevice allocator. More...
 
static unsigned int getNumDevices ()
 This method returns the number of haptic devices available for this class of devices. More...
 
- Static Public Member Functions inherited from chai3d::cGenericDevice
static unsigned int getNumDevices ()
 This method returns the number of haptic devices available for this class of devices. More...
 

Static Protected Member Functions

static bool openLibraries ()
 This method opens libraries for this class of devices. More...
 
static bool closeLibraries ()
 This method closes libraries for this class of devices. More...
 
- Static Protected Member Functions inherited from chai3d::cGenericHapticDevice
static bool openLibraries ()
 This method opens libraries for this class of devices. More...
 
static bool closeLibraries ()
 This method closes libraries for this class of devices. More...
 
- Static Protected Member Functions inherited from chai3d::cGenericDevice
static bool openLibraries ()
 This method opens libraries for this class of devices. More...
 
static bool closeLibraries ()
 This method closes libraries for this class of devices. More...
 

Protected Attributes

int m_deviceID
 Device ID number among the Force Dimension devices connected to the computer. More...
 
int m_deviceType
 Device type among the Force Dimension devices. More...
 
int m_userSwitchCount [8]
 Data structure for simulating a low-pass filter on user switches. More...
 
int m_userSwitchStatus [8]
 Last state of user switch. More...
 
cPrecisionClock m_userSwitchClock [8]
 Time guard for user switch. More...
 
bool m_statusEnableForcesFirstTime
 Have forces been enable yet since the connection to the device was opened? More...
 
bool m_external
 Was dhdOpen() called outside CHAI3D? More...
 
cVector3d m_posWorkspaceOffset
 Translational workspace offset. More...
 
- Protected Attributes inherited from chai3d::cGenericHapticDevice
cVector3d m_prevForce
 Last force sent to haptic device. More...
 
cVector3d m_prevTorque
 Last torque sent to haptic device. More...
 
double m_prevGripperForce
 Last gripper force sent to haptic device. More...
 
cVector3d m_linearVelocity
 Last estimated linear velocity. More...
 
cVector3d m_angularVelocity
 Last estimated angular velocity. More...
 
double m_gripperAngularVelocity
 Last estimated gripper angular velocity. More...
 
cTimestampPos m_historyPos [C_DEVICE_HISTORY_SIZE]
 History position data of the device. More...
 
cTimestampRot m_historyRot [C_DEVICE_HISTORY_SIZE]
 History orientation data of the device. More...
 
cTimestampValue m_historyGripper [C_DEVICE_HISTORY_SIZE]
 History position of device gripper. More...
 
int m_indexHistoryPos
 Current index position in history data table. More...
 
int m_indexHistoryRot
 Current index position in history data table. More...
 
int m_indexHistoryGripper
 Current index position in history data table. More...
 
int m_indexHistoryPosWin
 Last index position used to compute velocity. More...
 
int m_indexHistoryRotWin
 Last index position used to compute velocity. More...
 
int m_indexHistoryGripperWin
 Last index position used to compute velocity. More...
 
double m_linearVelocityWindowSize
 Window time interval for measuring linear velocity. More...
 
double m_angularVelocityWindowSize
 Window time interval for measuring angular velocity. More...
 
double m_gripperVelocityWindowSize
 Window time interval for measuring gripper velocity. More...
 
cPrecisionClock m_clockGeneral
 General clock used to compute velocity signals. More...
 
bool m_gripperUserSwitchEnabled
 If true then virtual gripper user switch is enabled. More...
 
double m_gripperUserSwitchAngleStart
 Position of the gripper when the user encounters the virtual switch. More...
 
double m_gripperUserSwitchAngleClick
 Position of the gripper when the virtual switch is enabled and the "click" occurs. More...
 
double m_gripperUserSwitchForceClick
 Maximum force level at the force gripper when the "click" occurs. More...
 
double m_gripperUserSwitchForceEngaged
 Force level when the gripper is completely closed after the "click" event has occurred. More...
 
double m_virtualGripperAngle
 Virtual gripper current angle in radians [rad]. More...
 
double m_virtualGripperAngleMin
 Virtual gripper minimum angle in radians [rad]. More...
 
double m_virtualGripperAngleMax
 Virtual gripper maximum angle in radians [rad]. More...
 
double m_virtualGripperAngularVelocity
 Virtual speed value used for simulating the opening and closing of the virtual gripper [rad/s]. More...
 
cPrecisionClock m_virtualGripperClock
 Clock for computing the position/velocity of the virtual gripper. More...
 
- Protected Attributes inherited from chai3d::cGenericDevice
bool m_deviceAvailable
 Flag that indicates if the device is available to the computer. More...
 
bool m_deviceReady
 Flag that indicates if connection to device was opened successfully by calling method open(). More...
 
int m_deviceNumber
 Device number ID for this category of devices. Value must be equal or bigger than 0. A value of __-1__ means that the ID has not yet been defined. More...
 

Static Protected Attributes

static bool s_allocationTable [C_MAX_DEVICES]
 Allocation table for devices of this class. true means that the device has been allocated, false means free. More...
 
static unsigned int s_libraryCounter
 Number of instances for this class of devices currently using the libraries. More...
 

Additional Inherited Members

- Public Attributes inherited from chai3d::cGenericHapticDevice
cHapticDeviceInfo m_specifications
 Technical specifications of haptic device. More...
 
- Protected Member Functions inherited from chai3d::cGenericHapticDevice
void estimateLinearVelocity (cVector3d &a_newPosition)
 Estimate linear velocity of handle by passing the latest position. More...
 
void estimateAngularVelocity (cMatrix3d &a_newRotation)
 Estimate angular velocity of handle by passing the latest orientation frame. More...
 
void estimateGripperVelocity (double a_newGripperPosition)
 Estimate velocity of gripper by passing the latest gripper position. More...
 
double computeGripperUserSwitchForce (const double &a_gripperAngle, const double &a_gripperAngularVelocity)
 This method computes the virtual gripper force. More...
 
bool getGripperUserSwitch ()
 This method returns the status of gripper user switch. Return true if virtual user switch is engaged, __false_ otherwise. More...
 

Detailed Description

This class implements an interface to all Force Dimension and Novint haptic devices that include the omega.x, delta.x, sigma.x and Falcon.

Constructor & Destructor Documentation

chai3d::cDeltaDevice::cDeltaDevice ( unsigned int  a_deviceNumber = 0,
bool  a_external = false 
)

Constructor of cDeltaDevice.

Parameters
a_deviceNumberDevice index number. [0, C_DEVICE_MAX]
a_externaltrue if dhdOpen() called outside CHAI3D, false otherwise.
chai3d::cDeltaDevice::~cDeltaDevice ( )
virtual

Destructor of cDeltaDevice.

Member Function Documentation

static cDeltaDevicePtr chai3d::cDeltaDevice::create ( unsigned int  a_deviceNumber = 0,
bool  a_external = false 
)
inlinestatic
bool chai3d::cDeltaDevice::open ( )
virtual

This method opens a connection to the haptic device.

Returns
true if operation succeeds, false otherwise.

Reimplemented from chai3d::cGenericHapticDevice.

bool chai3d::cDeltaDevice::close ( )
virtual

This method closes the connection to the haptic device.

Returns
true if the operation succeeds, false otherwise.

Reimplemented from chai3d::cGenericHapticDevice.

bool chai3d::cDeltaDevice::calibrate ( bool  a_forceCalibration = false)
virtual

This methods calibrates the haptic device.
If argument a_forceCalibration is equal to true, then calibration is enforced even if the device has already been calibrated. If false, then the device is only calibrated if needed.

Parameters
a_forceCalibrationEnforce calibration.
Returns
true if the operation succeeds, false otherwise.

Reimplemented from chai3d::cGenericHapticDevice.

bool chai3d::cDeltaDevice::getPosition ( cVector3d a_position)
virtual

This method reads the position of the haptic device. Units are meters [m].

Parameters
a_positionReturn value.
Returns
true if the operation succeeds, false otherwise.

Reimplemented from chai3d::cGenericHapticDevice.

bool chai3d::cDeltaDevice::getLinearVelocity ( cVector3d a_linearVelocity)
virtual

This method returns the linear velocity of the haptic device. Units are in [m/s].

Parameters
a_linearVelocityReturn value.
Returns
true if the operation succeeds, false otherwise.

Reimplemented from chai3d::cGenericHapticDevice.

bool chai3d::cDeltaDevice::getRotation ( cMatrix3d a_rotation)
virtual

This method returns the orientation frame of the haptic device end-effector.

Parameters
a_rotationReturn value.
Returns
true if the operation succeeds, false otherwise.

Reimplemented from chai3d::cGenericHapticDevice.

bool chai3d::cDeltaDevice::getJointAnglesRad ( double  a_jointAnglesRad[C_MAX_DOF])
virtual

This method returns the joint angles of the haptic device.

Parameters
a_jointAnglesRadArray of returned joints angles.
Returns
true if the operation succeeds, false otherwise.

Reimplemented from chai3d::cGenericHapticDevice.

bool chai3d::cDeltaDevice::getGripperAngleRad ( double &  a_angle)
virtual

This method returns the gripper angle in radian [rad].

Parameters
a_angleReturn value.
Returns
true if the operation succeeds, false otherwise.

Reimplemented from chai3d::cGenericHapticDevice.

bool chai3d::cDeltaDevice::getUserSwitches ( unsigned int &  a_userSwitches)
virtual

This method returns the status of all user switches [true = ON / false = OFF].

Parameters
a_userSwitchesReturn the 32-bit binary mask of the device buttons.
Returns
true if the operation succeeds, false otherwise.

Reimplemented from chai3d::cGenericHapticDevice.

bool chai3d::cDeltaDevice::setForceAndTorqueAndGripperForce ( const cVector3d a_force,
const cVector3d a_torque,
double  a_gripperForce 
)
virtual

This method sends a force [N] and a torque [N*m] and gripper torque [N*m] to the haptic device.

Parameters
a_forceForce command.
a_torqueTorque command.
a_gripperForceGripper force command.
Returns
true if the operation succeeds, false otherwise.

Reimplemented from chai3d::cGenericHapticDevice.

unsigned int chai3d::cDeltaDevice::getNumDevices ( )
static

This method returns the number of haptic devices available for this class of device.

Returns
Number of available haptic devices.
bool chai3d::cDeltaDevice::openLibraries ( )
staticprotected

This method opens libraries for this class of devices.

Returns
true if the operation succeeds, false otherwise.
bool chai3d::cDeltaDevice::closeLibraries ( )
staticprotected

This method closes libraries for this class of devices.

Returns
true if the operation succeeds, false otherwise.
int chai3d::cDeltaDevice::getDeviceType ( )
inline
bool chai3d::cDeltaDevice::enableForces ( bool  a_value)

This method enables or disables the motors of the haptic device. This function overrides the force button located at the base of the device or on the controller panel.

Parameters
a_valueActuation status.
Returns
true if the operation succeeds, false otherwise.
bool chai3d::cDeltaDevice::setDeviceAngleDeg ( double  a_angleDeg)

This mehtod sets the device base plate angle around the 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
a_angleDegAngle in degrees.
Returns
true if the operation succeeds, false otherwise.
bool chai3d::cDeltaDevice::setVibration ( double  a_freq,
double  a_amplitude,
int  a_type = 0 
)

This method assign a vibration to the devices that support this feature.

Parameters
a_freqFrequency in Hz.
a_amplitudeVibration amplitude.
a_typeVibration signal type.
Returns
true if the operation succeeds, false otherwise.

Member Data Documentation

bool chai3d::cDeltaDevice::s_allocationTable[C_MAX_DEVICES]
staticprotected
unsigned int chai3d::cDeltaDevice::s_libraryCounter
staticprotected
int chai3d::cDeltaDevice::m_deviceID
protected
int chai3d::cDeltaDevice::m_deviceType
protected
int chai3d::cDeltaDevice::m_userSwitchCount[8]
protected
int chai3d::cDeltaDevice::m_userSwitchStatus[8]
protected
cPrecisionClock chai3d::cDeltaDevice::m_userSwitchClock[8]
protected
bool chai3d::cDeltaDevice::m_statusEnableForcesFirstTime
protected
bool chai3d::cDeltaDevice::m_external
protected
cVector3d chai3d::cDeltaDevice::m_posWorkspaceOffset
protected

The documentation for this class was generated from the following files: