29#include <pcl/filters/filter.h>
88 pcl::PointCloud<PointT>::Ptr inputCloud(
new pcl::PointCloud<PointT>());
93 ARMARX_INFO <<
"Timeout or error while waiting for point cloud data";
109 std::to_string(inputCloud->header.stamp) +
".pcd";
111 const auto isNan = [](
const PointT& p) ->
bool {
return std::isnan(p.z); };
115 inputCloud->points.erase(
116 std::remove_if(inputCloud->points.begin(), inputCloud->points.end(), isNan),
117 inputCloud->points.end());
119 inputCloud->width = inputCloud->points.size();
120 inputCloud->height = 1;
121 inputCloud->is_dense =
true;
126 pcl::io::savePCDFileBinary(fileName, *inputCloud);
130 pcl::io::savePCDFileASCII(fileName, *inputCloud);
133 ARMARX_LOG <<
"writing to file: " << fileName;
138 if (numClouds && currentCloud >= numClouds)
142 PointCloudProcessor::onDisconnectComponent();
146 cycleKeeper->waitForCycleDuration();
152 return "PointCloudRecorder";
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
This util class helps with keeping a cycle time during a control cycle.
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
ArmarXManagerPtr getArmarXManager() const
Returns the ArmarX manager used to add and remove components.
Brief description of class PointCloudRecorder.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onExitPointCloudProcessor() override
void onConnectPointCloudProcessor() override
void onDisconnectPointCloudProcessor() override
static std::string GetDefaultName()
void onInitPointCloudProcessor() override
std::string getDefaultName() const override
Retrieve default name of component.
void enableResultPointClouds(std::string resultProviderName="")
Enables visualization.
int getPointClouds(const PointCloudPtrT &pointCloudPtr)
Poll PointClouds from provider.
bool waitForPointClouds(int milliseconds=1000)
Wait for new PointClouds.
void provideResultPointClouds(const PointCloudPtrT &pointClouds, std::string providerName="")
sends result PointClouds for visualization
#define ARMARX_INFO
The normal logging level.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.