PoseTransform.h
Go to the documentation of this file.
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_POSETRANSFORM_H
17 #define SURGSIM_DEVICES_DEVICEFILTERS_POSETRANSFORM_H
18 
19 #include <boost/thread/mutex.hpp>
20 #include <memory>
21 #include <string>
22 
26 #include "SurgSim/Math/Vector.h"
27 
28 namespace SurgSim
29 {
30 namespace Devices
31 {
32 
33 SURGSIM_STATIC_REGISTRATION(PoseTransform);
34 
54 {
55 public:
58  explicit PoseTransform(const std::string& name);
59 
61 
63  double getTranslationScale() const;
64 
69  void setTranslationScale(double translationScale);
70 
72  const Math::RigidTransform3d& getTransform() const;
73 
78  void setTransform(const Math::RigidTransform3d& transform);
79 
80 private:
81  void filterInput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
82  DataStructures::DataGroup* result) override;
83 
84  void filterOutput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
85  DataStructures::DataGroup* result) override;
86 
88  boost::mutex m_mutex;
89 
92 
95 
98 };
99 
100 }; // namespace Devices
101 }; // namespace SurgSim
102 
103 #endif // SURGSIM_DEVICES_DEVICEFILTERS_POSETRANSFORM_H
void setTranslationScale(double translationScale)
Set the translation scale factor so that each direction has the same scale.
Definition: PoseTransform.cpp:177
Math::RigidTransform3d m_transform
The constant pre-transform.
Definition: PoseTransform.h:91
void filterInput(const std::string &device, const DataStructures::DataGroup &dataToFilter, DataStructures::DataGroup *result) override
Filter the input data.
Definition: PoseTransform.cpp:45
Definition: CompoundShapeToGraphics.cpp:29
void setTransform(const Math::RigidTransform3d &transform)
Set the constant transform.
Definition: PoseTransform.cpp:188
boost::mutex m_mutex
The mutex that protects the transform and scaling factor.
Definition: PoseTransform.h:88
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
A device filter that transforms the input pose.
Definition: PoseTransform.h:53
PoseTransform(const std::string &name)
Constructor.
Definition: PoseTransform.cpp:34
SURGSIM_CLASSNAME(SurgSim::Devices::PoseTransform)
double getTranslationScale() const
Definition: PoseTransform.cpp:172
const Math::RigidTransform3d & getTransform() const
Definition: PoseTransform.cpp:183
void filterOutput(const std::string &device, const DataStructures::DataGroup &dataToFilter, DataStructures::DataGroup *result) override
Filter the output data.
Definition: PoseTransform.cpp:77
A collection of NamedData objects.
Definition: DataGroup.h:68
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
Math::RigidTransform3d m_transformInverse
The inverse of the pre-transform.
Definition: PoseTransform.h:94
double m_translationScale
The scaling factor applied to each direction of the translation.
Definition: PoseTransform.h:97
Definitions of small fixed-size vector types.