# cPhantomDevice Class Reference
[Devices]

cPhantomDevice describes an interface to the Phantom haptic devices from Sensable Technologies. More...

`#include <CPhantomDevices.h>`

Inheritance diagram for cPhantomDevice:

[legend]

List of all members.

## Public Member Functions
| cPhantomDevice (unsigned int a_deviceNumber)
| Constructor of cPhantomDevice.
| ~cPhantomDevice ()
| Destructor of cPhantomDevice.
int | open ()
| Open connection to haptic device (0 indicates success).
int | close ()
| Close connection to haptic device (0 indicates success).
int | initialize (const bool a_resetEncoders=false)
| Initialize or calibrate haptic device (0 indicates success).
unsigned int | getNumDevices ()
| Returns the number of devices available from this class of device.
int | getPosition (cVector3d &a_position)
| Read the position of the device. Units are meters [m].
int | getLinearVelocity (cVector3d &a_linearVelocity)
| Read the linear velocity of the device. Units are meters per second [m/s].
int | getRotation (cMatrix3d &a_rotation)
| Read the orientation frame of the device end-effector.
int | setForce (cVector3d &a_force)
| Send a force [N] to the haptic device.
int | setTorque (cVector3d &a_torque)
| Send a torque [N*m] to the haptic device .
int | getUserSwitch (int a_switchIndex, bool &a_status)
| read the status of the user switch [true = ON / false = OFF].

## Detailed Description

cPhantomDevice describes an interface to the Phantom haptic devices from Sensable Technologies.

## Constructor & Destructor Documentation

cPhantomDevice::cPhantomDevice | ( | unsigned int | a_deviceNumber | ) |

Constructor of cPhantomDevice.

Constructor of cPhantomDevice. No servo loop is yet created, encoders are NOT reset.

Parameters:

  | a_deviceNumber | Index number to the ith Phantom device

## Member Function Documentation

int cPhantomDevice::close | ( |  | ) | `[virtual]`

Close connection to haptic device (0 indicates success).

Close connection to phantom device.

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericHapticDevice.

int cPhantomDevice::getLinearVelocity | ( | cVector3d & | a_linearVelocity | ) | `[virtual]`

Read the linear velocity of the device. Units are meters per second [m/s].

Read the linear velocity of the device. Units are in [m/s].

Parameters:

  | a_linearVelocity | Return value.

Returns:
  Return 0 if no error occurred.

Reimplemented from cGenericHapticDevice.

unsigned int cPhantomDevice::getNumDevices | ( |  | ) | `[virtual]`

Returns the number of devices available from this class of device.

Returns the number of devices available from this class of device.

Returns:
  Returns the result

Reimplemented from cGenericDevice.

int cPhantomDevice::getPosition | ( | cVector3d & | a_position | ) | `[virtual]`

Read the position of the device. Units are meters [m].

Read the position of the device. Units are meters [m].

Parameters:

  | a_position | Return value.

Returns:
  Return 0 if no error occurred.

Reimplemented from cGenericHapticDevice.

int cPhantomDevice::getRotation | ( | cMatrix3d & | a_rotation | ) | `[virtual]`

Read the orientation frame of the device end-effector.

Read the orientation frame of the device end-effector

Parameters:

  | a_rotation | Return value.

Returns:
  Return 0 if no error occurred.

Reimplemented from cGenericHapticDevice.

int cPhantomDevice::getUserSwitch | ( | int | a_switchIndex,
|  | bool & | a_status |
| ) |  |  | `[virtual]`

read the status of the user switch [true = ON / false = OFF].

Read the status of the user switch [true = ON / false = OFF].

Parameters:

  | a_switchIndex | index number of the switch.
  | a_status | result value from reading the selected input switch.

Returns:
  Return 0 if no error occurred.

Reimplemented from cGenericHapticDevice.

int cPhantomDevice::initialize | ( | const bool | a_resetEncoders = `false` | ) | `[virtual]`

Initialize or calibrate haptic device (0 indicates success).

Initialize the phantom device.

For desktops and omnis, the a_resetEncoders parameter is ignored. For premiums, if you specify a_resetEncoders as true, you should be holding the Phantom in its rest position when this is called.

Parameters:

  | a_resetEncoders | Should I re-zero the encoders? (affects premiums only...)

Returns:
  Return 0 if operation succeeds, -1 if an error occurs.

Reimplemented from cGenericHapticDevice.

int cPhantomDevice::open | ( |  | ) | `[virtual]`

Open connection to haptic device (0 indicates success).

Open connection to phantom device.

Returns:
  Return 0 is operation succeeds, -1 if an error occurs.

Reimplemented from cGenericHapticDevice.

int cPhantomDevice::setForce | ( | cVector3d & | a_force | ) | `[virtual]`

Send a force [N] to the haptic device.

Send a force [N] to the haptic device

Parameters:

  | a_force | Force command to be applied to device.

Returns:
  Return 0 if no error occurred.

Reimplemented from cGenericHapticDevice.

int cPhantomDevice::setTorque | ( | cVector3d & | a_torque | ) | `[virtual]`

Send a torque [N*m] to the haptic device .

Send a torque [N*m] to the haptic device

Parameters:

  | a_torque | Force command to be applied to device.

Returns:
  Return 0 if no error occurred.

Reimplemented from cGenericHapticDevice.

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

- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/devices/CPhantomDevices.h
- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/devices/CPhantomDevices.cpp

CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.