opensurgsim
TrakstarDevice.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_TRAKSTAR_TRAKSTARDEVICE_H
17 #define SURGSIM_DEVICES_TRAKSTAR_TRAKSTARDEVICE_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include "SurgSim/DataStructures/OptionalValue.h"
23 #include "SurgSim/Input/CommonDevice.h"
24 
25 namespace SurgSim
26 {
27 namespace Devices
28 {
29 class TrakstarScaffold;
30 
31 SURGSIM_STATIC_REGISTRATION(TrakstarDevice);
32 
47 {
48 public:
51  explicit TrakstarDevice(const std::string& uniqueName);
52 
53  SURGSIM_CLASSNAME(SurgSim::Devices::TrakstarDevice);
54 
56  virtual ~TrakstarDevice();
57 
58  bool initialize() override;
59 
60  bool isInitialized() const override;
61 
63  unsigned short getSensorId() const;
64 
68  void setSensorId(unsigned short id);
69 
72 
76 
82  void setUpdateRate(double rate);
83 
84 private:
85  friend class TrakstarScaffold;
86 
87  bool finalize() override;
88 
90  std::shared_ptr<TrakstarScaffold> m_scaffold;
91 
93  unsigned short m_sensorId;
94 
97 };
98 
99 }; // namespace Devices
100 }; // namespace SurgSim
101 
102 #endif // SURGSIM_DEVICES_TRAKSTAR_TRAKSTARDEVICE_H
A class implementing the communication with NDI&#39;s Trakstar electromagnetic tracker.
Definition: TrakstarDevice.h:46
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
void setOptionalUpdateRate(DataStructures::OptionalValue< double > rate)
Set the optional update rate.
Definition: TrakstarDevice.cpp:91
bool initialize() override
Fully initialize the device.
Definition: TrakstarDevice.cpp:46
DataStructures::OptionalValue< double > getOptionalUpdateRate() const
Definition: TrakstarDevice.cpp:86
bool isInitialized() const override
Definition: TrakstarDevice.cpp:69
unsigned short getSensorId() const
Definition: TrakstarDevice.cpp:75
A class that manages Natural Point TRAKSTAR devices.
Definition: TrakstarScaffold.h:42
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:35
TrakstarDevice(const std::string &uniqueName)
Constructor.
Definition: TrakstarDevice.cpp:29
void setSensorId(unsigned short id)
Set the sensor ID, used by the SDK to select between attached sensors.
Definition: TrakstarDevice.cpp:80
void setUpdateRate(double rate)
Set the update rate.
Definition: TrakstarDevice.cpp:113
virtual ~TrakstarDevice()
Destructor.
Definition: TrakstarDevice.cpp:38