opensurgsim
PoseIntegrator.h
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013-2015, 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_DEVICEFILTERS_POSEINTEGRATOR_H
17 #define SURGSIM_DEVICES_DEVICEFILTERS_POSEINTEGRATOR_H
18 
19 #include <memory>
20 #include <string>
21 
22 #include "SurgSim/DataStructures/OptionalValue.h"
23 #include "SurgSim/Devices/DeviceFilters/DeviceFilter.h"
24 #include "SurgSim/Framework/Timer.h"
26 
27 namespace SurgSim
28 {
29 namespace DataStructures
30 {
31 class DataGroupCopier;
32 };
33 
34 namespace Devices
35 {
36 
37 SURGSIM_STATIC_REGISTRATION(PoseIntegrator);
38 
45 {
46 public:
49 
52  explicit PoseIntegrator(const std::string& name);
53 
54  SURGSIM_CLASSNAME(SurgSim::Devices::PoseIntegrator);
55 
59  const PoseType& integrate(const PoseType& pose);
60 
61  void initializeInput(const std::string& device, const DataStructures::DataGroup& inputData) override;
62 
68  void handleInput(const std::string& device, const DataStructures::DataGroup& inputData) override;
69 
76  void setReset(const std::string& name);
77 
78 protected:
81  void filterOutput(const std::string& device,
82  const SurgSim::DataStructures::DataGroup& dataToFilter,
83  SurgSim::DataStructures::DataGroup* result) override;
84 
85 private:
87  PoseType m_poseResult;
88 
90  Framework::Timer m_timer;
91 
93  std::shared_ptr<DataStructures::DataGroupCopier> m_copier;
94 
96  std::string m_resetName;
97 
99 };
100 
101 
102 }; // namespace Devices
103 }; // namespace SurgSim
104 
105 #endif // SURGSIM_DEVICES_DEVICEFILTERS_POSEINTEGRATOR_H
Math::RigidTransform3d PoseType
The type used for poses.
Definition: PoseIntegrator.h:48
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
A device filter can be connected between a device and the InputConsumerInterface (e.g., InputComponent) and/or the OutputProducerInterface (e.g., OutputComponent), and can alter the data being passed from/to the device.
Definition: DeviceFilter.h:37
Timer class, measures execution times.
Definition: Timer.h:31
A collection of NamedData objects.
Definition: DataGroup.h:68
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
A device filter that integrates the pose, turning a relative device into an absolute one...
Definition: PoseIntegrator.h:44