iMSTK
Interactive Medical Simulation Toolkit
|
Subclass of DeviceClient for phantom omni Holds and updates the data sync or on its own thread Holder of data. More...
#include <imstkOpenHapticDeviceClient.h>
Public Member Functions | |
void | update () override |
Use callback to get tracking data from phantom omni. | |
OpenHapticDeviceClient (const std::string &name="") | |
Constructor/Destructor, only the DeviceManager can construct. More... | |
![]() | |
SIGNAL (DeviceClient, buttonStateChanged) | |
bool | getTrackingEnabled () const |
Get/Set what listeners to enable on the device: tracking, analogic, force, buttons. | |
void | setTrackingEnabled (const bool status) |
bool | getAnalogicEnabled () const |
void | setAnalogicEnabled (const bool status) |
bool | getButtonsEnabled () const |
void | setButtonsEnabled (const bool status) |
bool | getForceEnabled () const |
void | setForceEnabled (const bool status) |
Vec3d | getPosition () |
Get the device position. | |
Vec3d | getVelocity () |
Get the device velocity. | |
Vec3d | getAngularVelocity () |
Get the device angular velocity. | |
Quatd | getOrientation () |
Get the device orientation. | |
const Vec3d & | getOffset () const |
Get offset from position for device end effector. | |
const std::unordered_map< int, int > & | getButtons () const |
Get button map. | |
int | getButton (const int buttonId) |
Get the state of a button returns 0 if can't find button. | |
std::vector< double > | getAnalog () const |
get values of the analog input | |
double | getAnalog (int i) const |
get single analog value More... | |
const std::string & | getIp () |
Get/Set the device IP. | |
void | setIp (const std::string &ip) |
const std::string & | getDeviceName () |
Get/Set the device name. | |
void | setDeviceName (const std::string &deviceName) |
Vec3d | getForce () |
Get/Set the device force. | |
void | setForce (Vec3d force) |
![]() | |
template<typename T > | |
void | postEvent (const T &e) |
Emits the event Direct observers will be immediately called, in sync Queued observers will receive the Command in their queue for later execution, reciever must implement doEvent. | |
template<typename T > | |
void | queueEvent (const T &e) |
Queues event directly to this. | |
void | doEvent () |
Do an event, if none exists return. | |
void | doAllEvents () |
Do all the events in the event queue. | |
void | foreachEvent (std::function< void(Command cmd)> func) |
Thread safe loop over all event commands, one can implement a custom handler. | |
void | rforeachEvent (std::function< void(Command cmd)> func) |
thread safe reverse loop over all event commands, one can implement a custom handler | |
void | clearEvents () |
Removes all events from queue cleans up copies of the event. | |
Protected Member Functions | |
void | initialize () |
Initialize the phantom omni device. | |
void | disable () |
Disables the phantom omni device. | |
![]() | |
DeviceClient (const std::string &name, const std::string &ip) | |
Friends | |
class | OpenHapticDeviceManager |
Additional Inherited Members | |
![]() | |
using | Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> > |
![]() | |
std::string | m_deviceName |
Device Name. | |
std::string | m_ip |
Connection device IP. | |
bool | m_trackingEnabled = true |
Tracking enabled if true. | |
bool | m_analogicEnabled = true |
Analogic enabled if true. | |
bool | m_buttonsEnabled = true |
Buttons enabled if true. | |
bool | m_forceEnabled = false |
Force enabled if true. | |
Vec3d | m_position |
Position of end effector. | |
Vec3d | m_velocity |
Linear velocity of end effector. | |
Vec3d | m_angularVelocity |
Angular velocity of the end effector. | |
Quatd | m_orientation |
Orientation of the end effector. | |
Vec3d | m_force |
Force vector. | |
Vec3d | m_endEffectorOffset = Vec3d(0.0, 0.0, 0.0) |
Offset from origin. | |
std::unordered_map< int, int > | m_buttons |
std::vector< double > | m_analogChannels |
ParallelUtils::SpinLock | m_transformLock |
Used for devices filling data from other threads. | |
ParallelUtils::SpinLock | m_forceLock |
Used for devices filling data from other threads. | |
ParallelUtils::SpinLock | m_dataLock |
Used for button and analog data. | |
![]() | |
ParallelUtils::SpinLock | eventQueueLock |
std::deque< Command > | eventQueue |
std::vector< std::pair< std::string, std::vector< Observer > > > | queuedObservers |
std::vector< std::pair< std::string, std::vector< Observer > > > | directObservers |
Subclass of DeviceClient for phantom omni Holds and updates the data sync or on its own thread Holder of data.
Definition at line 22 of file imstkOpenHapticDeviceClient.h.
|
inline |
Constructor/Destructor, only the DeviceManager can construct.
Device | name or use empty string for default device |
Definition at line 38 of file imstkOpenHapticDeviceClient.h.