1#ifndef TESSERACT_COMMON_ALLOWED_COLLISION_MATRIX_H
2#define TESSERACT_COMMON_ALLOWED_COLLISION_MATRIX_H
6#include <boost/serialization/access.hpp>
11#include <unordered_map>
18 std::unordered_map<tesseract_common::LinkNamesPair, std::string, tesseract_common::PairHash>;
26 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
29 using Ptr = std::shared_ptr<AllowedCollisionMatrix>;
30 using ConstPtr = std::shared_ptr<const AllowedCollisionMatrix>;
46 const std::string& link_name2,
47 const std::string& reason)
80 if (
it->first.first == link_name ||
it->first.second == link_name)
97 virtual bool isCollisionAllowed(
const std::string& link_name1,
const std::string& link_name2)
const
116 lookup_table_.insert(
acm.getAllAllowedCollisions().begin(),
acm.getAllAllowedCollisions().end());
121 for (
const auto& pair :
acm.getAllAllowedCollisions())
122 os <<
"link=" << pair.first.first <<
" link=" << pair.first.second <<
" reason=" << pair.second << std::endl;
132 template <
class Archive>
133 void serialize(Archive& ar,
const unsigned int version);
138#include <boost/serialization/export.hpp>
139#include <boost/serialization/tracking.hpp>
Definition: allowed_collision_matrix.h:23
void insertAllowedCollisionMatrix(const AllowedCollisionMatrix &acm)
Inserts an allowable collision matrix ignoring duplicate pairs.
Definition: allowed_collision_matrix.h:114
virtual void removeAllowedCollision(const std::string &link_name)
Remove disabled collision for any pair with link_name from allowed collision matrix.
Definition: allowed_collision_matrix.h:76
friend std::ostream & operator<<(std::ostream &os, const AllowedCollisionMatrix &acm)
Definition: allowed_collision_matrix.h:119
AllowedCollisionMatrix & operator=(const AllowedCollisionMatrix &)=default
AllowedCollisionEntries lookup_table_
Definition: allowed_collision_matrix.h:129
bool operator!=(const AllowedCollisionMatrix &rhs) const
Definition: allowed_collision_matrix.cpp:68
std::shared_ptr< const AllowedCollisionMatrix > ConstPtr
Definition: allowed_collision_matrix.h:30
void clearAllowedCollisions()
Clears the list of allowed collisions, so that no collision will be allowed.
Definition: allowed_collision_matrix.h:108
const AllowedCollisionEntries & getAllAllowedCollisions() const
Get all of the entries in the allowed collision matrix.
Definition: allowed_collision_matrix.h:59
AllowedCollisionMatrix(AllowedCollisionMatrix &&)=default
virtual bool isCollisionAllowed(const std::string &link_name1, const std::string &link_name2) const
This checks if two links are allowed to be in collision.
Definition: allowed_collision_matrix.h:97
bool operator==(const AllowedCollisionMatrix &rhs) const
Definition: allowed_collision_matrix.cpp:61
virtual ~AllowedCollisionMatrix()=default
virtual void removeAllowedCollision(const std::string &link_name1, const std::string &link_name2)
Remove disabled collision pair from allowed collision matrix.
Definition: allowed_collision_matrix.h:66
friend class boost::serialization::access
Definition: allowed_collision_matrix.h:131
virtual void addAllowedCollision(const std::string &link_name1, const std::string &link_name2, const std::string &reason)
Disable collision between two collision objects.
Definition: allowed_collision_matrix.h:45
AllowedCollisionMatrix(const AllowedCollisionMatrix &)=default
AllowedCollisionMatrix()=default
void serialize(Archive &ar, const unsigned int version)
Definition: allowed_collision_matrix.cpp:71
AllowedCollisionMatrix & operator=(AllowedCollisionMatrix &&)=default
std::shared_ptr< AllowedCollisionMatrix > Ptr
Definition: allowed_collision_matrix.h:29
auto it
Definition: collision_core_unit.cpp:208
auto acm
Definition: collision_core_unit.cpp:33
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
Definition: allowed_collision_matrix.h:16
bool operator==(const AllowedCollisionEntries &entries_1, const AllowedCollisionEntries &entries_2)
Definition: allowed_collision_matrix.cpp:43
LinkNamesPair makeOrderedLinkPair(const std::string &link_name1, const std::string &link_name2)
Create a pair of strings, where the pair.first is always <= pair.second.
Definition: types.cpp:56
std::pair< std::string, std::string > LinkNamesPair
Definition: types.h:71
std::unordered_map< tesseract_common::LinkNamesPair, std::string, tesseract_common::PairHash > AllowedCollisionEntries
Definition: allowed_collision_matrix.h:18