opensurgsim
RawMultiAxisDevice.h
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 
22 #include "SurgSim/Input/CommonDevice.h"
23 #include "SurgSim/Devices/MultiAxis/MultiAxisDevice.h"
24 
25 namespace SurgSim
26 {
27 namespace Devices
28 {
29 class RawMultiAxisScaffold;
30 
31 SURGSIM_STATIC_REGISTRATION(RawMultiAxisDevice);
32 
57 {
58 public:
62  explicit RawMultiAxisDevice(const std::string& uniqueName);
63 
64  SURGSIM_CLASSNAME(SurgSim::Devices::RawMultiAxisDevice);
65 
67  virtual ~RawMultiAxisDevice();
68 
69  bool initialize() override;
70 
71  bool isInitialized() const override;
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  bool finalize() override;
97 
98  // Returns the default position scale, in meters per tick.
99  static double defaultPositionScale()
100  {
101  // the position scale from Paul N's measurements of the SpaceNavigator; 1/16"/350 ticks
102  return 0.0000045;
103  }
104 
105  // Returns the default rotation scale, in radians per tick.
106  static double defaultOrientationScale()
107  {
108  // the rotation scale from Paul N's measurements of the SpaceNavigator
109  return 0.0003;
110  }
111 
112 
113  friend SurgSim::Devices::MultiAxisDevice::MultiAxisDevice(const std::string& uniqueName);
114  friend class RawMultiAxisScaffold;
115 
116  std::shared_ptr<RawMultiAxisScaffold> m_scaffold;
117 
119  double m_positionScale;
121  double m_orientationScale;
123  bool m_useAxisDominance;
124 };
125 
126 }; // namespace Devices
127 }; // namespace SurgSim
128 
129 #endif // SURGSIM_DEVICES_MULTIAXIS_RAWMULTIAXISDEVICE_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
void setAxisDominance(bool onOff)
Turns on or off the axis dominance setting for this device.
Definition: RawMultiAxisDevice.cpp:119
virtual ~RawMultiAxisDevice()
Destructor.
Definition: RawMultiAxisDevice.cpp:44
bool isInitialized() const override
Definition: RawMultiAxisDevice.cpp:81
bool initialize() override
Fully initialize the device.
Definition: RawMultiAxisDevice.cpp:53
A class that implements the behavior of RawMultiAxisDevice objects.
Definition: RawMultiAxisScaffold.h:37
A class implementing the communication with a multi-axis controller input device, for example a 3DCon...
Definition: RawMultiAxisDevice.h:56
MultiAxisDevice(const std::string &uniqueName)
Constructor.
Definition: MultiAxisDevice.cpp:31
double getOrientationScale() const
Gets the orientation scale for this device.
Definition: RawMultiAxisDevice.cpp:113
RawMultiAxisDevice(const std::string &uniqueName)
Constructor.
Definition: RawMultiAxisDevice.cpp:29
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35
bool isUsingAxisDominance() const
Gets the axis dominance setting for this device.
Definition: RawMultiAxisDevice.cpp:129
void setPositionScale(double scale)
Sets the position scale for this device.
Definition: RawMultiAxisDevice.cpp:87
double getPositionScale() const
Gets the position scale for this device.
Definition: RawMultiAxisDevice.cpp:97
void setOrientationScale(double scale)
Sets the orientation scale for this device.
Definition: RawMultiAxisDevice.cpp:103