contact_managers_config_unit.cpp
Go to the documentation of this file.
1 
28 #include <gtest/gtest.h>
30 
38 
39 using namespace tesseract_collision;
40 
42 {
43 public:
44  bool operator()(const std::string&, const std::string&) const override { return true; }
45 };
46 
48 {
49 public:
50  bool operator()(const std::string&, const std::string&) const override { return false; }
51 };
52 
54 {
55 public:
56  bool operator()(const std::string& s1, const std::string& s2) const override
57  {
58  if (s1 == "link_1" && s2 == "link_2")
59  return true;
60 
61  if (s1 == "link_1" && s2 == "link_3")
62  return true;
63 
64  return false;
65  }
66 };
67 
69 {
70 public:
71  bool operator()(const std::string& s1, const std::string& s2) const override
72  {
73  return (s1 == "link_1" && s2 == "link_2");
74  }
75 };
76 
77 TEST(TesseractCollisionUnit, BulletDiscreteSimpleContactManagerConfigUnit) // NOLINT
78 {
80  test_suite::runTest(checker);
81 }
82 
83 TEST(TesseractCollisionUnit, BulletDiscreteBVHContactManagerConfigUnit) // NOLINT
84 {
86  test_suite::runTest(checker);
87 }
88 
89 TEST(TesseractCollisionUnit, BulletCastSimpleContactManagerConfigUnit) // NOLINT
90 {
92  test_suite::runTest(checker);
93 }
94 
95 TEST(TesseractCollisionUnit, BulletCastBVHContactManagerConfigUnit) // NOLINT
96 {
98  test_suite::runTest(checker);
99 }
100 
101 TEST(TesseractCollisionUnit, FCLDiscreteBVHContactManagerConfigUnit) // NOLINT
102 {
104  test_suite::runTest(checker);
105 }
106 
107 TEST(TesseractCollisionUnit, CombineContactAllowedFnUnit) // NOLINT
108 {
109  { // tesseract_collision::ACMOverrideType::NONE
110  auto orig = std::make_shared<AlwaysTrueContactAllowedValidator>();
111  auto ovrd = std::make_shared<AlwaysFalseContactAllowedValidator>();
112 
114  EXPECT_TRUE((*comb)("", ""));
115  }
116 
117  { // tesseract_collision::ACMOverrideType::ASSIGN
118  auto orig = std::make_shared<AlwaysTrueContactAllowedValidator>();
119  auto ovrd = std::make_shared<AlwaysFalseContactAllowedValidator>();
120 
122  EXPECT_FALSE((*comb)("", ""));
123  }
124 
125  { // tesseract_collision::ACMOverrideType::AND
126  auto orig = std::make_shared<TestOrigContactAllowedValidator>();
127  auto ovrd = std::make_shared<TestOvrdContactAllowedValidator>();
128 
130  EXPECT_TRUE((*comb)("link_1", "link_2"));
131  EXPECT_FALSE((*comb)("link_1", "link_3"));
132  EXPECT_FALSE((*comb)("abc", "def"));
133 
135  EXPECT_TRUE(comb1 == nullptr);
136  }
137 
138  { // tesseract_collision::ACMOverrideType::AND
139  auto orig = std::make_shared<TestOrigContactAllowedValidator>();
140  auto ovrd = std::make_shared<TestOvrdContactAllowedValidator>();
141 
143  EXPECT_TRUE((*comb)("link_1", "link_2"));
144  EXPECT_TRUE((*comb)("link_1", "link_3"));
145  EXPECT_FALSE((*comb)("abc", "def"));
146 
148  EXPECT_TRUE((*comb1)("link_1", "link_2"));
149  EXPECT_FALSE((*comb1)("link_1", "link_3"));
150  EXPECT_FALSE((*comb1)("abc", "def"));
151  }
152 }
153 
154 int main(int argc, char** argv)
155 {
156  testing::InitGoogleTest(&argc, argv);
157 
158  return RUN_ALL_TESTS();
159 }
bullet_cast_simple_manager.h
Tesseract ROS Bullet cast(continuous) simple collision manager.
tesseract_common::ContactAllowedValidator
tesseract_collision::ACMOverrideType::ASSIGN
@ ASSIGN
Replace the current ContactAllowedValidator with one generated from the ACM provided.
AlwaysTrueContactAllowedValidator::operator()
bool operator()(const std::string &, const std::string &) const override
Definition: contact_managers_config_unit.cpp:44
fcl_discrete_managers.h
Tesseract ROS FCL contact checker implementation.
bullet_cast_bvh_manager.h
Tesseract ROS Bullet cast(continuous) BVH collision manager.
bullet_discrete_simple_manager.h
Tesseract ROS Bullet discrete simple collision manager.
tesseract_collision::ACMOverrideType::OR
@ OR
New ContactAllowedValidator combines the contact manager fn and the ACM generated fn with and OR.
TestOrigContactAllowedValidator::operator()
bool operator()(const std::string &s1, const std::string &s2) const override
Definition: contact_managers_config_unit.cpp:56
main
int main(int argc, char **argv)
Definition: contact_managers_config_unit.cpp:154
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
AlwaysTrueContactAllowedValidator
Definition: contact_managers_config_unit.cpp:41
EXPECT_TRUE
#define EXPECT_TRUE(args)
utils.h
Tesseract Collision utils.
AlwaysFalseContactAllowedValidator
Definition: contact_managers_config_unit.cpp:47
TestOvrdContactAllowedValidator::operator()
bool operator()(const std::string &s1, const std::string &s2) const override
Definition: contact_managers_config_unit.cpp:71
TestOvrdContactAllowedValidator
Definition: contact_managers_config_unit.cpp:68
TestOrigContactAllowedValidator
Definition: contact_managers_config_unit.cpp:53
bullet_discrete_bvh_manager.h
Tesseract ROS Bullet discrete BVH collision manager.
TESSERACT_COMMON_IGNORE_WARNINGS_POP
Definition: create_convex_hull.cpp:37
contact_manager_config_unit.hpp
tesseract_collision::tesseract_collision_bullet::BulletDiscreteBVHManager
A BVH implementation of a bullet manager.
Definition: bullet_discrete_bvh_manager.h:51
tesseract_collision::test_suite::runTest
void runTest(ContinuousContactManager &checker)
Definition: collision_box_box_cast_unit.hpp:111
tesseract_collision::tesseract_collision_bullet::BulletCastBVHManager
A BVH implementation of a tesseract contact manager.
Definition: bullet_cast_bvh_manager.h:51
TEST
TEST(TesseractCollisionUnit, BulletDiscreteSimpleContactManagerConfigUnit)
Definition: contact_managers_config_unit.cpp:77
tesseract_collision
Definition: bullet_cast_bvh_manager.h:48
tesseract_collision::ACMOverrideType::NONE
@ NONE
Do not apply AllowedCollisionMatrix.
macros.h
tesseract_collision::combineContactAllowedValidators
tesseract_common::ContactAllowedValidator::ConstPtr combineContactAllowedValidators(tesseract_common::ContactAllowedValidator::ConstPtr original, tesseract_common::ContactAllowedValidator::ConstPtr override, ACMOverrideType type=ACMOverrideType::OR)
Combines two ContactAllowedValidator using the override type.
Definition: utils.cpp:31
tesseract_collision::tesseract_collision_bullet::BulletDiscreteSimpleManager
A simple implementation of a bullet manager which does not use BHV.
Definition: bullet_discrete_simple_manager.h:51
tesseract_collision::tesseract_collision_fcl::FCLDiscreteBVHManager
A FCL implementation of the discrete contact manager.
Definition: fcl_discrete_managers.h:51
tesseract_collision::tesseract_collision_bullet::BulletCastSimpleManager
A simple implementation of a tesseract manager which does not use BHV.
Definition: bullet_cast_simple_manager.h:51
tesseract_collision::ACMOverrideType::AND
@ AND
New ContactAllowedValidator combines the contact manager fn and the ACM generated fn with and AND.
EXPECT_FALSE
#define EXPECT_FALSE(args)
AlwaysFalseContactAllowedValidator::operator()
bool operator()(const std::string &, const std::string &) const override
Definition: contact_managers_config_unit.cpp:50


tesseract_collision
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:01:52