opensurgsim
PhantomScaffold.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_PHANTOM_PHANTOMSCAFFOLD_H
17 #define SURGSIM_DEVICES_PHANTOM_PHANTOMSCAFFOLD_H
18 
19 #include <memory>
20 
21 #include "SurgSim/Framework/Logger.h"
22 #include "SurgSim/DataStructures/DataGroup.h"
23 
24 namespace SurgSim
25 {
26 namespace Devices
27 {
28 
29 class PhantomDevice;
30 
39 {
40 public:
43 
46 
50  static std::shared_ptr<PhantomScaffold> getOrCreateSharedInstance();
51 
52 private:
54  struct StateData;
56  struct DeviceData;
58  class Callback;
60  class Handle;
61 
62  friend class PhantomDevice;
63 
69  bool registerDevice(PhantomDevice* device);
70 
76  bool unregisterDevice(const PhantomDevice* device);
77 
81  bool initializeDeviceState(DeviceData* info);
82 
86  bool finalizeDeviceState(DeviceData* info);
87 
91  bool updateDevice(DeviceData* info);
92 
102  void calculateForceAndTorque(DeviceData* info);
103 
106  void setInputData(DeviceData* info);
107 
111  bool runHapticFrame();
112 
115  bool createHapticLoop();
116 
120  bool destroyHapticLoop();
121 
124  bool startScheduler();
125 
128  bool stopScheduler();
129 
131  static SurgSim::DataStructures::DataGroup buildDeviceInputData();
132 
134  std::shared_ptr<SurgSim::Framework::Logger> m_logger;
136  std::unique_ptr<StateData> m_state;
137 };
138 
139 }; // namespace Devices
140 }; // namespace SurgSim
141 
142 #endif // SURGSIM_DEVICES_PHANTOM_PHANTOMSCAFFOLD_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Definition: PhantomScaffold.cpp:177
static std::shared_ptr< PhantomScaffold > getOrCreateSharedInstance()
Gets or creates the scaffold shared by all PhantomDevice instances.
Definition: PhantomScaffold.cpp:691
A collection of NamedData objects.
Definition: DataGroup.h:68
Definition: PhantomScaffold.cpp:290
Definition: PhantomScaffold.cpp:244
Definition: PhantomScaffold.cpp:82
PhantomScaffold()
Constructor.
Definition: PhantomScaffold.cpp:328
~PhantomScaffold()
Destructor.
Definition: PhantomScaffold.cpp:344
A class that manages Sensable PHANTOM devices.
Definition: PhantomScaffold.h:38
A class implementing the communication with a SensAble/Geomagic PHANTOM device.
Definition: PhantomDevice.h:58