chai3d::cGenericHapticDevice Class Reference

This class implements a base class for haptic devices. More...

#include <CGenericHapticDevice.h>

Inheritance diagram for chai3d::cGenericHapticDevice:

Public Member Functions

 cGenericHapticDevice (unsigned int a_deviceNumber=0)
 Constructor of cGenericHapticDevice. More...
 
virtual ~cGenericHapticDevice ()
 Destructor of cGenericHapticDevice. 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 end-effector. More...
 
virtual bool getJointAnglesRad (double a_jointAnglesRad[C_MAX_DOF])
 This method returns the joint angles of the haptic device. 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...
 
virtual bool getGripperAngleRad (double &a_angle)
 This method returns the gripper angle in radian [rad]. 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...
 
virtual bool getUserSwitches (unsigned int &a_userSwitches)
 This method returns the status of all user switches [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...
 
virtual bool setForceAndTorqueAndGripperForce (const cVector3d &a_force, const cVector3d &a_torque, double a_gripperForce)
 This method sends a force [N], torque [N*m], and gripper force [N] 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 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...
 

Public Attributes

cHapticDeviceInfo m_specifications
 Technical specifications of haptic device. More...
 

Protected Member Functions

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...
 

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::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

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...
 

Detailed Description

This class implements a base class from which all haptic devices are derived.

Constructor & Destructor Documentation

chai3d::cGenericHapticDevice::cGenericHapticDevice ( unsigned int  a_deviceNumber = 0)

Constructor of cGenericHapticDevice.
Initializes basic parameters of generic haptic device class.

Parameters
a_deviceNumberDevice number ID for this class of devices.
virtual chai3d::cGenericHapticDevice::~cGenericHapticDevice ( )
inlinevirtual

Member Function Documentation

static cGenericHapticDevicePtr chai3d::cGenericHapticDevice::create ( unsigned int  a_deviceNumber = 0)
inlinestatic
virtual bool chai3d::cGenericHapticDevice::open ( )
inlinevirtual
virtual bool chai3d::cGenericHapticDevice::close ( )
inlinevirtual
virtual bool chai3d::cGenericHapticDevice::calibrate ( bool  a_forceCalibration = false)
inlinevirtual
virtual bool chai3d::cGenericHapticDevice::getPosition ( cVector3d a_position)
inlinevirtual
virtual bool chai3d::cGenericHapticDevice::getLinearVelocity ( cVector3d a_linearVelocity)
inlinevirtual

Reimplemented in chai3d::cDeltaDevice.

virtual bool chai3d::cGenericHapticDevice::getRotation ( cMatrix3d a_rotation)
inlinevirtual
virtual bool chai3d::cGenericHapticDevice::getJointAnglesRad ( double  a_jointAnglesRad[C_MAX_DOF])
inlinevirtual

Reimplemented in chai3d::cDeltaDevice.

virtual bool chai3d::cGenericHapticDevice::getAngularVelocity ( cVector3d a_angularVelocity)
inlinevirtual
bool chai3d::cGenericHapticDevice::getTransform ( cTransform a_transform)
virtual

This method returns the position and orientation of the device through a transformation matrix.

Parameters
a_transformReturned transformation matrix.
Returns
true if operation succeeds, false otherwise.
bool chai3d::cGenericHapticDevice::getGripperAngleRad ( double &  a_angle)
virtual

This method returns the gripper angle in radian.

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

Reimplemented in chai3d::cDeltaDevice, chai3d::cSixenseDevice, chai3d::cMyCustomDevice, and chai3d::cLeapDevice.

bool chai3d::cGenericHapticDevice::getGripperAngleDeg ( double &  a_angle)
inline
virtual bool chai3d::cGenericHapticDevice::getGripperAngularVelocity ( double &  a_gripperAngularVelocity)
inlinevirtual
virtual bool chai3d::cGenericHapticDevice::getForce ( cVector3d a_force)
inlinevirtual
virtual bool chai3d::cGenericHapticDevice::getTorque ( cVector3d a_torque)
inlinevirtual
virtual bool chai3d::cGenericHapticDevice::getGripperForce ( double &  a_gripperForce)
inlinevirtual
bool chai3d::cGenericHapticDevice::getUserSwitch ( int  a_switchIndex,
bool &  a_status 
)
virtual

This method returns the status of the user switch [1 = ON / 0 = OFF].

Parameters
a_switchIndexIndex number of the switch.
a_statusResult value from reading the selected input switch.
Returns
true if the operation succeeds, false otherwise.
virtual bool chai3d::cGenericHapticDevice::getUserSwitches ( unsigned int &  a_userSwitches)
inlinevirtual
cHapticDeviceInfo chai3d::cGenericHapticDevice::getSpecifications ( )
inline
virtual void chai3d::cGenericHapticDevice::setEnableGripperUserSwitch ( const bool  a_status)
inlinevirtual
virtual bool chai3d::cGenericHapticDevice::getEnableGripperUserSwitch ( ) const
inlinevirtual
bool chai3d::cGenericHapticDevice::setForce ( const cVector3d a_force)
inline
bool chai3d::cGenericHapticDevice::setForceAndTorque ( const cVector3d a_force,
const cVector3d a_torque 
)
inline
virtual bool chai3d::cGenericHapticDevice::setForceAndTorqueAndGripperForce ( const cVector3d a_force,
const cVector3d a_torque,
double  a_gripperForce 
)
inlinevirtual
static unsigned int chai3d::cGenericHapticDevice::getNumDevices ( )
inlinestatic
void chai3d::cGenericHapticDevice::estimateLinearVelocity ( cVector3d a_newPosition)
protected

This method estimates the linear velocity by passing the latest position.

Parameters
a_newPositionNew position of the haptic device.
void chai3d::cGenericHapticDevice::estimateAngularVelocity ( cMatrix3d a_newRotation)
protected

This method estimates the angular velocity by passing the latest orientation frame.

Parameters
a_newRotationNew rotation frame of the haptic device.
void chai3d::cGenericHapticDevice::estimateGripperVelocity ( double  a_newGripperAngle)
protected

This method estimates the velocity of the gripper by passing the latest gripper position.

Parameters
a_newGripperAngleNew angular position of the gripper.
double chai3d::cGenericHapticDevice::computeGripperUserSwitchForce ( const double &  a_gripperAngle,
const double &  a_gripperAngularVelocity 
)
protected

This method compute a haptic force that simulates a user switch (button) given the angular position and velocity of the gripper.

Parameters
a_gripperAngleCurrent position angle of gripper.
a_gripperAngularVelocityCurrent angular velocity of gripper.
Returns
Computed force to be applied to the gripper.
bool chai3d::cGenericHapticDevice::getGripperUserSwitch ( )
protected

This method returns true if the gripper is closed, or false if it is open. This mode requires that the gripper has been configured to simulate a user switch by calling method setEnableGripperUserSwitch(), furthermore the gripper needs to provide force-feedback capabilities.

Returns
true if the gripper user switch is closed, false otherwise.
static bool chai3d::cGenericHapticDevice::openLibraries ( )
inlinestaticprotected
static bool chai3d::cGenericHapticDevice::closeLibraries ( )
inlinestaticprotected

Member Data Documentation

cHapticDeviceInfo chai3d::cGenericHapticDevice::m_specifications
cVector3d chai3d::cGenericHapticDevice::m_prevForce
protected
cVector3d chai3d::cGenericHapticDevice::m_prevTorque
protected
double chai3d::cGenericHapticDevice::m_prevGripperForce
protected
cVector3d chai3d::cGenericHapticDevice::m_linearVelocity
protected
cVector3d chai3d::cGenericHapticDevice::m_angularVelocity
protected
double chai3d::cGenericHapticDevice::m_gripperAngularVelocity
protected
cTimestampPos chai3d::cGenericHapticDevice::m_historyPos[C_DEVICE_HISTORY_SIZE]
protected
cTimestampRot chai3d::cGenericHapticDevice::m_historyRot[C_DEVICE_HISTORY_SIZE]
protected
cTimestampValue chai3d::cGenericHapticDevice::m_historyGripper[C_DEVICE_HISTORY_SIZE]
protected
int chai3d::cGenericHapticDevice::m_indexHistoryPos
protected
int chai3d::cGenericHapticDevice::m_indexHistoryRot
protected
int chai3d::cGenericHapticDevice::m_indexHistoryGripper
protected
int chai3d::cGenericHapticDevice::m_indexHistoryPosWin
protected
int chai3d::cGenericHapticDevice::m_indexHistoryRotWin
protected
int chai3d::cGenericHapticDevice::m_indexHistoryGripperWin
protected
double chai3d::cGenericHapticDevice::m_linearVelocityWindowSize
protected
double chai3d::cGenericHapticDevice::m_angularVelocityWindowSize
protected
double chai3d::cGenericHapticDevice::m_gripperVelocityWindowSize
protected
cPrecisionClock chai3d::cGenericHapticDevice::m_clockGeneral
protected
bool chai3d::cGenericHapticDevice::m_gripperUserSwitchEnabled
protected
double chai3d::cGenericHapticDevice::m_gripperUserSwitchAngleStart
protected
double chai3d::cGenericHapticDevice::m_gripperUserSwitchAngleClick
protected
double chai3d::cGenericHapticDevice::m_gripperUserSwitchForceClick
protected
double chai3d::cGenericHapticDevice::m_gripperUserSwitchForceEngaged
protected
double chai3d::cGenericHapticDevice::m_virtualGripperAngle
protected
double chai3d::cGenericHapticDevice::m_virtualGripperAngleMin
protected
double chai3d::cGenericHapticDevice::m_virtualGripperAngleMax
protected
double chai3d::cGenericHapticDevice::m_virtualGripperAngularVelocity
protected
cPrecisionClock chai3d::cGenericHapticDevice::m_virtualGripperClock
protected

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