RawMultiAxisDevice.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_RAWMULTIAXISDEVICE_H
17 #define SURGSIM_DEVICES_MULTIAXIS_RAWMULTIAXISDEVICE_H
18 
19 #include <memory>
20 #include <string>
21 
24 
25 namespace SurgSim
26 {
27 namespace Device
28 {
29 class RawMultiAxisScaffold;
30 
31 
56 {
57 public:
61  explicit RawMultiAxisDevice(const std::string& uniqueName);
62 
64  virtual ~RawMultiAxisDevice();
65 
66  virtual bool initialize() override;
67 
68  virtual bool finalize() override;
69 
71  bool isInitialized() const;
72 
76  void setPositionScale(double scale);
78  double getPositionScale() const;
79 
83  void setOrientationScale(double scale);
85  double getOrientationScale() const;
86 
91  void setAxisDominance(bool onOff);
93  bool isUsingAxisDominance() const;
94 
95 private:
96  // Returns the default position scale, in meters per tick.
97  static double defaultPositionScale()
98  {
99  // the position scale from Paul N's measurements of the SpaceNavigator; 1/16"/350 ticks
100  return 0.0000045;
101  }
102 
103  // Returns the default rotation scale, in radians per tick.
104  static double defaultOrientationScale()
105  {
106  // the rotation scale from Paul N's measurements of the SpaceNavigator
107  return 0.0003;
108  }
109 
110 
112  friend class RawMultiAxisScaffold;
113 
114  std::shared_ptr<RawMultiAxisScaffold> m_scaffold;
115 
122 };
123 
124 }; // namespace Device
125 }; // namespace SurgSim
126 
127 #endif // SURGSIM_DEVICES_MULTIAXIS_RAWMULTIAXISDEVICE_H
Definition: DriveElementFromInputBehavior.cpp:27
virtual bool initialize() override
Fully initialize the device.
Definition: RawMultiAxisDevice.cpp:47
bool m_useAxisDominance
Controls whether dominance will be enabled; stored locally before the device is initialized.
Definition: RawMultiAxisDevice.h:121
double m_orientationScale
Scale factor for the orientation axes; stored locally before the device is initialized.
Definition: RawMultiAxisDevice.h:119
bool isUsingAxisDominance() const
Gets the axis dominance setting for this device.
Definition: RawMultiAxisDevice.cpp:125
static double defaultPositionScale()
Definition: RawMultiAxisDevice.h:97
double m_positionScale
Scale factor for the position axes; stored locally before the device is initialized.
Definition: RawMultiAxisDevice.h:117
A class implementing the communication with a multi-axis controller input device, for example a 3DCon...
Definition: RawMultiAxisDevice.h:55
static double defaultOrientationScale()
Definition: RawMultiAxisDevice.h:104
bool isInitialized() const
Check whether this device is initialized.
Definition: RawMultiAxisDevice.cpp:77
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
MultiAxisDevice(const std::string &uniqueName)
Constructor.
Definition: MultiAxisDevice.cpp:30
double getPositionScale() const
Gets the position scale for this device.
Definition: RawMultiAxisDevice.cpp:93
RawMultiAxisDevice(const std::string &uniqueName)
Constructor.
Definition: RawMultiAxisDevice.cpp:29
A class that implements the behavior of RawMultiAxisDevice objects.
Definition: RawMultiAxisScaffold.h:37
void setOrientationScale(double scale)
Sets the orientation scale for this device.
Definition: RawMultiAxisDevice.cpp:99
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:34
virtual ~RawMultiAxisDevice()
Destructor.
Definition: RawMultiAxisDevice.cpp:38
virtual bool finalize() override
Finalize (de-initialize) the device.
Definition: RawMultiAxisDevice.cpp:67
void setAxisDominance(bool onOff)
Turns on or off the axis dominance setting for this device.
Definition: RawMultiAxisDevice.cpp:115
void setPositionScale(double scale)
Sets the position scale for this device.
Definition: RawMultiAxisDevice.cpp:83
double getOrientationScale() const
Gets the orientation scale for this device.
Definition: RawMultiAxisDevice.cpp:109
std::shared_ptr< RawMultiAxisScaffold > m_scaffold
Definition: RawMultiAxisDevice.h:114