3 #include <gtest/gtest.h>
4 #include <Eigen/Geometry>
15 TEST(TesseractURDFUnit, parse_octree)
35 std::string str = R
"(<tesseract:octomap shape_type="box" extra="0 0 0">
36 <tesseract:octree filename="package://tesseract_support/meshes/box_2m.bt" extra="0 0 0"/>
37 </tesseract:octomap>)";
39 EXPECT_TRUE(runTest<tesseract_geometry::Octree::Ptr>(
47 std::string str = R
"(<tesseract:octomap shape_type="box" prune="true">
48 <tesseract:octree filename="package://tesseract_support/meshes/box_2m.bt"/>
49 </tesseract:octomap>)";
51 EXPECT_TRUE(runTest<tesseract_geometry::Octree::Ptr>(
59 std::string str = R
"(<tesseract:octomap shape_type="sphere_inside" prune="true">
60 <tesseract:octree filename="package://tesseract_support/meshes/box_2m.bt"/>
61 </tesseract:octomap>)";
63 EXPECT_TRUE(runTest<tesseract_geometry::Octree::Ptr>(
70 #ifdef TESSERACT_PARSE_POINT_CLOUDS
72 std::string str = R
"(<tesseract:octomap shape_type="box">
73 <tesseract:point_cloud filename="package://tesseract_support/meshes/box_pcd.pcd" resolution="0.1"/>
74 </tesseract:octomap>)";
76 EXPECT_TRUE(runTest<tesseract_geometry::Octree::Ptr>(
80 EXPECT_EQ(geom->calcNumSubShapes(), 1000);
81 EXPECT_NEAR(geom->getOctree()->getResolution(), 0.1, 1e-5);
85 std::string str = R
"(<tesseract:octomap shape_type="box" prune="true">
86 <tesseract:point_cloud filename="package://tesseract_support/meshes/box_pcd.pcd" resolution="0.1"/>
87 </tesseract:octomap>)";
89 EXPECT_TRUE(runTest<tesseract_geometry::Octree::Ptr>(
94 EXPECT_NEAR(geom->getOctree()->getResolution(), 0.1, 1e-5);
98 std::string str = R
"(<tesseract:octomap shape_type="box" prune="true">
99 <tesseract:point_cloud />
100 </tesseract:octomap>)";
107 std::string str = R
"(<tesseract:octomap shape_type="box">
108 <tesseract:point_cloud filename="package://tesseract_support/meshes/box_pcd.pcd" resolution="a"/>
109 </tesseract:octomap>)";
116 std::string str = R
"(<tesseract:octomap shape_type="box">
117 <tesseract:point_cloud filename="package://tesseract_support/meshes/does_not_exist.pcd" resolution="0.1"/>
118 </tesseract:octomap>)";
125 std::string str = R
"(<tesseract:octomap shape_type="box">
126 <tesseract:point_cloud filename="package://tesseract_support/meshes/box_2m.bt" resolution="0.1"/>
127 </tesseract:octomap>)";
135 std::string str = R
"(<tesseract:octomap shape_type="sphere_outside" prune="true">
136 <tesseract:octree filename="package://tesseract_support/meshes/box_2m.bt"/>
137 </tesseract:octomap>)";
139 EXPECT_TRUE(runTest<tesseract_geometry::Octree::Ptr>(
147 std::string str = R
"(<tesseract:octomap shape_type="sphere_outside" prune="true">
149 </tesseract:octomap>)";
156 std::string str = R
"(<tesseract:octomap shape_type="sphere_outside" prune="true">
157 <tesseract:octree filename="abc"/>
158 </tesseract:octomap>)";
165 std::string str = R
"(<tesseract:octomap shape_type="sphere_outside" prune="true">
167 </tesseract:octomap>)";
174 std::string str = R
"(<tesseract:octomap shape_type="star" prune="true">
175 <tesseract:octree filename="package://tesseract_support/meshes/box_2m.bt"/>
176 </tesseract:octomap>)";
183 std::string str = R
"(<tesseract:octomap shape_type="star" prune="true">
185 </tesseract:octomap>)";
192 std::string str =
"<tesseract:octomap />";
199 TEST(TesseractURDFUnit, write_octree)
206 writeTest<tesseract_geometry::Octree::Ptr>(
216 writeTest<tesseract_geometry::Octree::Ptr>(
225 writeTest<tesseract_geometry::Octree::Ptr>(
231 TEST(TesseractURDFUnit, write_octomap)
238 writeTest<tesseract_geometry::Octree::Ptr>(
248 writeTest<tesseract_geometry::Octree::Ptr>(
258 writeTest<tesseract_geometry::Octree::Ptr>(
268 writeTest<tesseract_geometry::Octree::Ptr>(
277 writeTest<tesseract_geometry::Octree::Ptr>(