SurgSim::Devices::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::Devices::MultiAxisDevice:

## Public Member Functions

| MultiAxisDevice (const std::string &uniqueName)
| Constructor. More...
| SURGSIM_CLASSNAME (SurgSim::Devices::MultiAxisDevice)
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::Devices::FilteredDevice
| FilteredDevice (const std::string &name)
| Constructor. More...
| SURGSIM_CLASSNAME (SurgSim::Devices::FilteredDevice)
virtual | ~FilteredDevice ()
| Destructor. More...
std::string | getName () const override
| Return a (hopefully unique) device name. More...
bool | initialize () override
| Fully initialize the device. More...
bool | isInitialized () const override
bool | addInputConsumer (std::shared_ptr< Input::InputConsumerInterface > inputConsumer) override
bool | removeInputConsumer (std::shared_ptr< Input::InputConsumerInterface > inputConsumer) override
void | clearInputConsumers () override
| Removes all InputConsumers. More...
bool | setOutputProducer (std::shared_ptr< Input::OutputProducerInterface > outputProducer) override
bool | removeOutputProducer (std::shared_ptr< Input::OutputProducerInterface > outputProducer) override
bool | hasOutputProducer () override
| Query if this object has output producer. More...
void | clearOutputProducer () override
| Removes any OutputProducer. More...
void | setDevice (std::shared_ptr< Input::DeviceInterface > device)
| Sets the raw/base device. More...
void | addFilter (std::shared_ptr< DeviceFilter > filter)
| Adds a DeviceFilter. More...
const std::vector< std::shared_ptr< Input::DeviceInterface > > & | getDevices () const
bool | setDevices (const std::vector< std::shared_ptr< Input::DeviceInterface >> &devices)
| Sets the devices. More...
Public Member Functions inherited from SurgSim::Input::DeviceInterface
virtual | ~DeviceInterface ()
| Virtual destructor (empty). More...
virtual std::string | getClassName () const =0
| The class name for this class. More...
virtual bool | addInputConsumer (std::shared_ptr< InputConsumerInterface > inputConsumer)=0
| Adds an input consumer that will be notified when the application input state is updated. More...
virtual bool | removeInputConsumer (std::shared_ptr< InputConsumerInterface > inputConsumer)=0
| Removes an input consumer previously added via addInputConsumer. More...
virtual bool | setOutputProducer (std::shared_ptr< OutputProducerInterface > outputProducer)=0
| Sets an output producer that will be asked for application output state when the device needs it. More...
virtual bool | removeOutputProducer (std::shared_ptr< OutputProducerInterface > outputProducer)=0
| Removes an output producer previously added via setOutputProducer. More...
Public Member Functions inherited from SurgSim::Framework::Accessible
| Accessible ()
| Default Constructor. More...
| ~Accessible ()
| Destructor. More...
template<class T >
T | getValue (const std::string &name) const
| Retrieves the value with the name by executing the getter if it is found and tries to convert it to the given type. More...
boost::any | getValue (const std::string &name) const
| Retrieves the value with the name by executing the getter if it is found. More...
template<class T >
bool | getValue (const std::string &name, T *value) const
| Retrieves the value with the name by executing the getter if it is found, and converts it to the type of the output parameter. More...
void | setValue (const std::string &name, const boost::any &value)
| Sets a value of a property that has setter. More...
bool | isReadable (const std::string &name) const
| Check whether a property is readable. More...
bool | isWriteable (const std::string &name) const
| Check whether a property is writable. More...
void | setGetter (const std::string &name, GetterType func)
| Sets a getter for a given property. More...
void | setSetter (const std::string &name, SetterType func)
| Sets a setter for a given property. More...
void | setAccessors (const std::string &name, GetterType getter, SetterType setter)
| Sets the accessors getter and setter in one function. More...
void | removeAccessors (const std::string &name)
| Removes all the accessors (getter and setter) for a given property. More...
void | forwardProperty (const std::string &name, const Accessible &target, const std::string &targetProperty)
| Adds a property with the given name that uses the targets accessors, in effect forwarding the value to the target. More...
void | setSerializable (const std::string &name, EncoderType encoder, DecoderType decoder)
| Sets the functions used to convert data from and to a YAML::Node. More...
void | setDecoder (const std::string &name, DecoderType decoder)
| Sets the functions used to convert data from a YAML::Node. More...
YAML::Node | encode () const
| Encode this Accessible to a YAML::Node. More...
void | decode (const YAML::Node &node, const std::vector< std::string > &ignoredProperties=std::vector< std::string >())
| Decode this Accessible from a YAML::Node, will throw an exception if the data type cannot be converted. More...
template<>
boost::any | getValue (const std::string &name) const

## 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::shared_ptr< RawMultiAxisDevice > | m_rawDevice
| The raw underlying device. More...
std::shared_ptr< PoseIntegrator > | m_filter
| The pose integration filter. More...

## Additional Inherited Members

Public Types inherited from SurgSim::Framework::Accessible
typedef std::function< boost::any(void)> | GetterType
typedef std::function< void(boost::any)> | SetterType
typedef std::function< YAML::Node(void)> | EncoderType
typedef std::function< void(const YAML::Node *)> | DecoderType
Public Types inherited from SurgSim::Framework::FactoryBase1< DeviceInterface, std::string >
typedef ObjectFactory1< DeviceInterface, std::string > | FactoryType
Static Public Member Functions inherited from SurgSim::Framework::FactoryBase1< DeviceInterface, std::string >
static FactoryType & | getFactory ()

## 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

## Constructor & Destructor Documentation

## MultiAxisDevice()

SurgSim::Devices::MultiAxisDevice::MultiAxisDevice | ( | const std::string & | uniqueName | ) |

explicit

Constructor.

Parameters

  uniqueName | A unique name for the device that will be used by the application.

## Member Function Documentation

## defaultOrientationScale()

double SurgSim::Devices::MultiAxisDevice::defaultOrientationScale | ( |  | ) |

static private

Get the default rotation from device ticks to radians.

Returns
  The default rotation scale, in radians per tick.

## defaultPositionScale()

double SurgSim::Devices::MultiAxisDevice::defaultPositionScale | ( |  | ) |

static private

Get the default position scale from device ticks to meters.

Returns
  The default position scale, in meters per tick.

## getOrientationScale()

double SurgSim::Devices::MultiAxisDevice::getOrientationScale | ( |  | ) | const

Gets the orientation scale for this device.

Returns
  The orientation scale.

## getPositionScale()

double SurgSim::Devices::MultiAxisDevice::getPositionScale | ( |  | ) | const

Gets the position scale for this device.

Returns
  The position scale.

## isUsingAxisDominance()

bool SurgSim::Devices::MultiAxisDevice::isUsingAxisDominance | ( |  | ) | const

Gets the axis dominance setting for this device.

Returns
  True if using axis dominance.

## setAxisDominance()

void SurgSim::Devices::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

  onOff | Whether or not to use only the dominant axis.

## setOrientationScale()

void SurgSim::Devices::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

  scale | The new scale.

Note
  The default value for a raw device tries to correspond to the actual physical motion of the device.

## setPositionScale()

void SurgSim::Devices::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.

## setReset()

void SurgSim::Devices::MultiAxisDevice::setReset | ( | const std::string & | name | ) |

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

Parameters

  name | The name of the NamedData<bool> entry, e.g., SurgSim::DataStructures::Names::BUTTON_1.

See also
  PoseIntegrator::setReset

## SURGSIM_CLASSNAME()

SurgSim::Devices::MultiAxisDevice::SURGSIM_CLASSNAME | ( | SurgSim::Devices::MultiAxisDevice |  | ) |

## Member Data Documentation

## m_filter

std::shared_ptr<PoseIntegrator> SurgSim::Devices::MultiAxisDevice::m_filter

private

The pose integration filter.

## m_rawDevice

std::shared_ptr<RawMultiAxisDevice> SurgSim::Devices::MultiAxisDevice::m_rawDevice

private

The raw underlying device.

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

- SurgSim/Devices/MultiAxis/MultiAxisDevice.h
- SurgSim/Devices/MultiAxis/MultiAxisDevice.cpp