PoseTransform.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2015, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_DEVICES_DEVICEFILTERS_POSETRANSFORM_H
#define SURGSIM_DEVICES_DEVICEFILTERS_POSETRANSFORM_H
#include <boost/thread/mutex.hpp>
#include <memory>
#include <string>
#include "SurgSim/DataStructures/DataGroup.h"
#include "SurgSim/Devices/DeviceFilters/DeviceFilter.h"
#include "SurgSim/Math/RigidTransform.h"
#include "SurgSim/Math/Vector.h"
namespace SurgSim
{
namespace Devices
{
SURGSIM_STATIC_REGISTRATION(PoseTransform);
class PoseTransform : public DeviceFilter
{
public:
explicit PoseTransform(const std::string& name);
SURGSIM_CLASSNAME(SurgSim::Devices::PoseTransform);
double getTranslationScale() const;
void setTranslationScale(double translationScale);
const Math::RigidTransform3d& getTransform() const;
void setTransform(const Math::RigidTransform3d& transform);
private:
void filterInput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
DataStructures::DataGroup* result) override;
void filterOutput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
DataStructures::DataGroup* result) override;
boost::mutex m_mutex;
Math::RigidTransform3d m_transform;
Math::RigidTransform3d m_transformInverse;
double m_translationScale;
};
}; // namespace Devices
}; // namespace SurgSim
#endif // SURGSIM_DEVICES_DEVICEFILTERS_POSETRANSFORM_H
SurgSim::Devices::PoseTransform::setTranslationScale
void setTranslationScale(double translationScale)
Set the translation scale factor so that each direction has the same scale.
Definition: PoseTransform.cpp:177
SurgSim::Devices::PoseTransform::m_transform
Math::RigidTransform3d m_transform
The constant pre-transform.
Definition: PoseTransform.h:91
SurgSim::Devices::PoseTransform::filterInput
void filterInput(const std::string &device, const DataStructures::DataGroup &dataToFilter, DataStructures::DataGroup *result) override
Filter the input data.
Definition: PoseTransform.cpp:45
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Devices::PoseTransform::setTransform
void setTransform(const Math::RigidTransform3d &transform)
Set the constant transform.
Definition: PoseTransform.cpp:188
DataGroup.h
SurgSim::Devices::PoseTransform::m_mutex
boost::mutex m_mutex
The mutex that protects the transform and scaling factor.
Definition: PoseTransform.h:88
SurgSim::Devices::DeviceFilter
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
SurgSim::Devices::PoseTransform
A device filter that transforms the input pose.
Definition: PoseTransform.h:53
SurgSim::Devices::PoseTransform::PoseTransform
PoseTransform(const std::string &name)
Constructor.
Definition: PoseTransform.cpp:34
SurgSim::Devices::PoseTransform::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Devices::PoseTransform)
SurgSim::Devices::PoseTransform::getTranslationScale
double getTranslationScale() const
Definition: PoseTransform.cpp:172
SurgSim::Devices::PoseTransform::getTransform
const Math::RigidTransform3d & getTransform() const
Definition: PoseTransform.cpp:183
SurgSim::Devices::PoseTransform::filterOutput
void filterOutput(const std::string &device, const DataStructures::DataGroup &dataToFilter, DataStructures::DataGroup *result) override
Filter the output data.
Definition: PoseTransform.cpp:77
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
RigidTransform.h
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
SurgSim::Math::RigidTransform3d
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
SurgSim::Devices::PoseTransform::m_transformInverse
Math::RigidTransform3d m_transformInverse
The inverse of the pre-transform.
Definition: PoseTransform.h:94
SurgSim::Devices::PoseTransform::m_translationScale
double m_translationScale
The scaling factor applied to each direction of the translation.
Definition: PoseTransform.h:97
Vector.h
Definitions of small fixed-size vector types.
DeviceFilter.h