NovintDevice.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_NOVINT_NOVINTDEVICE_H
17 #define SURGSIM_DEVICES_NOVINT_NOVINTDEVICE_H
18 
19 #include <string>
20 
23 
24 namespace SurgSim
25 {
26 namespace Devices
27 {
28 class NovintScaffold;
29 
30 SURGSIM_STATIC_REGISTRATION(NovintDevice);
31 
70 {
71 public:
74  explicit NovintDevice(const std::string& name);
75 
77 
79  virtual ~NovintDevice();
80 
85  void setSerialNumber(const std::string& serialNumber);
86 
90  bool getSerialNumber(std::string* serialNumber) const;
91 
98  void setInitializationName(const std::string& initializationName);
99 
103  bool getInitializationName(std::string* initializationName) const;
104 
105  bool initialize() override;
106 
107  bool isInitialized() const override;
108 
113  void setPositionScale(double scale);
115  double getPositionScale() const;
116 
121  void setOrientationScale(double scale);
123  double getOrientationScale() const;
124 
129  void set7DofDevice(bool val);
132  virtual bool is7DofDevice() const;
133 
138  void setMaxForce(double force);
139 
141  double getMaxForce() const;
142 
145  void setAntigrav(Math::Vector3d antigrav);
146 
148  Math::Vector3d getAntigrav() const;
149 
150 protected:
153 
155  double m_maxForce;
156 
159 
160 private:
161  friend class NovintScaffold;
162 
163  bool finalize() override;
164 
172 
174  std::shared_ptr<NovintScaffold> m_scaffold;
175 
178 
181 
186 };
187 
188 }; // namespace Devices
189 }; // namespace SurgSim
190 
191 #endif // SURGSIM_DEVICES_NOVINT_NOVINTDEVICE_H
SurgSim::Devices::NovintDevice::m_7DofDevice
bool m_7DofDevice
True if the device is 7Dof, false if the device is 3Dof.
Definition: NovintDevice.h:152
SurgSim::Devices::NovintDevice::getPositionScale
double getPositionScale() const
Gets the position scale for this device.
Definition: NovintDevice.cpp:135
SurgSim::Devices::NovintDevice::finalize
bool finalize() override
Finalize (de-initialize) the device.
Definition: NovintDevice.cpp:113
SurgSim::Devices::NovintDevice::m_scaffold
std::shared_ptr< NovintScaffold > m_scaffold
The scaffold handles all the communication with the SDK.
Definition: NovintDevice.h:174
SurgSim::Devices::NovintDevice::getMaxForce
double getMaxForce() const
Definition: NovintDevice.cpp:174
SurgSim::Devices::NovintDevice::m_orientationScale
double m_orientationScale
Scale factor for the orientation axes; stored locally before the device is initialized.
Definition: NovintDevice.h:185
SurgSim::Devices::NovintDevice::setPositionScale
void setPositionScale(double scale)
Sets the position scale for this device.
Definition: NovintDevice.cpp:126
SurgSim::Devices::NovintDevice::setAntigrav
void setAntigrav(Math::Vector3d antigrav)
Set a constant force that gets added to all forces sent to the hardware.
Definition: NovintDevice.cpp:179
SurgSim::Devices::NovintDevice::set7DofDevice
void set7DofDevice(bool val)
Sets whether or not this is supposed to be a 7Dof device.
Definition: NovintDevice.cpp:154
SurgSim::DataStructures::OptionalValue< std::string >
SurgSim::Devices::NovintDevice::getOptionalSerialNumber
const DataStructures::OptionalValue< std::string > & getOptionalSerialNumber() const
Definition: NovintDevice.cpp:202
SurgSim::Devices::NovintDevice::m_maxForce
double m_maxForce
The maximum force magnitude (in Newtons) that should be sent to the hardware.
Definition: NovintDevice.h:155
SurgSim::Devices::NovintDevice::m_positionScale
double m_positionScale
Scale factor for the position axes; stored locally before the device is initialized.
Definition: NovintDevice.h:183
OptionalValue.h
SurgSim::Devices::NovintDevice::getSerialNumber
bool getSerialNumber(std::string *serialNumber) const
Gets the serial number used to register this device with the hardware library.
Definition: NovintDevice.cpp:68
SurgSim::Devices::NovintDevice::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Devices::NovintDevice)
SurgSim::Math::Vector3d
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
SurgSim::Devices::NovintDevice::m_initializationName
SurgSim::DataStructures::OptionalValue< std::string > m_initializationName
The name passed to the SDK to specify which hardware device should be used.
Definition: NovintDevice.h:177
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Input::CommonDevice
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35
SurgSim::Devices::NovintDevice::m_antigrav
Math::Vector3d m_antigrav
The anti-gravity force in Newtons.
Definition: NovintDevice.h:158
SurgSim::Devices::NovintDevice::getInitializationName
bool getInitializationName(std::string *initializationName) const
Gets the name used to register this device with the hardware library.
Definition: NovintDevice.cpp:88
SurgSim::Devices::NovintDevice
A class implementing the communication with a Novint Falcon device.
Definition: NovintDevice.h:69
SurgSim::Devices::NovintDevice::NovintDevice
NovintDevice(const std::string &name)
Constructor.
Definition: NovintDevice.cpp:31
SurgSim::Devices::NovintDevice::isInitialized
bool isInitialized() const override
Definition: NovintDevice.cpp:121
CommonDevice.h
SurgSim::Devices::NovintDevice::setOptionalInitializationName
void setOptionalInitializationName(const DataStructures::OptionalValue< std::string > &name)
Definition: NovintDevice.cpp:197
SurgSim::Devices::NovintDevice::setSerialNumber
void setSerialNumber(const std::string &serialNumber)
Sets the serial number used to register this device with the hardware library.
Definition: NovintDevice.cpp:58
SurgSim::Devices::NovintDevice::getOrientationScale
double getOrientationScale() const
Gets the orientation scale for this device.
Definition: NovintDevice.cpp:149
SurgSim::Devices::NovintDevice::setMaxForce
void setMaxForce(double force)
Set the maximum force that can be sent to the device.
Definition: NovintDevice.cpp:165
SurgSim::Devices::NovintDevice::setOptionalSerialNumber
void setOptionalSerialNumber(const DataStructures::OptionalValue< std::string > &serial)
Definition: NovintDevice.cpp:207
SurgSim::Devices::NovintDevice::m_serialNumber
SurgSim::DataStructures::OptionalValue< std::string > m_serialNumber
The serial number passed to the SDK to specify which hardware device should be used.
Definition: NovintDevice.h:180
SurgSim::Devices::NovintDevice::getAntigrav
Math::Vector3d getAntigrav() const
Definition: NovintDevice.cpp:187
SurgSim::Devices::NovintDevice::setInitializationName
void setInitializationName(const std::string &initializationName)
Sets the name used to register this device with the hardware library.
Definition: NovintDevice.cpp:78
SurgSim::Devices::NovintDevice::setOrientationScale
void setOrientationScale(double scale)
Sets the orientation scale for this device.
Definition: NovintDevice.cpp:140
SurgSim::Devices::NovintDevice::getOptionalInitializationName
const DataStructures::OptionalValue< std::string > & getOptionalInitializationName() const
Definition: NovintDevice.cpp:192
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
SurgSim::Devices::NovintDevice::initialize
bool initialize() override
Fully initialize the device.
Definition: NovintDevice.cpp:98
SurgSim::Devices::NovintDevice::~NovintDevice
virtual ~NovintDevice()
Destructor.
Definition: NovintDevice.cpp:50
SurgSim::Devices::NovintDevice::is7DofDevice
virtual bool is7DofDevice() const
Query if this object represents a 7 degree of freedom hardware device.
Definition: NovintDevice.cpp:160
SurgSim::Devices::NovintScaffold
A class that manages Novint Falcon devices.
Definition: NovintScaffold.h:37