26 #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();
62 debugObserver = getTopic<DebugObserverInterfacePrx>(getProperty<std::string>(
"DebugObserverName").getValue());
63 debugDrawer = getTopic<DebugDrawerInterfacePrx>(getProperty<std::string>(
"DebugDrawerTopicName").getValue());
66 enableResultPointClouds<PointT>();
81 pcl::PointCloud<PointT>::Ptr inputCloud(
new pcl::PointCloud<PointT>());
83 if (!waitForPointClouds())
86 ARMARX_INFO <<
"Timeout or error while waiting for point cloud data";
92 getPointClouds(inputCloud);
101 std::string fileName = getProperty<std::string>(
"Folder").getValue() +
"/cloud_" +
std::to_string(inputCloud->header.stamp) +
".pcd";
103 const auto isNan = [](
const PointT& p)->
bool{
104 return std::isnan(p.z);
109 inputCloud->points.erase(std::remove_if(inputCloud->points.begin(), inputCloud->points.end(), isNan), inputCloud->points.end());
111 inputCloud->width = inputCloud->points.size();
112 inputCloud->height = 1;
113 inputCloud->is_dense =
true;
118 pcl::io::savePCDFileBinary(fileName, *inputCloud);
122 pcl::io::savePCDFileASCII(fileName, *inputCloud);
125 ARMARX_LOG <<
"writing to file: " << fileName;
127 provideResultPointClouds(inputCloud);
130 if (numClouds && currentCloud >= numClouds)
133 this->getArmarXManager()->asyncShutdown();
134 PointCloudProcessor::onDisconnectComponent();
138 cycleKeeper->waitForCycleDuration();