Public Member Functions | Private Attributes | Friends | List of all members
SurgSim::Device::PhantomDevice Class Reference

A class implementing the communication with a SensAble/Geomagic PHANTOM device. More...

#include <SurgSim/Devices/Phantom/PhantomDevice.h>

Inheritance diagram for SurgSim::Device::PhantomDevice:
SurgSim::Input::CommonDevice SurgSim::Input::DeviceInterface

Public Member Functions

 PhantomDevice (const std::string &uniqueName, const std::string &initializationName)
 Constructor. More...
 
virtual ~PhantomDevice ()
 Destructor. More...
 
std::string getInitializationName () const
 Gets the name used by the Phantom device configuration to refer to this device. More...
 
virtual bool initialize () override
 Fully initialize the device. More...
 
virtual bool finalize () override
 Finalize (de-initialize) the device. More...
 
bool isInitialized () const
 Check whether this device is initialized. More...
 
- Public Member Functions inherited from SurgSim::Input::CommonDevice
 CommonDevice (const std::string &name)
 Constructor. More...
 
 CommonDevice (const std::string &name, const SurgSim::DataStructures::DataGroup &inputData)
 Constructor. More...
 
 CommonDevice (const std::string &name, SurgSim::DataStructures::DataGroup &&inputData)
 Constructor. More...
 
virtual ~CommonDevice ()
 Destructor. More...
 
virtual std::string getName () const override
 Return a (hopefully unique) device name. More...
 
void setNameForCallback (const std::string &name)
 Set the name used for calling the input consumers and output producer. More...
 
std::string getNameForCallback () const
 Get the name used for calling the input consumers and output producer. More...
 
virtual bool addInputConsumer (std::shared_ptr< InputConsumerInterface > inputConsumer) override
 Connect this device to an InputConsumerInterface, which will receive the data that comes from this device. More...
 
virtual bool removeInputConsumer (std::shared_ptr< InputConsumerInterface > inputConsumer) override
 Disconnect this device from an InputConsumerInterface, which will no longer receive data from this device. More...
 
virtual bool setOutputProducer (std::shared_ptr< OutputProducerInterface > outputProducer) override
 Connect this device to an OutputProducerInterface, which will send data to this device. More...
 
virtual bool removeOutputProducer (std::shared_ptr< OutputProducerInterface > outputProducer) override
 Disconnect this device from an OutputProducerInterface, which will no longer send data to this device. More...
 
virtual bool hasOutputProducer () override
 Getter for whether or not this device is connected with an OutputProducerInterface. More...
 
- Public Member Functions inherited from SurgSim::Input::DeviceInterface
virtual ~DeviceInterface ()
 Virtual destructor (empty). More...
 

Private Attributes

std::shared_ptr< PhantomScaffoldm_scaffold
 
std::string m_initializationName
 

Friends

class PhantomScaffold
 

Additional Inherited Members

- Protected Member Functions inherited from SurgSim::Input::CommonDevice
virtual void pushInput ()
 Push application input to consumers. More...
 
virtual bool pullOutput ()
 Pull application output from a producer. More...
 
SurgSim::DataStructures::DataGroupgetInputData ()
 Getter for the input data DataGroup. More...
 
const SurgSim::DataStructures::DataGroupgetOutputData () const
 Getter for the output data DataGroup. More...
 

Detailed Description

A class implementing the communication with a SensAble/Geomagic PHANTOM device.

This should support any device that can communicate using the OpenHaptics 3.x toolkit, such as the PHANTOM Omni (a.k.a. Geomagic Touch), PHANTOM Desktop (a.k.a. Geomagic Touch X), and the PHANTOM Premium series devices.

Application input provided by the device:
type name
pose "pose" Device pose (units are meters).
bool "button1" State of the first device button.
bool "button2" State of the second device button if present.
bool "button3" State of the third device button (probably doesn't exist).
bool "button4" State of the third device button (probably doesn't exist).
Note that button1 through 4 correspond to the HD_DEVICE_BUTTON_1 through 4 provided by the OpenHaptics API, but your PHANTOM device likely has fewer than 4 buttons. On one-button PHANTOM devices, the button state can be accessed through button1. On a PHANTOM Omni or a Geomagic Touch, button1 corresponds to the front (blue) stylus button, and button2 to the rear (white/gray) stylus button.
Application output used by the device:
type name
vector "force" Device output force (units are newtons).
vector "torque" Device output torque (units are Nm).
See also
SurgSim::Input::CommonDevice, SurgSim::Input::DeviceInterface

Constructor & Destructor Documentation

SurgSim::Device::PhantomDevice::PhantomDevice ( const std::string &  uniqueName,
const std::string &  initializationName 
)

Constructor.

Parameters
uniqueNameA unique name for the device that will be used by the application.
initializationNameThe name passed to HDAPI when initializing the device. This should match a configured PHANTOM device; alternately, an empty string indicates the default device.
SurgSim::Device::PhantomDevice::~PhantomDevice ( )
virtual

Destructor.

Member Function Documentation

bool SurgSim::Device::PhantomDevice::finalize ( )
overridevirtual

Finalize (de-initialize) the device.

Implements SurgSim::Input::DeviceInterface.

std::string SurgSim::Device::PhantomDevice::getInitializationName ( ) const

Gets the name used by the Phantom device configuration to refer to this device.

Note that this may or may not be the same as the device name retrieved by getName(). An empty string indicates the default device.

Returns
The initialization name.
bool SurgSim::Device::PhantomDevice::initialize ( )
overridevirtual

Fully initialize the device.

When the manager object creates the device, the internal state of the device usually isn't fully initialized yet. This method performs any needed initialization.

Implements SurgSim::Input::DeviceInterface.

bool SurgSim::Device::PhantomDevice::isInitialized ( ) const

Check whether this device is initialized.

Friends And Related Function Documentation

friend class PhantomScaffold
friend

Member Data Documentation

std::string SurgSim::Device::PhantomDevice::m_initializationName
private
std::shared_ptr<PhantomScaffold> SurgSim::Device::PhantomDevice::m_scaffold
private

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