1#ifndef TESSERACT_COLLISION_COLLISION_OCTOMAP_SPHERE_UNIT_HPP
2#define TESSERACT_COLLISION_COLLISION_OCTOMAP_SPHERE_UNIT_HPP
6#include <octomap/octomap.h>
7#include <console_bridge/console.h>
20inline void addCollisionObjects(DiscreteContactManager& checker,
bool use_convex_mesh =
false)
25 std::string
path = std::string(TESSERACT_SUPPORT_DIR) +
"/meshes/blender_monkey.bt";
26 auto ot = std::make_shared<octomap::OcTree>(path);
28 Eigen::Isometry3d octomap_pose;
29 octomap_pose.setIdentity();
33 obj1_shapes.push_back(dense_octomap);
34 obj1_poses.push_back(octomap_pose);
36 checker.addCollisionObject(
"octomap_link", 0, obj1_shapes, obj1_poses);
46 auto mesh_vertices = std::make_shared<tesseract_common::VectorVector3d>();
47 auto mesh_faces = std::make_shared<Eigen::VectorXi>();
49 std::string(TESSERACT_SUPPORT_DIR) +
"/meshes/sphere_p25m.ply", *mesh_vertices, *mesh_faces,
true),
52 auto mesh = std::make_shared<tesseract_geometry::Mesh>(mesh_vertices, mesh_faces);
57 sphere = std::make_shared<tesseract_geometry::Sphere>(0.25);
60 Eigen::Isometry3d sphere_pose;
61 sphere_pose.setIdentity();
65 obj2_shapes.push_back(
sphere);
66 obj2_poses.push_back(sphere_pose);
68 checker.addCollisionObject(
"sphere_link", 0, obj2_shapes, obj2_poses);
70 EXPECT_TRUE(checker.getCollisionObjects().size() == 2);
71 for (
const auto& co : checker.getCollisionObjects())
73 EXPECT_TRUE(checker.getCollisionObjectGeometries(co).size() == 1);
74 EXPECT_TRUE(checker.getCollisionObjectGeometriesTransforms(co).size() == 1);
75 for (
const auto& cgt : checker.getCollisionObjectGeometriesTransforms(co))
77 EXPECT_TRUE(cgt.isApprox(Eigen::Isometry3d::Identity(), 1e-5));
87 std::vector<std::string>
active_links{
"octomap_link",
"sphere_link" };
99 location[
"octomap_link"] = Eigen::Isometry3d::Identity();
100 location[
"sphere_link"] = Eigen::Isometry3d::Identity();
101 location[
"sphere_link"].translation() = Eigen::Vector3d(0, 0, 1);
double getMaxCollisionMargin() const
Get the largest collision margin.
Definition: collision_margin_data.h:165
@ BOX
Definition: octree.h:50
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
EXPECT_FALSE(tesseract_collision::isContactAllowed("base_link", "link_2", acm, false))
EXPECT_TRUE(tesseract_common::isIdentical< tesseract_collision::ObjectPairKey >(pairs, check_pairs, false))
This is a collection of common methods.
This is a collection of common methods.
EXPECT_GT(m.m.condition, 1e+20)
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
void runTestTyped(DiscreteContactManager &checker, ContactTestType test_type)
Definition: collision_box_box_unit.hpp:125
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_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
int loadSimplePlyFile(const std::string &path, tesseract_common::VectorVector3d &vertices, Eigen::VectorXi &faces, bool triangles_only=false)
Loads a simple ply file given a path.
Definition: common.cpp:285
ContactTestType
Definition: types.h:70
tesseract_geometry::ConvexMesh::Ptr makeConvexMesh(const tesseract_geometry::Mesh &mesh)
Definition: convex_hull_utils.cpp:114
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 sphere
Definition: tesseract_geometry_unit.cpp:23
auto mesh
Definition: tesseract_geometry_unit.cpp:25
tesseract_common::fs::path path
Definition: tesseract_srdf_unit.cpp:1992