ForceScale.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_FORCESCALE_H
#define SURGSIM_DEVICES_DEVICEFILTERS_FORCESCALE_H
#include <boost/thread/mutex.hpp>
#include <string>
#include "SurgSim/Devices/DeviceFilters/DeviceFilter.h"
namespace SurgSim
{
namespace Devices
{
SURGSIM_STATIC_REGISTRATION(ForceScale);
class ForceScale : public DeviceFilter
{
public:
explicit ForceScale(const std::string& name);
SURGSIM_CLASSNAME(SurgSim::Devices::ForceScale);
void setForceScale(double forceScale);
void setTorqueScale(double torqueScale);
private:
void filterOutput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
DataStructures::DataGroup* result) override;
boost::mutex m_mutex;
double m_forceScale;
double m_torqueScale;
};
}; // namespace Devices
}; // namespace SurgSim
#endif // SURGSIM_DEVICES_DEVICEFILTERS_FORCESCALE_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
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::ForceScale::ForceScale
ForceScale(const std::string &name)
Constructor.
Definition: ForceScale.cpp:32
SurgSim::Devices::ForceScale::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Devices::ForceScale)
SurgSim::Devices::ForceScale::m_torqueScale
double m_torqueScale
The scaling factor applied to each direction of the torque.
Definition: ForceScale.h:64
SurgSim::Devices::ForceScale
An output device filter that scales forces and/or torques.
Definition: ForceScale.h:36
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
SurgSim::Devices::ForceScale::m_mutex
boost::mutex m_mutex
The mutex that protects the scaling factors.
Definition: ForceScale.h:58
SurgSim::Devices::ForceScale::setTorqueScale
void setTorqueScale(double torqueScale)
Set the torque scale factor so that each direction has the same scale.
Definition: ForceScale.cpp:84
SurgSim::Devices::ForceScale::m_forceScale
double m_forceScale
The scaling factor applied to each direction of the force.
Definition: ForceScale.h:61
SurgSim::Devices::ForceScale::setForceScale
void setForceScale(double forceScale)
Set the force scale factor so that each direction has the same scale.
Definition: ForceScale.cpp:78
SurgSim::Devices::ForceScale::filterOutput
void filterOutput(const std::string &device, const DataStructures::DataGroup &dataToFilter, DataStructures::DataGroup *result) override
Filter the output data.
Definition: ForceScale.cpp:39
DeviceFilter.h