17 static const std::size_t
DIM = 10;
32 auto mesh_vertices = std::make_shared<tesseract_common::VectorVector3d>();
33 auto mesh_faces = std::make_shared<Eigen::VectorXi>();
41 auto mesh = std::make_shared<tesseract_geometry::Mesh>(mesh_vertices, mesh_faces);
46 sphere = std::make_shared<Sphere>(0.25);
49 Eigen::Isometry3d sphere_pose;
50 sphere_pose.setIdentity();
54 obj3_shapes.push_back(sphere);
55 obj3_poses.push_back(sphere_pose);
60 for (std::size_t x = 0; x <
DIM; ++x)
62 for (std::size_t y = 0; y <
DIM; ++y)
64 for (std::size_t z = 0; z <
DIM; ++z)
66 Eigen::Isometry3d sphere_pose;
67 sphere_pose.setIdentity();
68 sphere_pose.translation() = Eigen::Vector3d(
double(x),
double(y),
double(z));
72 link_shapes.push_back(sphere);
73 link_poses.push_back(sphere_pose);
79 shapes.push_back(sphere);
80 poses.push_back(sphere_pose);
81 std::string link_name =
"sphere_link_" + std::to_string(x) + std::to_string(y) + std::to_string(z);
103 auto mesh_vertices = std::make_shared<tesseract_common::VectorVector3d>();
104 auto mesh_faces = std::make_shared<Eigen::VectorXi>();
112 auto mesh = std::make_shared<tesseract_geometry::Mesh>(mesh_vertices, mesh_faces);
117 sphere = std::make_shared<Sphere>(0.25);
120 Eigen::Isometry3d sphere_pose;
121 sphere_pose.setIdentity();
125 obj3_shapes.push_back(sphere);
126 obj3_poses.push_back(sphere_pose);
131 for (std::size_t x = 0; x <
DIM; ++x)
133 for (std::size_t y = 0; y <
DIM; ++y)
135 for (std::size_t z = 0; z <
DIM; ++z)
137 Eigen::Isometry3d sphere_pose;
138 sphere_pose.setIdentity();
139 sphere_pose.translation() = Eigen::Vector3d(
double(x),
double(y),
double(z));
143 link_shapes.push_back(sphere);
144 link_poses.push_back(sphere_pose);
150 shapes.push_back(sphere);
151 poses.push_back(sphere_pose);
152 std::string link_name =
"sphere_link_" + std::to_string(x) + std::to_string(y) + std::to_string(z);
166 std::vector<Eigen::Isometry3d> poses(num_poses);
167 for (std::size_t i = 0; i < num_poses; ++i)
169 double x = (double(rand()) / RAND_MAX) *
double(
DIM);
170 double y = (double(rand()) / RAND_MAX) *
double(
DIM);
171 double z = (double(rand()) / RAND_MAX) *
double(
DIM);
172 poses[i] = Eigen::Isometry3d::Identity();
173 poses[i].translation() = Eigen::Vector3d(x, y, z);
180 auto bt_simple_checker = std::make_shared<tesseract_collision_bullet::BulletDiscreteSimpleManager>();
181 auto bt_bvh_checker = std::make_shared<tesseract_collision_bullet::BulletDiscreteBVHManager>();
182 auto fcl_bvh_checker = std::make_shared<tesseract_collision_fcl::FCLDiscreteBVHManager>();
185 std::vector<DiscreteContactManager::Ptr> checkers = { bt_simple_checker, bt_bvh_checker, fcl_bvh_checker };
186 std::vector<std::string> checker_names = {
"BtSimple",
"BtBVH",
"FCLBVH" };
187 std::vector<long> checker_contacts = { 0, 0, 0 };
189 std::printf(
"Total number of shape: %d\n",
int(
DIM *
DIM *
DIM));
192 for (std::size_t i = 0; i < 2; ++i)
197 auto start_time = std::chrono::high_resolution_clock::now();
198 for (
auto& pose : poses)
200 checkers[i]->setCollisionObjectsTransform(
"move_link", pose);
205 checker_contacts[i] += result.
count();
207 auto end_time = std::chrono::high_resolution_clock::now();
208 double total_time = std::chrono::duration<double, std::milli>(end_time - start_time).count();
211 "%15s | DT: %15.5f ms | Contacts: %d\n", checker_names[i].c_str(), total_time,
int(checker_contacts[i]));
217 auto bt_simple_checker = std::make_shared<tesseract_collision_bullet::BulletCastSimpleManager>();
218 auto bt_bvh_checker = std::make_shared<tesseract_collision_bullet::BulletCastBVHManager>();
221 std::vector<ContinuousContactManager::Ptr> checkers = { bt_simple_checker, bt_bvh_checker };
222 std::vector<std::string> checker_names = {
"BtCastSimple",
"BtCastBVH" };
223 std::vector<long> checker_contacts = { 0, 0, 0 };
225 Eigen::Isometry3d delta_pose;
226 delta_pose.setIdentity();
227 delta_pose.translation() = Eigen::Vector3d(0.5, 0.5, 0.5);
229 std::printf(
"Total number of shape: %d\n",
int(
DIM *
DIM *
DIM));
232 for (std::size_t i = 0; i < 2; ++i)
237 auto start_time = std::chrono::high_resolution_clock::now();
238 for (
auto& pose : poses)
240 checkers[i]->setCollisionObjectsTransform(
"move_link", pose, pose * delta_pose);
245 checker_contacts[i] += result.
count();
247 auto end_time = std::chrono::high_resolution_clock::now();
248 double total_time = std::chrono::duration<double, std::milli>(end_time - start_time).count();
251 "%15s | DT: %15.5f ms | Contacts: %d\n", checker_names[i].c_str(), total_time,
int(checker_contacts[i]));
257 std::printf(
"Discrete: One Primitive Shape per link\n");
260 std::printf(
"Discrete: All Primitive Shape in single link\n");
263 std::printf(
"Discrete: One Convex Shape per link\n");
266 std::printf(
"Discrete: All Convex Shape in single link\n");
269 std::printf(
"Continuous: One Primitive Shape per link\n");
272 std::printf(
"Continuous: All Primitive Shape in single link\n");
275 std::printf(
"Continuous: One Convex Shape per link\n");
278 std::printf(
"Continuous: All Convex Shape in single link\n");