16 #ifndef SURGSIM_COLLISION_REPRESENTATION_H 17 #define SURGSIM_COLLISION_REPRESENTATION_H 19 #include <boost/thread/mutex.hpp> 22 #include <unordered_map> 23 #include <unordered_set> 49 typedef std::unordered_map<std::shared_ptr<SurgSim::Collision::Representation>,
50 std::list<std::shared_ptr<SurgSim::Collision::Contact>>>
ContactMapType;
72 virtual int getShapeType()
const = 0;
76 void setCollisionDetectionType(CollisionDetectionType type);
80 CollisionDetectionType getCollisionDetectionType()
const;
84 void setSelfCollisionDetectionType(CollisionDetectionType type);
88 CollisionDetectionType getSelfCollisionDetectionType()
const;
92 virtual const std::shared_ptr<SurgSim::Math::Shape> getShape()
const = 0;
96 virtual std::shared_ptr<SurgSim::Math::Shape> getPosedShape();
110 void addContact(
const std::shared_ptr<Representation>& other,
111 const std::shared_ptr<SurgSim::Collision::Contact>& contact);
116 bool collidedWith(
const std::shared_ptr<Representation>& other);
120 virtual void update(
const double& dt);
123 virtual void updateShapeData();
126 virtual void updateDcdData();
131 virtual void updateCcdData(
double timeOfImpact);
137 bool ignore(
const std::string& fullName);
143 bool ignore(
const std::shared_ptr<Representation>& representation);
150 void setIgnoring(
const std::vector<std::string>& fullNames);
155 bool isIgnoring(
const std::string& fullName)
const;
160 bool isIgnoring(
const std::shared_ptr<Representation>& representation)
const;
170 bool allow(
const std::string& fullName);
180 bool allow(
const std::shared_ptr<Representation>& representation);
187 void setAllowing(
const std::vector<std::string>& fullNames);
192 bool isAllowing(
const std::string& fullName)
const;
197 bool isAllowing(
const std::shared_ptr<Representation>& representation)
const;
204 void invalidatePosedShapeMotion();
208 std::vector<std::string> getIgnoring()
const;
212 std::vector<std::string> getAllowing()
const;
214 void doRetire()
override;
253 (COLLISION_DETECTION_TYPE_NONE)
254 (COLLISION_DETECTION_TYPE_DISCRETE)
255 (COLLISION_DETECTION_TYPE_CONTINUOUS)
256 (MAX_COLLISION_DETECTION_TYPES))
Definition: CompoundShapeToGraphics.cpp:29
boost::shared_mutex m_posedShapeMotionMutex
Mutex to lock write access to m_posedShapeMotion.
Definition: Representation.h:240
std::shared_ptr< Framework::Logger > m_logger
Definition: Representation.h:219
boost::mutex m_collisionsMutex
Mutex to lock write access to m_collisions.
Definition: Representation.h:234
The convenience header that provides the entirety of the logging API.
CollisionDetectionType m_collisionDetectionType
The type of collision detection.
Definition: Representation.h:223
std::unordered_set< std::string > m_ignoring
Ignored collision representations.
Definition: Representation.h:243
Eigen::AlignedBox< double, 3 > Aabbd
Wrapper around the Eigen type.
Definition: Aabb.h:30
std::unordered_map< std::shared_ptr< SurgSim::Collision::Representation >, std::list< std::shared_ptr< SurgSim::Collision::Contact > > > ContactMapType
Definition: Representation.h:47
SURGSIM_SERIALIZABLE_ENUM(SurgSim::Devices::HandType,(HANDTYPE_LEFT)(HANDTYPE_RIGHT))
CollisionDetectionType m_selfCollisionDetectionType
The type of self collision detection.
Definition: Representation.h:226
SurgSim::DataStructures::BufferedValue< ContactMapType > m_collisions
A map which associates a list of contacts with each collision representation.
Definition: Representation.h:231
The type of collision detection.
Definition: Representation.h:60
Math::PosedShapeMotion< std::shared_ptr< Math::Shape > > m_posedShapeMotion
The shape transformed in space and defined through time, i.e. with 2 differents configurations.
Definition: Representation.h:237
#define SURGSIM_ENUM_TYPE
Required type of enums used by SURGSIM_SERIALIZABLE_ENUM.
Definition: Accessible.h:261
PosedShapeMotion is embedding the motion of a PosedShape, providing a posed shape at 2 different inst...
Definition: Shape.h:145
Representations are manifestations of a SceneElement.
Definition: Representation.h:33
std::unordered_set< std::string > m_allowing
Allowed collision representations.
Definition: Representation.h:246