31 #include <console_bridge/console.h>
32 #include <pcl/io/pcd_io.h>
52 std::throw_with_nested(std::runtime_error(
"PointCloud: Missing or failed parsing attribute 'filename'!"));
54 double resolution{ 0 };
55 if (xml_element->QueryDoubleAttribute(
"resolution", &resolution) != tinyxml2::XML_SUCCESS)
56 std::throw_with_nested(std::runtime_error(
"PointCloud: Missing or failed parsing point_cloud attribute "
59 auto cloud = std::make_shared<pcl::PointCloud<pcl::PointXYZ>>();
62 if (!located_resource || !located_resource->isFile() || !std::filesystem::exists(located_resource->getFilePath()))
65 CONSOLE_BRIDGE_logError(
"Point clouds can only be loaded from file");
66 std::throw_with_nested(std::runtime_error(
"PointCloud: Unable to locate resource '" + filename +
"'!"));
69 if (pcl::io::loadPCDFile<pcl::PointXYZ>(located_resource->getFilePath(), *cloud) == -1)
70 std::throw_with_nested(std::runtime_error(
"PointCloud: Failed to import point cloud from '" + filename +
"'!"));
72 if (cloud->points.empty())
73 std::throw_with_nested(std::runtime_error(
"PointCloud: Imported point cloud from '" + filename +
"' is empty!"));
76 auto geom = std::make_shared<tesseract_geometry::Octree>(std::move(octree), shape_type, prune);
78 std::throw_with_nested(std::runtime_error(
"PointCloud: Failed to create Tesseract Octree Geometry from point "