MovingSquareForce.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_TESTING_VISUALTESTCOMMON_MOVINGSQUAREFORCE_H
17 #define SURGSIM_TESTING_VISUALTESTCOMMON_MOVINGSQUAREFORCE_H
18 
19 #include <string>
20 
24 
26 
27 
32 {
33 public:
35  MovingSquareForce(const std::string& toolDeviceName, const std::string& squareDeviceName);
36 
37  virtual void initializeInput(const std::string& device,
38  const SurgSim::DataStructures::DataGroup& inputData) override;
39 
40  virtual void handleInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData) override;
41 
42  virtual bool requestOutput(const std::string& device, SurgSim::DataStructures::DataGroup* outputData) override;
43 
44 protected:
47  void updateTool(const SurgSim::DataStructures::DataGroup& toolInputData);
48 
51  void updateSquare(const SurgSim::DataStructures::DataGroup& squareInputData);
52 
59 
60 private:
63  {
66 
75  };
76 
77 
82 
85 
91  double m_forceLimit;
92 
97 
100 };
101 
102 #endif // SURGSIM_TESTING_VISUALTESTCOMMON_MOVINGSQUAREFORCE_H
SurgSim::Framework::LockedContainer< SquarePoseVectors > m_square
Points and directions defined by the pose of the square.
Definition: MovingSquareForce.h:94
SurgSim::DataStructures::DataGroup m_outputData
Internally stored output data (force and torque).
Definition: MovingSquareForce.h:84
const std::string m_toolDeviceName
Name of the device used as the tool.
Definition: MovingSquareForce.h:79
Interface for a producer that generates device output updates (forces, status LED state...
Definition: OutputProducerInterface.h:33
SurgSim::Math::Vector3d m_tipPoint
The location of the "tip" (i.e. interacting point) of the tool, in the local frame relative to the to...
Definition: MovingSquareForce.h:99
SurgSim::Math::Vector3d center
The location of the center of the square in world coordinates.
Definition: MovingSquareForce.h:74
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: MovingSquareForce.cpp:65
MovingSquareForce(const std::string &toolDeviceName, const std::string &squareDeviceName)
Constructor.
Definition: MovingSquareForce.cpp:43
double m_forceLimit
The maximum force before the application allows the tool to pop through.
Definition: MovingSquareForce.h:91
SurgSim::Math::Vector3d normal
The unit normal vector of the square.
Definition: MovingSquareForce.h:68
SurgSim::Math::Vector3d edgeDirectionY
The unit direction along the other pair of edges of the square.
Definition: MovingSquareForce.h:72
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
virtual bool requestOutput(const std::string &device, SurgSim::DataStructures::DataGroup *outputData) override
Asks the producer to provide output state to the device.
Definition: MovingSquareForce.cpp:116
Interface for a consumer that monitors device and signal state updates (pose, buttons, etc).
Definition: InputConsumerInterface.h:33
A simple listener to calculate collision force against a square area for the example application...
Definition: MovingSquareForce.h:31
A collection of NamedData objects.
Definition: DataGroup.h:66
void updateTool(const SurgSim::DataStructures::DataGroup &toolInputData)
Updates the state of the tool as described by toolInputData.
Definition: MovingSquareForce.cpp:81
SquarePoseVectors()
Constructor.
Definition: MovingSquareForce.cpp:34
SurgSim::Math::Vector3d computeForce(const SurgSim::Math::Vector3d &position)
Calculates the force as a function of device tip position.
Definition: MovingSquareForce.cpp:122
A simple thread-safe data container that can support multiple writers and readers.
Definition: LockedContainer.h:54
double m_squareNormalDirection
The current sign of the direction of the normal vector of the square.
Definition: MovingSquareForce.h:96
virtual void initializeInput(const std::string &device, const SurgSim::DataStructures::DataGroup &inputData) override
Set the initial input data group.
Definition: MovingSquareForce.cpp:61
const std::string m_squareDeviceName
Name of the device used to move the square.
Definition: MovingSquareForce.h:81
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:56
double m_surfaceStiffness
The surface stiffness, in newtons per meter.
Definition: MovingSquareForce.h:89
double m_squareHalfSize
One half of the edge length of the square we&#39;re colliding against, in meters.
Definition: MovingSquareForce.h:87
void updateSquare(const SurgSim::DataStructures::DataGroup &squareInputData)
Updates the state of the square as described by squareInputData.
Definition: MovingSquareForce.cpp:98
SurgSim::Math::Vector3d edgeDirectionX
The unit direction along one of the pairs edges of the square.
Definition: MovingSquareForce.h:70
State defined by the pose of the square.
Definition: MovingSquareForce.h:62