Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
SurgSim::Device::MultiAxisDevice Class Reference

A class implementing the communication with a multi-axis controller input device, for example a 3DConnexion SpaceNavigator. More...

#include <SurgSim/Devices/MultiAxis/MultiAxisDevice.h>

Inheritance diagram for SurgSim::Device::MultiAxisDevice:
SurgSim::Input::DeviceInterface

Public Member Functions

 MultiAxisDevice (const std::string &uniqueName)
 Constructor. More...
 
virtual ~MultiAxisDevice ()
 Destructor. More...
 
virtual std::string getName () const override
 Get the device name. 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...
 
virtual bool addInputConsumer (std::shared_ptr< SurgSim::Input::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< SurgSim::Input::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< SurgSim::Input::OutputProducerInterface > outputProducer) override
 Connect this device to an OutputProducerInterface, which will send data to this device. More...
 
virtual bool removeOutputProducer (std::shared_ptr< SurgSim::Input::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...
 
void setPositionScale (double scale)
 Sets the position scale for this device. More...
 
double getPositionScale () const
 Gets the position scale for this device. More...
 
void setOrientationScale (double scale)
 Sets the orientation scale for this device. More...
 
double getOrientationScale () const
 Gets the orientation scale for this device. More...
 
void setAxisDominance (bool onOff)
 Turns on or off the axis dominance setting for this device. More...
 
bool isUsingAxisDominance () const
 Gets the axis dominance setting for this device. More...
 
void setReset (const std::string &name)
 Sets the string name of the boolean entry that will reset the pose to its initial value. More...
 
- Public Member Functions inherited from SurgSim::Input::DeviceInterface
virtual ~DeviceInterface ()
 Virtual destructor (empty). More...
 

Static Private Member Functions

static double defaultPositionScale ()
 Get the default position scale from device ticks to meters. More...
 
static double defaultOrientationScale ()
 Get the default rotation from device ticks to radians. More...
 

Private Attributes

std::string m_name
 The device name. More...
 
std::shared_ptr< RawMultiAxisDevicem_rawDevice
 The raw underlying device. More...
 
std::shared_ptr< PoseIntegratorm_filter
 The pose integration filter. More...
 

Additional Inherited Members

Detailed Description

A class implementing the communication with a multi-axis controller input device, for example a 3DConnexion SpaceNavigator.

This object will integrate the output of the physical device, treating it as a differential device. In other words, holding the controller moves the pose and releasing the controller lets the pose hold steady in its new state.

Application input provided by the device:
type name
pose "pose" Absolute device pose (units are ill-defined, but nominally meters).
bool "button1" True if button 1 exists and is pressed.
bool "button2" True if button 2 exists and is pressed.
bool "button3" True if button 3 exists and is pressed.
bool "button4" True if button 4 exists and is pressed.
Application output used by the device:
type name
bool "led1" If the device has at least one LED light, controls the first one.
See also
RawMultiAxisDevice, SurgSim::Input::DeviceInterface

Constructor & Destructor Documentation

SurgSim::Device::MultiAxisDevice::MultiAxisDevice ( const std::string uniqueName)
explicit

Constructor.

Parameters
uniqueNameA unique name for the device that will be used by the application.
SurgSim::Device::MultiAxisDevice::~MultiAxisDevice ( )
virtual

Destructor.

Member Function Documentation

bool SurgSim::Device::MultiAxisDevice::addInputConsumer ( std::shared_ptr< SurgSim::Input::InputConsumerInterface inputConsumer)
overridevirtual

Connect this device to an InputConsumerInterface, which will receive the data that comes from this device.

Parameters
inputConsumerThe InputConsumerInterface to connect with.
Returns
True if successful.

Implements SurgSim::Input::DeviceInterface.

double SurgSim::Device::MultiAxisDevice::defaultOrientationScale ( )
staticprivate

Get the default rotation from device ticks to radians.

Returns
The default rotation scale, in radians per tick.
double SurgSim::Device::MultiAxisDevice::defaultPositionScale ( )
staticprivate

Get the default position scale from device ticks to meters.

Returns
The default position scale, in meters per tick.
bool SurgSim::Device::MultiAxisDevice::finalize ( )
overridevirtual

Finalize (de-initialize) the device.

Returns
True on success.

Implements SurgSim::Input::DeviceInterface.

std::string SurgSim::Device::MultiAxisDevice::getName ( ) const
overridevirtual

Get the device name.

Returns
The device name.

Implements SurgSim::Input::DeviceInterface.

double SurgSim::Device::MultiAxisDevice::getOrientationScale ( ) const

Gets the orientation scale for this device.

Returns
The orientation scale.
double SurgSim::Device::MultiAxisDevice::getPositionScale ( ) const

Gets the position scale for this device.

Returns
The position scale.
bool SurgSim::Device::MultiAxisDevice::hasOutputProducer ( )
overridevirtual

Getter for whether or not this device is connected with an OutputProducerInterface.

Returns
True if an OutputProducerInterface is connected.

Implements SurgSim::Input::DeviceInterface.

bool SurgSim::Device::MultiAxisDevice::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.

Returns
True on success.

Implements SurgSim::Input::DeviceInterface.

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

Check whether this device is initialized.

Returns
True if initialized.
bool SurgSim::Device::MultiAxisDevice::isUsingAxisDominance ( ) const

Gets the axis dominance setting for this device.

Returns
True if using axis dominance.
bool SurgSim::Device::MultiAxisDevice::removeInputConsumer ( std::shared_ptr< SurgSim::Input::InputConsumerInterface inputConsumer)
overridevirtual

Disconnect this device from an InputConsumerInterface, which will no longer receive data from this device.

Parameters
inputConsumerThe InputConsumerInterface to disconnect from.
Returns
True if successful.

Implements SurgSim::Input::DeviceInterface.

bool SurgSim::Device::MultiAxisDevice::removeOutputProducer ( std::shared_ptr< SurgSim::Input::OutputProducerInterface outputProducer)
overridevirtual

Disconnect this device from an OutputProducerInterface, which will no longer send data to this device.

Parameters
outputProducerThe OutputProducerInterface to disconnect from.
Returns
True if successful.

Implements SurgSim::Input::DeviceInterface.

void SurgSim::Device::MultiAxisDevice::setAxisDominance ( bool  onOff)

Turns on or off the axis dominance setting for this device.

When axis dominance is on, only one (the largest) of the 6 pure axis directions is allowed to be active. In other words, the device will be translating in X, or in Y, or in Z, or rotating around X, or around Y, or around Z; but only one of those at a time.

Parameters
onOffWhether or not to use only the dominant axis.
void SurgSim::Device::MultiAxisDevice::setOrientationScale ( double  scale)

Sets the orientation scale for this device.

The orientation scale controls how much the pose changes for a given device rotation.

Parameters
scaleThe new scale.
Note
The default value for a raw device tries to correspond to the actual physical motion of the device.
bool SurgSim::Device::MultiAxisDevice::setOutputProducer ( std::shared_ptr< SurgSim::Input::OutputProducerInterface outputProducer)
overridevirtual

Connect this device to an OutputProducerInterface, which will send data to this device.

Parameters
outputProducerThe OutputProducerInterface to connect with.
Returns
True if successful.

Implements SurgSim::Input::DeviceInterface.

void SurgSim::Device::MultiAxisDevice::setPositionScale ( double  scale)

Sets the position scale for this device.

The position scale controls how much the pose changes for a given device translation. The default value for a raw device tries to correspond to the actual physical motion of the device.

void SurgSim::Device::MultiAxisDevice::setReset ( const std::string name)

Sets the string name of the boolean entry that will reset the pose to its initial value.

Parameters
nameThe name of the NamedData<bool> entry, e.g., SurgSim::DataStructures::Names::BUTTON_1.
See also
PoseIntegrator::setReset

Member Data Documentation

std::shared_ptr<PoseIntegrator> SurgSim::Device::MultiAxisDevice::m_filter
private

The pose integration filter.

std::string SurgSim::Device::MultiAxisDevice::m_name
private

The device name.

std::shared_ptr<RawMultiAxisDevice> SurgSim::Device::MultiAxisDevice::m_rawDevice
private

The raw underlying device.


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