27 #include <pcl/filters/filter.h>
47 offeringTopic(getProperty<std::string>(
"DebugObserverName").getValue());
48 offeringTopic(getProperty<std::string>(
"DebugDrawerTopicName").getValue());
50 cycleKeeper.reset(
new CycleUtil(1000.0f / getProperty<float>(
"UpdateRate").getValue()));
52 numClouds = getProperty<int>(
"NumPointClouds").getValue();
55 writeBinary = getProperty<bool>(
"WriteBinary").getValue();
56 removeNaNs = getProperty<bool>(
"RemoveNaNs").getValue();
63 debugObserver = getTopic<DebugObserverInterfacePrx>(
64 getProperty<std::string>(
"DebugObserverName").getValue());
65 debugDrawer = getTopic<DebugDrawerInterfacePrx>(
66 getProperty<std::string>(
"DebugDrawerTopicName").getValue());
69 enableResultPointClouds<PointT>();
86 pcl::PointCloud<PointT>::Ptr inputCloud(
new pcl::PointCloud<PointT>());
88 if (!waitForPointClouds())
91 ARMARX_INFO <<
"Timeout or error while waiting for point cloud data";
97 getPointClouds(inputCloud);
106 std::string fileName = getProperty<std::string>(
"Folder").getValue() +
"/cloud_" +
109 const auto isNan = [](
const PointT& p) ->
bool {
return std::isnan(p.z); };
113 inputCloud->points.erase(
114 std::remove_if(inputCloud->points.begin(), inputCloud->points.end(), isNan),
115 inputCloud->points.end());
117 inputCloud->width = inputCloud->points.size();
118 inputCloud->height = 1;
119 inputCloud->is_dense =
true;
124 pcl::io::savePCDFileBinary(fileName, *inputCloud);
128 pcl::io::savePCDFileASCII(fileName, *inputCloud);
131 ARMARX_LOG <<
"writing to file: " << fileName;
133 provideResultPointClouds(inputCloud);
136 if (numClouds && currentCloud >= numClouds)
139 this->getArmarXManager()->asyncShutdown();
140 PointCloudProcessor::onDisconnectComponent();
144 cycleKeeper->waitForCycleDuration();