All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultiAxisDevice.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_DEVICES_MULTIAXIS_MULTIAXISDEVICE_H
17 #define SURGSIM_DEVICES_MULTIAXIS_MULTIAXISDEVICE_H
18 
19 #include <memory>
20 #include <string>
21 
23 
24 namespace SurgSim
25 {
26 namespace Device
27 {
28 
29 class RawMultiAxisDevice;
30 class PoseIntegrator;
31 
32 
56 {
57 public:
60  explicit MultiAxisDevice(const std::string& uniqueName);
61 
63  virtual ~MultiAxisDevice();
64 
67  virtual std::string getName() const override;
68 
73  virtual bool initialize() override;
74 
77  virtual bool finalize() override;
78 
81  bool isInitialized() const;
82 
86  virtual bool addInputConsumer(std::shared_ptr<SurgSim::Input::InputConsumerInterface> inputConsumer) override;
87 
91  virtual bool removeInputConsumer(std::shared_ptr<SurgSim::Input::InputConsumerInterface> inputConsumer) override;
92 
96  virtual bool setOutputProducer(std::shared_ptr<SurgSim::Input::OutputProducerInterface> outputProducer) override;
97 
101  virtual bool removeOutputProducer(std::shared_ptr<SurgSim::Input::OutputProducerInterface> outputProducer) override;
102 
105  virtual bool hasOutputProducer() override;
106 
110  void setPositionScale(double scale);
111 
114  double getPositionScale() const;
115 
120  void setOrientationScale(double scale);
121 
124  double getOrientationScale() const;
125 
131  void setAxisDominance(bool onOff);
132 
135  bool isUsingAxisDominance() const;
136 
140  void setReset(const std::string& name);
141 
142 private:
145  static double defaultPositionScale();
146 
149  static double defaultOrientationScale();
150 
152  std::string m_name;
153 
155  std::shared_ptr<RawMultiAxisDevice> m_rawDevice;
156 
158  std::shared_ptr<PoseIntegrator> m_filter;
159 };
160 
161 }; // namespace Device
162 }; // namespace SurgSim
163 
164 #endif // SURGSIM_DEVICES_MULTIAXIS_MULTIAXISDEVICE_H
virtual ~MultiAxisDevice()
Destructor.
Definition: MultiAxisDevice.cpp:43
virtual bool finalize() override
Finalize (de-initialize) the device.
Definition: MultiAxisDevice.cpp:64
std::shared_ptr< PoseIntegrator > m_filter
The pose integration filter.
Definition: MultiAxisDevice.h:158
void setReset(const std::string &name)
Sets the string name of the boolean entry that will reset the pose to its initial value...
Definition: MultiAxisDevice.cpp:147
static double defaultOrientationScale()
Get the default rotation from device ticks to radians.
Definition: MultiAxisDevice.cpp:142
double getOrientationScale() const
Gets the orientation scale for this device.
Definition: MultiAxisDevice.cpp:121
bool isInitialized() const
Check whether this device is initialized.
Definition: MultiAxisDevice.cpp:73
virtual bool hasOutputProducer() override
Getter for whether or not this device is connected with an OutputProducerInterface.
Definition: MultiAxisDevice.cpp:98
MultiAxisDevice(const std::string &uniqueName)
Constructor.
Definition: MultiAxisDevice.cpp:30
virtual std::string getName() const override
Get the device name.
Definition: MultiAxisDevice.cpp:48
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 de...
Definition: MultiAxisDevice.cpp:83
bool isUsingAxisDominance() const
Gets the axis dominance setting for this device.
Definition: MultiAxisDevice.cpp:132
std::shared_ptr< RawMultiAxisDevice > m_rawDevice
The raw underlying device.
Definition: MultiAxisDevice.h:155
virtual bool initialize() override
Fully initialize the device.
Definition: MultiAxisDevice.cpp:54
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...
Definition: MultiAxisDevice.cpp:93
void setAxisDominance(bool onOff)
Turns on or off the axis dominance setting for this device.
Definition: MultiAxisDevice.cpp:126
Interface used to communicate with user-interface hardware devices.
Definition: DeviceInterface.h:39
double getPositionScale() const
Gets the position scale for this device.
Definition: MultiAxisDevice.cpp:109
void setPositionScale(double scale)
Sets the position scale for this device.
Definition: MultiAxisDevice.cpp:103
std::string m_name
The device name.
Definition: MultiAxisDevice.h:152
virtual bool setOutputProducer(std::shared_ptr< SurgSim::Input::OutputProducerInterface > outputProducer) override
Connect this device to an OutputProducerInterface, which will send data to this device.
Definition: MultiAxisDevice.cpp:88
A class implementing the communication with a multi-axis controller input device, for example a 3DCon...
Definition: MultiAxisDevice.h:55
static double defaultPositionScale()
Get the default position scale from device ticks to meters.
Definition: MultiAxisDevice.cpp:137
void setOrientationScale(double scale)
Sets the orientation scale for this device.
Definition: MultiAxisDevice.cpp:115
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 de...
Definition: MultiAxisDevice.cpp:78