ForceScale.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_FORCESCALE_H
17 #define SURGSIM_DEVICES_DEVICEFILTERS_FORCESCALE_H
18 
19 #include <boost/thread/mutex.hpp>
20 #include <string>
21 
23 
24 namespace SurgSim
25 {
26 namespace Devices
27 {
28 
29 SURGSIM_STATIC_REGISTRATION(ForceScale);
30 
36 class ForceScale : public DeviceFilter
37 {
38 public:
41  explicit ForceScale(const std::string& name);
42 
44 
47  void setForceScale(double forceScale);
48 
51  void setTorqueScale(double torqueScale);
52 
53 private:
54  void filterOutput(const std::string& device, const DataStructures::DataGroup& dataToFilter,
55  DataStructures::DataGroup* result) override;
56 
58  boost::mutex m_mutex;
59 
61  double m_forceScale;
62 
64  double m_torqueScale;
65 };
66 
67 }; // namespace Devices
68 }; // namespace SurgSim
69 
70 #endif // SURGSIM_DEVICES_DEVICEFILTERS_FORCESCALE_H
SurgSim::Devices::ForceScale::ForceScale
ForceScale(const std::string &name)
Constructor.
Definition: ForceScale.cpp:32
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::DeviceFilter
A device filter can be connected between a device and the InputConsumerInterface (e....
Definition: DeviceFilter.h:37
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
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
SurgSim::Devices::ForceScale
An output device filter that scales forces and/or torques.
Definition: ForceScale.h:36
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::m_forceScale
double m_forceScale
The scaling factor applied to each direction of the force.
Definition: ForceScale.h:61
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
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
DeviceFilter.h
SurgSim::Devices::ForceScale::m_mutex
boost::mutex m_mutex
The mutex that protects the scaling factors.
Definition: ForceScale.h:58