PoseIntegrator.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_DEVICEFILTERS_POSEINTEGRATOR_H
17 #define SURGSIM_DEVICES_DEVICEFILTERS_POSEINTEGRATOR_H
18 
19 #include <memory>
20 #include <string>
21 
29 
30 namespace SurgSim
31 {
32 namespace DataStructures
33 {
34 class DataGroupCopier;
35 };
36 
37 namespace Device
38 {
46 {
47 public:
50 
53  explicit PoseIntegrator(const std::string& name);
54 
58  const PoseType& integrate(const PoseType& pose);
59 
60  virtual bool initialize() override;
61 
62  virtual bool finalize() override;
63 
64  virtual void initializeInput(const std::string& device,
65  const SurgSim::DataStructures::DataGroup& inputData) override;
66 
72  virtual void handleInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData) override;
73 
74  virtual bool requestOutput(const std::string& device, SurgSim::DataStructures::DataGroup* outputData) override;
75 
82  void setReset(const std::string& name);
83 
84 private:
86  PoseType m_poseResult;
87 
90 
93 
95  std::shared_ptr<SurgSim::DataStructures::DataGroupCopier> m_copier;
96 
98  std::string m_resetName;
99 
107 };
108 
109 
110 }; // namespace Device
111 }; // namespace SurgSim
112 
113 #endif // SURGSIM_DEVICES_DEVICEFILTERS_POSEINTEGRATOR_H
Definition: DriveElementFromInputBehavior.cpp:27
PoseType m_poseResult
The result of integrating the input poses.
Definition: PoseIntegrator.h:86
virtual bool requestOutput(const std::string &device, SurgSim::DataStructures::DataGroup *outputData) override
Asks the producer to provide output state to the device.
Definition: PoseIntegrator.cpp:160
A device filter that integrates the pose, turning a relative device into an absolute one...
Definition: PoseIntegrator.h:44
Interface for a producer that generates device output updates (forces, status LED state...
Definition: OutputProducerInterface.h:33
PoseIntegrator(const std::string &name)
Constructor.
Definition: PoseIntegrator.cpp:33
std::shared_ptr< SurgSim::DataStructures::DataGroupCopier > m_copier
A copier into the input DataGroup, if needed.
Definition: PoseIntegrator.h:95
std::string m_resetName
The name of the reset boolean (if any).
Definition: PoseIntegrator.h:98
Timer class, measures execution times.
Definition: Timer.h:29
const PoseType & integrate(const PoseType &pose)
Integrates the pose.
Definition: PoseIntegrator.cpp:44
int m_angularVelocityIndex
Definition: PoseIntegrator.h:104
int m_resetIndex
Definition: PoseIntegrator.h:105
virtual bool initialize() override
Fully initialize the device.
Definition: PoseIntegrator.cpp:52
Interface for a consumer that monitors device and signal state updates (pose, buttons, etc).
Definition: InputConsumerInterface.h:33
virtual void handleInput(const std::string &device, const SurgSim::DataStructures::DataGroup &inputData) override
Notifies the consumer that the application input coming from the device has been updated.
Definition: PoseIntegrator.cpp:101
virtual bool finalize() override
Finalize (de-initialize) the device.
Definition: PoseIntegrator.cpp:57
A collection of NamedData objects.
Definition: DataGroup.h:66
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
SurgSim::Framework::Timer m_timer
A timer for the update rate needed for calculating velocity.
Definition: PoseIntegrator.h:89
void setReset(const std::string &name)
Sets the string name of the boolean entry that will reset the pose to its initial value...
Definition: PoseIntegrator.cpp:170
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
A class that implements some common management code on top of the DeviceInterface.
Definition: CommonDevice.h:34
bool m_firstInput
true if the input DataGroup should be created.
Definition: PoseIntegrator.h:92
int m_poseIndex
Definition: PoseIntegrator.h:102
virtual void initializeInput(const std::string &device, const SurgSim::DataStructures::DataGroup &inputData) override
Set the initial input data group.
Definition: PoseIntegrator.cpp:62
SurgSim::Math::RigidTransform3d PoseType
The type used for poses.
Definition: PoseIntegrator.h:49
int m_linearVelocityIndex
Definition: PoseIntegrator.h:103