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  void initializeInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData) override;
38 
39  void handleInput(const std::string& device, const SurgSim::DataStructures::DataGroup& inputData) override;
40 
41  bool requestOutput(const std::string& device, SurgSim::DataStructures::DataGroup* outputData) override;
42 
43 protected:
46  void updateTool(const SurgSim::DataStructures::DataGroup& toolInputData);
47 
50  void updateSquare(const SurgSim::DataStructures::DataGroup& squareInputData);
51 
58 
59 private:
62  {
65 
74  };
75 
76 
78  const std::string m_toolDeviceName;
80  const std::string m_squareDeviceName;
81 
84 
90  double m_forceLimit;
91 
96 
99 };
100 
101 #endif // SURGSIM_TESTING_VISUALTESTCOMMON_MOVINGSQUAREFORCE_H
MovingSquareForce::m_tipPoint
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:98
MovingSquareForce::m_squareDeviceName
const std::string m_squareDeviceName
Name of the device used to move the square.
Definition: MovingSquareForce.h:80
MovingSquareForce::SquarePoseVectors::normal
SurgSim::Math::Vector3d normal
The unit normal vector of the square.
Definition: MovingSquareForce.h:67
MovingSquareForce::m_forceLimit
double m_forceLimit
The maximum force before the application allows the tool to pop through.
Definition: MovingSquareForce.h:90
MovingSquareForce::MovingSquareForce
MovingSquareForce(const std::string &toolDeviceName, const std::string &squareDeviceName)
Constructor.
Definition: MovingSquareForce.cpp:43
MovingSquareForce::handleInput
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
LockedContainer.h
InputConsumerInterface.h
MovingSquareForce::requestOutput
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
MovingSquareForce::m_square
SurgSim::Framework::LockedContainer< SquarePoseVectors > m_square
Points and directions defined by the pose of the square.
Definition: MovingSquareForce.h:93
MovingSquareForce::m_outputData
SurgSim::DataStructures::DataGroup m_outputData
Internally stored output data (force and torque).
Definition: MovingSquareForce.h:83
MovingSquareForce::m_toolDeviceName
const std::string m_toolDeviceName
Name of the device used as the tool.
Definition: MovingSquareForce.h:78
SurgSim::Math::Vector3d
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
SurgSim::DataStructures::DataGroup
A collection of NamedData objects.
Definition: DataGroup.h:68
SurgSim::Framework::LockedContainer
A simple thread-safe data container that can support multiple writers and readers.
Definition: LockedContainer.h:54
SurgSim::Input::OutputProducerInterface
Interface for a producer that generates device output updates (forces, status LED state,...
Definition: OutputProducerInterface.h:33
MovingSquareForce::m_squareNormalDirection
double m_squareNormalDirection
The current sign of the direction of the normal vector of the square.
Definition: MovingSquareForce.h:95
SurgSim::Input::InputConsumerInterface
Interface for a consumer that monitors device and signal state updates (pose, buttons,...
Definition: InputConsumerInterface.h:33
MovingSquareForce::SquarePoseVectors::edgeDirectionY
SurgSim::Math::Vector3d edgeDirectionY
The unit direction along the other pair of edges of the square.
Definition: MovingSquareForce.h:71
MovingSquareForce::SquarePoseVectors::edgeDirectionX
SurgSim::Math::Vector3d edgeDirectionX
The unit direction along one of the pairs edges of the square.
Definition: MovingSquareForce.h:69
MovingSquareForce::m_surfaceStiffness
double m_surfaceStiffness
The surface stiffness, in newtons per meter.
Definition: MovingSquareForce.h:88
DataGroup.h
OutputProducerInterface.h
MovingSquareForce::m_squareHalfSize
double m_squareHalfSize
One half of the edge length of the square we're colliding against, in meters.
Definition: MovingSquareForce.h:86
MovingSquareForce::updateSquare
void updateSquare(const SurgSim::DataStructures::DataGroup &squareInputData)
Updates the state of the square as described by squareInputData.
Definition: MovingSquareForce.cpp:98
MovingSquareForce::SquarePoseVectors
State defined by the pose of the square.
Definition: MovingSquareForce.h:61
MovingSquareForce::SquarePoseVectors::center
SurgSim::Math::Vector3d center
The location of the center of the square in world coordinates.
Definition: MovingSquareForce.h:73
MovingSquareForce::updateTool
void updateTool(const SurgSim::DataStructures::DataGroup &toolInputData)
Updates the state of the tool as described by toolInputData.
Definition: MovingSquareForce.cpp:81
MovingSquareForce::initializeInput
void initializeInput(const std::string &device, const SurgSim::DataStructures::DataGroup &inputData) override
Set the initial input data group.
Definition: MovingSquareForce.cpp:61
MovingSquareForce::computeForce
SurgSim::Math::Vector3d computeForce(const SurgSim::Math::Vector3d &position)
Calculates the force as a function of device tip position.
Definition: MovingSquareForce.cpp:122
MovingSquareForce::SquarePoseVectors::SquarePoseVectors
SquarePoseVectors()
Constructor.
Definition: MovingSquareForce.cpp:34
MovingSquareForce
A simple listener to calculate collision force against a square area for the example application.
Definition: MovingSquareForce.h:31