1#ifndef TESSERACT_COLLISION_COLLISION_BOX_CONE_UNIT_HPP
2#define TESSERACT_COLLISION_COLLISION_BOX_CONE_UNIT_HPP
17 Eigen::Isometry3d box_pose;
18 box_pose.setIdentity();
22 obj1_shapes.push_back(
box);
23 obj1_poses.push_back(box_pose);
25 checker.addCollisionObject(
"box_link", 0, obj1_shapes, obj1_poses,
false);
26 checker.enableCollisionObject(
"box_link");
31 CollisionShapePtr thin_box = std::make_shared<tesseract_geometry::Box>(0.1, 1, 1);
32 Eigen::Isometry3d thin_box_pose;
33 thin_box_pose.setIdentity();
37 obj2_shapes.push_back(thin_box);
38 obj2_poses.push_back(thin_box_pose);
40 checker.addCollisionObject(
"thin_box_link", 0, obj2_shapes, obj2_poses);
41 checker.disableCollisionObject(
"thin_box_link");
48 Eigen::Isometry3d cone_pose;
49 cone_pose.setIdentity();
53 obj3_shapes.push_back(
cone);
54 obj3_poses.push_back(cone_pose);
56 checker.addCollisionObject(
"cone_link", 0, obj3_shapes, obj3_poses);
61 CollisionShapePtr remove_box = std::make_shared<tesseract_geometry::Box>(0.1, 1, 1);
62 Eigen::Isometry3d remove_box_pose;
63 thin_box_pose.setIdentity();
67 obj4_shapes.push_back(remove_box);
68 obj4_poses.push_back(remove_box_pose);
70 checker.addCollisionObject(
"remove_box_link", 0, obj4_shapes, obj4_poses);
71 EXPECT_TRUE(checker.getCollisionObjects().size() == 4);
72 EXPECT_TRUE(checker.hasCollisionObject(
"remove_box_link"));
73 checker.removeCollisionObject(
"remove_box_link");
74 EXPECT_FALSE(checker.hasCollisionObject(
"remove_box_link"));
79 EXPECT_FALSE(checker.removeCollisionObject(
"link_does_not_exist"));
80 EXPECT_FALSE(checker.enableCollisionObject(
"link_does_not_exist"));
81 EXPECT_FALSE(checker.disableCollisionObject(
"link_does_not_exist"));
92 EXPECT_TRUE(checker.getCollisionObjects().size() == 3);
93 for (
const auto& co : checker.getCollisionObjects())
95 EXPECT_TRUE(checker.getCollisionObjectGeometries(co).size() == 1);
96 EXPECT_TRUE(checker.getCollisionObjectGeometriesTransforms(co).size() == 1);
97 for (
const auto& cgt : checker.getCollisionObjectGeometriesTransforms(co))
99 EXPECT_TRUE(cgt.isApprox(Eigen::Isometry3d::Identity(), 1e-5));
105inline void runTest(DiscreteContactManager& checker)
116 std::vector<std::string>
active_links{
"box_link",
"cone_link" };
118 std::vector<std::string> check_active_links = checker.getActiveCollisionObjects();
121 EXPECT_TRUE(checker.getIsContactAllowedFn() ==
nullptr);
124 EXPECT_NEAR(checker.getCollisionMarginData().getMaxCollisionMargin(), 0.5, 1e-5);
126 checker.setPairCollisionMarginData(
"box_link",
"cone_link", 0.1);
130 location[
"box_link"] = Eigen::Isometry3d::Identity();
131 location[
"cone_link"] = Eigen::Isometry3d::Identity();
132 location[
"cone_link"].translation()(0) = 0.2;
133 checker.setCollisionObjectsTransform(location);
136 ContactResultMap result;
145 std::vector<int> idx = { 0, 1, 1 };
176 location[
"cone_link"].translation() = Eigen::Vector3d(1, 0, 0);
181 checker.setCollisionObjectsTransform(
"cone_link", location[
"cone_link"]);
194 EXPECT_NEAR(checker.getCollisionMarginData().getMaxCollisionMargin(), 0.251, 1e-5);
EXPECT_NEAR(config.contact_manager_config.margin_data.getDefaultCollisionMargin(), 5, 1e-6)
tesseract_collision::ContactResultVector result_vector
Definition: collision_core_unit.cpp:410
results distance
Definition: collision_core_unit.cpp:139
results link_names[0]
Definition: collision_core_unit.cpp:146
results normal
Definition: collision_core_unit.cpp:154
EXPECT_FALSE(tesseract_collision::isContactAllowed("base_link", "link_2", acm, false))
results nearest_points[0]
Definition: collision_core_unit.cpp:140
results single_contact_point
Definition: collision_core_unit.cpp:161
EXPECT_TRUE(tesseract_common::isIdentical< tesseract_collision::ObjectPairKey >(pairs, check_pairs, false))
void addCollisionObjects(ContinuousContactManager &checker)
Definition: collision_box_box_cast_unit.hpp:11
Definition: large_dataset_benchmarks.hpp:17
void runTest(ContinuousContactManager &checker)
Definition: collision_box_box_cast_unit.hpp:111
tesseract_common::CollisionMarginData CollisionMarginData
Definition: types.h:50
tesseract_geometry::Geometry::Ptr CollisionShapePtr
Definition: types.h:49
std::vector< tesseract_geometry::Geometry::ConstPtr > CollisionShapesConst
Definition: types.h:47
tesseract_common::AlignedVector< ContactResult > ContactResultVector
Definition: types.h:134
AlignedMap< std::string, Eigen::Isometry3d > TransformMap
Definition: types.h:66
template bool isIdentical< std::string >(const std::vector< std::string > &, const std::vector< std::string > &, bool, const std::function< bool(const std::string &, const std::string &)> &, const std::function< bool(const std::string &, const std::string &)> &)
AlignedVector< Eigen::Isometry3d > VectorIsometry3d
Definition: types.h:62
std::vector< std::string > active_links
Definition: tesseract_environment_collision.cpp:112
auto cone
Definition: tesseract_geometry_unit.cpp:19
auto box
Definition: tesseract_geometry_unit.cpp:18