![]() |
A class that manages Sensable PHANTOM devices. More...
#include <SurgSim/Devices/Phantom/PhantomScaffold.h>
Classes | |
class | Callback |
struct | DeviceData |
class | Handle |
struct | StateData |
Public Member Functions | |
PhantomScaffold () | |
Constructor. More... | |
~PhantomScaffold () | |
Destructor. More... | |
Static Public Member Functions | |
static std::shared_ptr< PhantomScaffold > | getOrCreateSharedInstance () |
Gets or creates the scaffold shared by all PhantomDevice instances. More... | |
Private Member Functions | |
bool | registerDevice (PhantomDevice *device) |
Registers the specified device object. More... | |
bool | unregisterDevice (const PhantomDevice *device) |
Unregisters the specified device object. More... | |
bool | initializeDeviceState (DeviceData *info) |
Initializes a single device, creating the necessary HDAPI resources. More... | |
bool | finalizeDeviceState (DeviceData *info) |
Finalizes a single device, destroying the necessary HDAPI resources. More... | |
bool | updateDevice (DeviceData *info) |
Updates the device information for a single device. More... | |
void | calculateForceAndTorque (DeviceData *info) |
Calculates forces and torques and sends them to the device library. More... | |
void | setInputData (DeviceData *info) |
Sets the input DataGroup, which will be pushed to the InputComponent. More... | |
bool | runHapticFrame () |
Executes the operations for a single haptic frame. More... | |
bool | createHapticLoop () |
Creates the haptic loop callback. More... | |
bool | destroyHapticLoop () |
Destroys the haptic loop callback. More... | |
bool | startScheduler () |
Starts the OpenHaptics scheduler. More... | |
bool | stopScheduler () |
Stops the OpenHaptics scheduler. More... | |
Static Private Member Functions | |
static SurgSim::DataStructures::DataGroup | buildDeviceInputData () |
Builds the data layout for the application input (i.e. device output). More... | |
Private Attributes | |
std::shared_ptr< SurgSim::Framework::Logger > | m_logger |
Logger used by the scaffold and all devices. More... | |
std::unique_ptr< StateData > | m_state |
Internal scaffold state. More... | |
Friends | |
class | PhantomDevice |
A class that manages Sensable PHANTOM devices.
This should support any PHANTOM device that can communicate using OpenHaptics 3.0 toolkit, such as PHANTOM Omni, PHANTOM Desktop, and the PHANTOM Premium series devices. The implementation is currently limited to 3DoF haptic output (forces only, no torques).
SurgSim::Devices::PhantomScaffold::PhantomScaffold | ( | ) |
Constructor.
SurgSim::Devices::PhantomScaffold::~PhantomScaffold | ( | ) |
Destructor.
|
staticprivate |
Builds the data layout for the application input (i.e. device output).
|
private |
Calculates forces and torques and sends them to the device library.
The force to output is composed of a vector named "force" in the output data, plus contributions from two optional Jacobians. If the matrix "springJacobian" is provided in the output data, a spring force & torque are generated from its product with the difference between the current pose and the pose in the output data named "inputPose". A damping force & torque are generated similarly. The intention is for a Behavior to calculate a nominal force & torque as well as the desired linearized changes to the force & torque based on changes to the input's pose & velocities. Then the linearized deltas to the output force & torque can be calculated at the haptic update rates, thereby smoothing the output response to motion.
info | The device data. |
|
private |
Creates the haptic loop callback.
|
private |
Destroys the haptic loop callback.
Should be called while NOT holding the internal device list mutex, to prevent deadlock.
|
private |
Finalizes a single device, destroying the necessary HDAPI resources.
[in,out] | info | The device data. |
|
static |
Gets or creates the scaffold shared by all PhantomDevice instances.
The scaffold is managed using a SharedInstance object, so it will be destroyed when all devices are released.
|
private |
Initializes a single device, creating the necessary HDAPI resources.
[in,out] | info | The device data. |
|
private |
Registers the specified device object.
If successful, the device object will become connected to an unused controller.
device | The device object to be used, which should have a unique name. |
|
private |
Executes the operations for a single haptic frame.
Should only be called from the context of an OpenHaptics callback.
|
private |
Sets the input DataGroup, which will be pushed to the InputComponent.
info | The device data |
|
private |
Starts the OpenHaptics scheduler.
|
private |
Stops the OpenHaptics scheduler.
|
private |
Unregisters the specified device object.
The corresponding controller will become unused, and can be re-registered later.
device | The device object. |
|
private |
Updates the device information for a single device.
info | The device data. |
|
friend |
|
private |
Logger used by the scaffold and all devices.
|
private |
Internal scaffold state.