![]() |
A class implementing the communication with a multi-axis controller input device, for example a 3DConnexion SpaceNavigator. More...
#include <SurgSim/Devices/MultiAxis/MultiAxisDevice.h>
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... | |
![]() | |
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< RawMultiAxisDevice > | m_rawDevice |
The raw underlying device. More... | |
std::shared_ptr< PoseIntegrator > | m_filter |
The pose integration filter. More... | |
Additional Inherited Members |
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.
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. |
type | name | |
---|---|---|
bool | "led1" | If the device has at least one LED light, controls the first one. |
|
explicit |
Constructor.
uniqueName | A unique name for the device that will be used by the application. |
|
virtual |
Destructor.
|
overridevirtual |
Connect this device to an InputConsumerInterface, which will receive the data that comes from this device.
inputConsumer | The InputConsumerInterface to connect with. |
Implements SurgSim::Input::DeviceInterface.
|
staticprivate |
Get the default rotation from device ticks to radians.
|
staticprivate |
Get the default position scale from device ticks to meters.
|
overridevirtual |
Finalize (de-initialize) the device.
Implements SurgSim::Input::DeviceInterface.
|
overridevirtual |
double SurgSim::Device::MultiAxisDevice::getOrientationScale | ( | ) | const |
Gets the orientation scale for this device.
double SurgSim::Device::MultiAxisDevice::getPositionScale | ( | ) | const |
Gets the position scale for this device.
|
overridevirtual |
Getter for whether or not this device is connected with an OutputProducerInterface.
Implements SurgSim::Input::DeviceInterface.
|
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::MultiAxisDevice::isInitialized | ( | ) | const |
Check whether this device is initialized.
bool SurgSim::Device::MultiAxisDevice::isUsingAxisDominance | ( | ) | const |
Gets the axis dominance setting for this device.
|
overridevirtual |
Disconnect this device from an InputConsumerInterface, which will no longer receive data from this device.
inputConsumer | The InputConsumerInterface to disconnect from. |
Implements SurgSim::Input::DeviceInterface.
|
overridevirtual |
Disconnect this device from an OutputProducerInterface, which will no longer send data to this device.
outputProducer | The OutputProducerInterface to disconnect from. |
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.
onOff | Whether 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.
scale | The new scale. |
|
overridevirtual |
Connect this device to an OutputProducerInterface, which will send data to this device.
outputProducer | The OutputProducerInterface to connect with. |
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.
name | The name of the NamedData<bool> entry, e.g., SurgSim::DataStructures::Names::BUTTON_1. |
|
private |
The pose integration filter.
|
private |
The device name.
|
private |
The raw underlying device.