45 #ifndef CGenericHapticDeviceH 46 #define CGenericHapticDeviceH 117 #ifndef DOXYGEN_SHOULD_SKIP_THIS 129 struct cTimestampValue
178 #endif // DOXYGEN_SHOULD_SKIP_THIS 295 static cGenericHapticDevicePtr
create(
unsigned int a_deviceNumber = 0) {
return (std::make_shared<cGenericHapticDevice>(a_deviceNumber)); }
311 virtual bool calibrate(
bool a_forceCalibration =
false) {
return (m_deviceReady); }
329 virtual bool getTransform(
cTransform& a_transform);
332 virtual bool getGripperAngleRad(
double& a_angle);
335 inline bool getGripperAngleDeg(
double& a_angle) {
double angle;
bool result = getGripperAngleRad(angle); a_angle =
cRadToDeg(angle);
return (result); }
338 virtual bool getGripperAngularVelocity(
double& a_gripperAngularVelocity) { a_gripperAngularVelocity = m_gripperAngularVelocity;
return (m_deviceReady); }
347 virtual bool getGripperForce(
double& a_gripperForce) { a_gripperForce = m_prevGripperForce;
return (m_deviceReady); }
350 virtual bool getUserSwitch(
int a_switchIndex,
bool& a_status);
353 virtual bool getUserSwitches(
unsigned int& a_userSwitches) { a_userSwitches = 0;
return (m_deviceReady); }
516 void estimateLinearVelocity(
cVector3d& a_newPosition);
519 void estimateAngularVelocity(
cMatrix3d& a_newRotation);
522 void estimateGripperVelocity(
double a_newGripperPosition);
532 double computeGripperUserSwitchForce(
const double& a_gripperAngle,
533 const double& a_gripperAngularVelocity);
536 bool getGripperUserSwitch();
This class implements a 3D vector.
Definition: CVector3d.h:88
cPrecisionClock m_virtualGripperClock
Clock for computing the position/velocity of the virtual gripper.
Definition: CGenericHapticDevice.h:506
double cRadToDeg(const double &a_angleRad)
This function converts an angle from radians to degrees.
Definition: CMaths.h:653
virtual bool close()
This method closes the connection to the haptic device.
Definition: CGenericHapticDevice.h:308
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.
Definition: CGenericHapticDevice.h:368
double m_maxGripperAngularDamping
Maximum recommended angular damping factor Kv when using the getGripperAngularVelocity() method from ...
Definition: CGenericHapticDevice.h:230
bool m_sensedRotation
If true then device supports rotation sensing. (i.e stylus, pen), false otherwise.
Definition: CGenericHapticDevice.h:242
double m_maxAngularDamping
Maximum recommended angular damping factor Kv when using the getAngularVelocity() method from the dev...
Definition: CGenericHapticDevice.h:227
bool m_actuatedRotation
If true then device provides actuation capabilities for orientation degrees of freedom (i...
Definition: CGenericHapticDevice.h:251
Implements a high precision clock.
Implements general math utility functions.
virtual ~cGenericHapticDevice()
Destructor of cGenericHapticDevice.
Definition: CGenericHapticDevice.h:292
double m_maxGripperLinearStiffness
Maximum closed loop gripper stiffness [N/m] for a simulation running at 1 KHz.
Definition: CGenericHapticDevice.h:221
This class implements an abstract class for hardware devices.
Definition: CGenericDevice.h:83
std::string m_manufacturerName
Name of the haptic device manufacturer.
Definition: CGenericHapticDevice.h:203
double m_maxLinearDamping
Maximum recommended linear damping factor Kv when using the getVelocity() method from the device clas...
Definition: CGenericHapticDevice.h:224
static cGenericHapticDevicePtr create(unsigned int a_deviceNumber=0)
Shared cGenericHapticDevice allocator.
Definition: CGenericHapticDevice.h:295
bool m_sensedPosition
If true then device supports position sensing (x,y,z axis), false otherwise.
Definition: CGenericHapticDevice.h:239
void zero()
This method clears all vector components with zeros.
Definition: CVector3d.h:256
double m_gripperUserSwitchAngleClick
Position of the gripper when the virtual switch is enabled and the "click" occurs.
Definition: CGenericHapticDevice.h:478
const int C_MAX_DOF
Maximum number of joint of a haptic device.
Definition: CGenericHapticDevice.h:78
cHapticDeviceModel
Definition: CGenericHapticDevice.h:88
int m_indexHistoryPos
Current index position in history data table.
Definition: CGenericHapticDevice.h:435
bool m_rightHand
If true then the device can be used for right hands, false otherwise.
Definition: CGenericHapticDevice.h:260
double m_maxAngularStiffness
Maximum closed loop angular stiffness [N*m/rad] for a simulation running at 1 KHz.
Definition: CGenericHapticDevice.h:218
Definition: CGenericHapticDevice.h:101
This class implements a high precision clock.
Definition: CPrecisionClock.h:85
double m_workspaceRadius
Radius which describes the largest sphere (3D devices) or circle (2D Devices) which can be enclosed i...
Definition: CGenericHapticDevice.h:233
cPrecisionClock m_clockGeneral
General clock used to compute velocity signals.
Definition: CGenericHapticDevice.h:462
Implements a device base class.
Definition: CGenericHapticDevice.h:97
virtual bool getTorque(cVector3d &a_torque)
This method returns the sensed torque [N*m] from the haptic device.
Definition: CGenericHapticDevice.h:344
int m_indexHistoryRotWin
Last index position used to compute velocity.
Definition: CGenericHapticDevice.h:447
const bool C_SUCCESS
Function returns successfully.
Definition: CConstants.h:77
bool m_actuatedPosition
If true then device provides actuation capabilities for translation degrees of freedom (x...
Definition: CGenericHapticDevice.h:248
double m_angularVelocityWindowSize
Window time interval for measuring angular velocity.
Definition: CGenericHapticDevice.h:456
double m_virtualGripperAngle
Virtual gripper current angle in radians [rad].
Definition: CGenericHapticDevice.h:494
bool m_leftHand
If true then the device can be used for left hands, false otherwise.
Definition: CGenericHapticDevice.h:257
Definition: CGenericHapticDevice.h:102
double m_gripperUserSwitchAngleStart
Position of the gripper when the user encounters the virtual switch.
Definition: CGenericHapticDevice.h:475
Definition: CGenericHapticDevice.h:109
double m_gripperMaxAngleRad
Maximum open angle of the gripper [rad].
Definition: CGenericHapticDevice.h:236
Definition: CGenericHapticDevice.h:103
cHapticDeviceModel m_model
Haptic device model.
Definition: CGenericHapticDevice.h:197
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...
Definition: CGenericHapticDevice.h:371
double m_prevGripperForce
Last gripper force sent to haptic device.
Definition: CGenericHapticDevice.h:407
const double C_DEVICE_MIN_ACQUISITION_TIME
Smallest time interval between two position/status reads from a haptic device.
Definition: CGenericHapticDevice.h:75
cHapticDeviceInfo m_specifications
Technical specifications of haptic device.
Definition: CGenericHapticDevice.h:391
double m_virtualGripperAngleMin
Virtual gripper minimum angle in radians [rad].
Definition: CGenericHapticDevice.h:497
double m_gripperUserSwitchForceEngaged
Force level when the gripper is completely closed after the "click" event has occurred.
Definition: CGenericHapticDevice.h:484
virtual bool getGripperForce(double &a_gripperForce)
This method returns the sensed torque [N*m] from the force gripper.
Definition: CGenericHapticDevice.h:347
double m_linearVelocityWindowSize
Window time interval for measuring linear velocity.
Definition: CGenericHapticDevice.h:453
Implements option settings for CHAI3D.
static bool openLibraries()
This method opens libraries for this class of devices.
Definition: CGenericHapticDevice.h:546
bool m_sensedGripper
If true then device supports a sensed gripper interface, false otherwise.
Definition: CGenericHapticDevice.h:245
Definition: CGenericHapticDevice.h:108
int m_indexHistoryPosWin
Last index position used to compute velocity.
Definition: CGenericHapticDevice.h:444
bool m_actuatedGripper
If true then device provides an actuated gripper, false otherwise.
Definition: CGenericHapticDevice.h:254
This class implements a 3D matrix.
Definition: CMatrix3d.h:97
virtual bool getJointAnglesRad(double a_jointAnglesRad[C_MAX_DOF])
This method returns the joint angles of the haptic device.
Definition: CGenericHapticDevice.h:323
cVector3d m_angularVelocity
Last estimated angular velocity.
Definition: CGenericHapticDevice.h:413
std::shared_ptr< cGenericHapticDevice > cGenericHapticDevicePtr
Definition: CGenericHapticDevice.h:264
const bool C_ERROR
Function returns with an error.
Definition: CConstants.h:74
double m_gripperAngularVelocity
Last estimated gripper angular velocity.
Definition: CGenericHapticDevice.h:416
Definition: CGenericHapticDevice.h:90
This class implements a base class for haptic devices.
Definition: CGenericHapticDevice.h:280
Definition: CGenericHapticDevice.h:104
Definition: CGenericHapticDevice.h:105
static bool closeLibraries()
This method closes libraries for this class of devices.
Definition: CGenericHapticDevice.h:549
cVector3d m_prevTorque
Last torque sent to haptic device.
Definition: CGenericHapticDevice.h:404
virtual bool getLinearVelocity(cVector3d &a_linearVelocity)
This method returns the linear velocity of the haptic device.
Definition: CGenericHapticDevice.h:317
Definition: CGenericHapticDevice.h:92
Definition: CGenericHapticDevice.h:99
int m_indexHistoryGripperWin
Last index position used to compute velocity.
Definition: CGenericHapticDevice.h:450
Definition: CGenericHapticDevice.h:111
bool setForce(const cVector3d &a_force)
This method sends a force [N] command to the haptic device.
Definition: CGenericHapticDevice.h:365
virtual bool getAngularVelocity(cVector3d &a_angularVelocity)
This method returns the angular velocity of haptic device.
Definition: CGenericHapticDevice.h:326
virtual bool getRotation(cMatrix3d &a_rotation)
This method returns the orientation frame of the haptic device end-effector.
Definition: CGenericHapticDevice.h:320
Definition: CGenericHapticDevice.h:91
double m_maxLinearStiffness
Maximum closed loop linear stiffness [N/m] for a simulation running at 1 KHz.
Definition: CGenericHapticDevice.h:215
static unsigned int getNumDevices()
This method returns the number of haptic devices available for this class of devices.
Definition: CGenericHapticDevice.h:381
This structure stores all technical specifications of a haptic device.
Definition: CGenericHapticDevice.h:194
Definition: CGenericHapticDevice.h:93
double m_gripperUserSwitchForceClick
Maximum force level at the force gripper when the "click" occurs.
Definition: CGenericHapticDevice.h:481
Definition: CGenericHapticDevice.h:98
std::string m_modelName
Name of the haptic device model.
Definition: CGenericHapticDevice.h:200
double m_gripperVelocityWindowSize
Window time interval for measuring gripper velocity.
Definition: CGenericHapticDevice.h:459
Definition: CGenericHapticDevice.h:100
virtual bool getGripperAngularVelocity(double &a_gripperAngularVelocity)
This method returns the angular velocity of the gripper. Units are in radians per second [rad/s]...
Definition: CGenericHapticDevice.h:338
bool m_gripperUserSwitchEnabled
If true then virtual gripper user switch is enabled.
Definition: CGenericHapticDevice.h:472
double m_maxLinearForce
Maximum continuous force in [N] that can be generated by the haptic device in translation.
Definition: CGenericHapticDevice.h:206
virtual bool getUserSwitches(unsigned int &a_userSwitches)
This method returns the status of all user switches [true = ON / false = OFF].
Definition: CGenericHapticDevice.h:353
virtual bool getForce(cVector3d &a_force)
This method returns the sensed force [N] from the haptic device.
Definition: CGenericHapticDevice.h:341
const int C_DEVICE_HISTORY_SIZE
Size of buffer.
Definition: CGenericHapticDevice.h:72
cHapticDeviceInfo getSpecifications()
This method returns the technical specifications of this haptic device.
Definition: CGenericHapticDevice.h:356
Definition: CAudioBuffer.cpp:56
double m_virtualGripperAngularVelocity
Virtual speed value used for simulating the opening and closing of the virtual gripper [rad/s]...
Definition: CGenericHapticDevice.h:503
virtual bool calibrate(bool a_forceCalibration=false)
This method calibrates the haptic device.
Definition: CGenericHapticDevice.h:311
int m_indexHistoryRot
Current index position in history data table.
Definition: CGenericHapticDevice.h:438
virtual bool getEnableGripperUserSwitch() const
This method returns the status of the virtual gripper user switch. If true, then gripper is used to e...
Definition: CGenericHapticDevice.h:362
void identity()
This method builds an identity matrix.
Definition: CMatrix3d.h:325
Definition: CGenericHapticDevice.h:94
bool getGripperAngleDeg(double &a_angle)
This method returns the gripper angle in degrees [deg].
Definition: CGenericHapticDevice.h:335
double m_maxGripperForce
Maximum continuous force in [N] that can be produced by the haptic gripper.
Definition: CGenericHapticDevice.h:212
int m_indexHistoryGripper
Current index position in history data table.
Definition: CGenericHapticDevice.h:441
double m_maxAngularTorque
Maximum continuous torque in [N*m] that can be generated by the haptic device in orientation.
Definition: CGenericHapticDevice.h:209
double m_virtualGripperAngleMax
Virtual gripper maximum angle in radians [rad].
Definition: CGenericHapticDevice.h:500
void cSleepMs(const unsigned int a_interval)
This function suspends the execution of the current thread for a specified interval.
Definition: CGlobals.cpp:60
Definition: CGenericHapticDevice.h:96
Definition: CGenericHapticDevice.h:106
virtual void setEnableGripperUserSwitch(const bool a_status)
This method enables or disables the virtual gripper switch.
Definition: CGenericHapticDevice.h:359
Definition: CGenericHapticDevice.h:95
cVector3d m_linearVelocity
Last estimated linear velocity.
Definition: CGenericHapticDevice.h:410
virtual bool getPosition(cVector3d &a_position)
This method returns the position of the haptic device.
Definition: CGenericHapticDevice.h:314
virtual bool open()
This method opens a connection to the haptic device.
Definition: CGenericHapticDevice.h:305
Definition: CGenericHapticDevice.h:107
Definition: CGenericHapticDevice.h:110
cVector3d m_prevForce
Last force sent to haptic device.
Definition: CGenericHapticDevice.h:401
Definition: CGenericHapticDevice.h:112