1#ifndef TESSERACT_COLLISION_PRIMATIVES_BENCHMARKS_HPP
2#define TESSERACT_COLLISION_PRIMATIVES_BENCHMARKS_HPP
20 const Eigen::Isometry3d&
pose1,
22 const Eigen::Isometry3d&
pose2,
27 geom1_.push_back(geom1->clone());
28 geom2_.push_back(geom2->clone());
44 std::vector<std::string> active_obj(num_obj);
45 for (std::size_t ind = 0; ind < num_obj; ind++)
47 std::string
name =
"geom_" + std::to_string(ind);
48 active_obj.push_back(
name);
49 info.contact_manager_->addCollisionObject(
name, 0,
info.geom1_,
info.obj1_poses);
51 info.contact_manager_->setActiveCollisionObjects(active_obj);
57 benchmark::DoNotOptimize(
clone =
info.contact_manager_->clone());
64 info.contact_manager_->addCollisionObject(std::string(
"geom1"), 0,
info.geom1_,
info.obj1_poses);
65 info.contact_manager_->addCollisionObject(std::string(
"geom2"), 0,
info.geom2_,
info.obj2_poses);
67 info.contact_manager_->setActiveCollisionObjects({
"geom1",
"geom2" });
82 int selected_link{ 0 };
85 benchmark::DoNotOptimize(selected_link = rand() % num_obj);
96 std::vector<std::string> active_obj(num_obj);
97 for (std::size_t ind = 0; ind < num_obj; ind++)
99 std::string
name =
"geom_" + std::to_string(ind);
100 active_obj[ind] =
name;
101 info.contact_manager_->addCollisionObject(
name, 0,
info.geom1_,
info.obj1_poses);
103 info.contact_manager_->setActiveCollisionObjects(active_obj);
111 std::size_t selected_link =
static_cast<std::size_t
>(rand()) % num_obj;
112 info.contact_manager_->setCollisionObjectsTransform(active_obj[selected_link],
info.obj2_poses[0]);
123 std::vector<std::string> active_obj(num_obj);
124 for (std::size_t ind = 0; ind < num_obj; ind++)
126 std::string
name =
"geom_" + std::to_string(ind);
127 active_obj[ind] =
name;
128 info.contact_manager_->addCollisionObject(
name, 0,
info.geom1_,
info.obj1_poses);
130 info.contact_manager_->setActiveCollisionObjects(active_obj);
133 std::vector<std::string> selected_links(1);
139 selected_links[0] = active_obj[
static_cast<std::size_t
>(rand()) % num_obj];
140 info.contact_manager_->setCollisionObjectsTransform(selected_links,
info.obj2_poses);
151 std::vector<std::string> active_obj(num_obj);
152 for (std::size_t ind = 0; ind < num_obj; ind++)
154 std::string
name =
"geom_" + std::to_string(ind);
155 active_obj[ind] =
name;
156 info.contact_manager_->addCollisionObject(
name, 0,
info.geom1_,
info.obj1_poses);
158 info.contact_manager_->setActiveCollisionObjects(active_obj);
166 selected_link.clear();
167 selected_link[active_obj[
static_cast<std::size_t
>(rand()) % num_obj]] =
info.obj2_poses[0];
168 info.contact_manager_->setCollisionObjectsTransform(selected_link);
std::shared_ptr< const Geometry > ConstPtr
Definition: geometry.h:63
auto clone
Definition: clone_cache_unit.cpp:126
static void BM_SET_COLLISION_OBJECTS_TRANSFORM_VECTOR(benchmark::State &state, DiscreteBenchmarkInfo info, std::size_t num_obj)
Benchmark that checks the setCollisionObjectsTransform(const std::vector<std::string>& names,...
Definition: primatives_benchmarks.hpp:118
static void BM_SET_COLLISION_OBJECTS_TRANSFORM_SINGLE(benchmark::State &state, DiscreteBenchmarkInfo info, std::size_t num_obj)
Benchmark that checks the setCollisionObjectsTransform(const std::string& name, const Eigen::Isometry...
Definition: primatives_benchmarks.hpp:91
static void BM_SELECT_RANDOM_OBJECT(benchmark::State &state, int num_obj)
Benchmark that checks how long it takes to select a random object so that number can be subtracted fr...
Definition: primatives_benchmarks.hpp:80
static void BM_CONTACT_TEST(benchmark::State &state, DiscreteBenchmarkInfo info)
Benchmark that checks the contactTest function in discrete contact managers.
Definition: primatives_benchmarks.hpp:62
static void BM_SET_COLLISION_OBJECTS_TRANSFORM_MAP(benchmark::State &state, DiscreteBenchmarkInfo info, std::size_t num_obj)
Benchmark that checks the setCollisionObjectsTransform(const tesseract_common::TransformMap& transfor...
Definition: primatives_benchmarks.hpp:146
static void BM_CLONE(benchmark::State &state, DiscreteBenchmarkInfo info, std::size_t num_obj)
Benchmark that checks the clone method in discrete contact managers.
Definition: primatives_benchmarks.hpp:42
Definition: bullet_cast_bvh_manager.h:49
tesseract_common::CollisionMarginData CollisionMarginData
Definition: types.h:50
std::vector< tesseract_geometry::Geometry::ConstPtr > CollisionShapesConst
Definition: types.h:47
ContactTestType
Definition: types.h:70
AlignedMap< std::string, Eigen::Isometry3d > TransformMap
Definition: types.h:66
AlignedVector< Eigen::Isometry3d > VectorIsometry3d
Definition: types.h:62
Contains the information necessary to run the benchmarks for discrete collision checking.
Definition: primatives_benchmarks.hpp:17
tesseract_common::VectorIsometry3d obj2_poses
Definition: primatives_benchmarks.hpp:37
CollisionShapesConst geom1_
Definition: primatives_benchmarks.hpp:34
ContactTestType contact_test_type_
Definition: primatives_benchmarks.hpp:38
DiscreteContactManager::Ptr contact_manager_
Definition: primatives_benchmarks.hpp:33
DiscreteBenchmarkInfo(const DiscreteContactManager::ConstPtr &contact_manager, const tesseract_geometry::Geometry::ConstPtr &geom1, const Eigen::Isometry3d &pose1, const tesseract_geometry::Geometry::ConstPtr &geom2, const Eigen::Isometry3d &pose2, ContactTestType contact_test_type)
Definition: primatives_benchmarks.hpp:18
CollisionShapesConst geom2_
Definition: primatives_benchmarks.hpp:36
tesseract_common::VectorIsometry3d obj1_poses
Definition: primatives_benchmarks.hpp:35
auto pose2
Definition: tesseract_environment_collision.cpp:155
auto pose1
Definition: tesseract_environment_collision.cpp:153
m name
Definition: tesseract_scene_graph_link_unit.cpp:77
KinematicsInformation info
Definition: tesseract_srdf_unit.cpp:1765