Go to the documentation of this file.
34 #include <VisionX/interface/core/DataTypes.h>
35 #include <VisionX/interface/core/PointCloudProcessorInterface.h>
38 #include <condition_variable>
40 #include <shared_mutex>
42 #include <IceUtil/IceUtil.h>
86 PointCloudProviderInterfacePrx
proxy;
126 template <
typename Po
intCloudPtrT>
152 std::string resultPointCloudProviderName;
156 PointContentType pointContentType;
179 virtual public PointCloudProcessorInterface
231 template <
typename Po
intT>
239 enableResultPointCloudForInputProvider<PointT>(
244 ARMARX_ERROR <<
"unable to determine shared memory capacity for result provider. "
245 "(result provider is not enabled!)";
249 template <
typename Po
intT>
252 const std::string& resultProviderName =
"")
258 MetaPointCloudFormatPtr info =
261 PointContentType pointContentType = tools::getPointContentType<PointT>();
270 ARMARX_ERROR <<
"unable to determine shared memory capacity for result provider. "
271 "(result provider is not enabled!)"
272 <<
"\nThe according input provider is " << inputProviderName;
278 PointContentType pointContentType);
286 template <
typename Po
intCloudPtrT>
304 ARMARX_WARNING <<
"unable to find provider name: " << providerName
305 <<
"\nknown names :\n"
310 template <
typename Po
intCloudPtrT>
378 template <
typename Po
intCloudPtrT>
384 ARMARX_ERROR <<
"Calling getPointClouds without PointCloudProvider name but using "
385 "multiple PointCloudProviders or without usingPointCloudProvider";
421 template <
typename Po
intCloudPtrT>
425 using PointCloudT =
typename PointCloudPtrT::element_type;
428 if (pointClouds == NULL)
437 std::map<std::string, PointCloudProviderInfo>::iterator iter =
442 ARMARX_ERROR <<
"Trying to retrieve PointClouds from unknown PointCloud provider. "
443 "Call usingPointCloudProvider before";
448 if (!iter->second.pointCloudAvailable)
450 ARMARX_WARNING <<
"no point cloud available. use waitForPointCloud()";
457 visionx::tools::getPointContentType<PointT>() &&
460 auto requested = visionx::tools::getPointContentType<PointT>();
463 <<
" differs from provided format ("
465 <<
"\nbut automatic type conversion is disabled."
466 <<
"\nTo enable automatic type conversion, set the property "
467 "'AutomaticTypeConversion' to true"
468 <<
"\n (make sure your point cloud processor's properties derive "
469 "from 'PointCloudProcessorPropertyDefinitions')."
470 <<
"\nThe received point cloud will appear empty.";
479 std::vector<Ice::Byte> blob =
481 blob.swap(providerInfo.
buffer);
490 void* bufferPtr = providerInfo.
buffer.data();
491 void** bufferPtrPtr = &bufferPtr;
504 iter->second.pointCloudAvailable =
false;
514 long transferTime = (timeReceived - timeProvided).toMilliSeconds();
516 ARMARX_DEBUG <<
"received point cloud size: " << pointClouds->width <<
"x"
517 << pointClouds->height <<
". took " << transferTime <<
" ms.";
538 bool resetStats =
false);
547 const std::string& defaultFrame =
"");
628 const Ice::Current&
c = Ice::emptyCurrent)
override;
641 std::map<std::string, IceInternal::Handle<ResultPointCloudProvider>>
void waitForProxy(std::string const &name, bool addToDependencies)
void provideResultPointClouds(const std::string &providerName, const PointCloudPtrT &pointClouds)
bool pointCloudHasNewData(std::string providerName)
Returns current status for the given point cloud.
PointCloudTransferStats getPointCloudTransferStats(std::string providerName, bool resetStats=false)
Retrieve statistics for a connection to an PointCloudProvider.
void usingPointCloudProviderFromProperty(const std::string &prop)
MetaPointCloudFormatPtr getPointCloudFormat(std::string providerName)
PointContentType getPointContentType() const
void enableResultPointCloudForInputProvider(const std::string &inputProviderName, const std::string &resultProviderName="")
virtual std::string getDefaultName() const override
Retrieve default name of component.
std::vector< unsigned char > buffer
Memory block.
PointCloudProviderInterfacePrx proxy
Proxy to PointCloud provider.
virtual void onConnectPointCloudProcessor()=0
Implement this method in the PointCloudProcessor in order execute parts when the component is fully i...
virtual void onInitPointCloudProvider() override
This is called when the Component::onInitComponent() is called.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
virtual void onDisconnectComponent() override
bool isPointCloudProviderKnown(const std::string &providerName) const
Indicate whether the given name identifies a known point cloud provider.
std::mutex statisticsMutex
PointCloudProcessorPropertyDefinitions(std::string prefix)
std::shared_mutex pointCloudProviderInfoMutex
virtual void onInitPointCloudProcessor()=0
Setup the vision component.
armarx::RunningTask< PointCloudProcessor >::pointer_type processorTask
virtual void onExitComponent() override
std::string getPointCloudFrame(const std::string &providerName, const std::string &defaultFrame="")
Get the reference frame of the point cloud by given provider.
virtual void onExitPointCloudProcessor()=0
Exit the ImapeProcessor component.
std::string GetHandledExceptionString()
void reset()
Resets the FPS counter to its initial state.
std::map< std::string, PointCloudProviderInfo > pointCloudProviderInfoMap
void provideResultPointClouds(PointCloudPtrT pointCloudPtr)
void provideResultPointClouds(const PointCloudPtrT &pointClouds, std::string providerName="")
sends result PointClouds for visualization
ImageTransferMode pointCloudTransferMode
Transfer mode of images.
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
bool pointCloudAvailable
Indicates whether an PointCloud is available.
std::map< std::string, armarx::IceSharedMemoryConsumer< unsigned char, MetaPointCloudFormat >::pointer_type > PointCloudProviderMap
virtual void process()=0
Process the vision component.
ResultPointCloudProvider()
void setPointContentType(PointContentType type)
bool waitForPointClouds(int milliseconds=1000)
Wait for new PointClouds.
FPSCounter pollingFPS
Statistics for the PointClouds polled by the PointCloudProcessor.
MetaPointCloudFormatPtr pointCloudFormat
PointCloud format struct that contains all necessary PointCloud information.
void setResultPointCloudProviderName(const std::string &name)
virtual void onExitPointCloudProvider() override
This is called when the Component::onExitComponent() setup is called.
pcl::PointCloud< PointT > PointCloudT
Properties of PointCloudProcessor.
int getPointClouds(const PointCloudPtrT &pointCloudPtr)
Poll PointClouds from provider.
The ResultPointCloudProvider is used by the PointCloudProcessor to stream result PointClouds to any o...
virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
std::shared_ptr< std::condition_variable > pointCloudAvailableEvent
Conditional variable used internally for synchronization purposes.
armarx::core::time::DateTime Time
Baseclass for all ArmarX ManagedIceObjects requiring properties.
void releasePointCloudProvider(std::string providerName)
Removes topic subscription and provider proxy dependency to release a point cloud provider.
bool getPointClouds(std::string providerName, const PointCloudPtrT &pointClouds)
Poll PointClouds from provider.
virtual void onConnectComponent() override
void providePointCloud(PointCloudPtrT pointCloudPtr)
offer the new point cloud.
Default component property definition container.
virtual void onDisconnectPointCloudProcessor()
Implement this method in the PointCloudProcessor in order execute parts when the component looses net...
ResultPointCloudProviderPropertyDefinitions(std::string prefix)
void usingPointCloudProvider(std::string providerName)
Registers a delayed topic subscription and a delayed provider proxy retrieval which will be available...
virtual void onInitComponent() override
void setShmCapacity(size_t shmCapacity)
std::map< std::string, PointCloudTransferStats > statistics
The PointCloudTransferStats class provides information on the connection between PointCloudProvider a...
SpamFilterDataPtr deactivateSpam(float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
disables the logging for the current line for the given amount of seconds.
PointCloudProviderInfo getPointCloudProvider(std::string name, bool waitForProxy=false)
Select an PointCloudProvider.
PointCloudTransferStats()
virtual MetaPointCloudFormatPtr getDefaultPointCloudFormat() override
default point cloud format used to initialize shared memory
FPSCounter pointCloudProviderFPS
Statistics for the PointClouds announced by the PointCloudProvider.
void enableResultPointClouds(std::string resultProviderName="")
Enables visualization.
std::vector< std::string > getPointCloudProviderNames() const
Get the names of providers for which usingPointCloudProvider() has been called.
void getMapKeys(const MapType &map, OutputIteratorType it)
PointCloudProvider abstract class defines a component which provide point clouds via ice or shared me...
std::shared_mutex resultProviderMutex
virtual void runProcessor()
The FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic t...
std::map< std::string, IceInternal::Handle< ResultPointCloudProvider > > resultPointCloudProviders
PointCloudProviderMap usedPointCloudProviders
void reportPointCloudAvailable(const std::string &providerName, const Ice::Current &c=Ice::emptyCurrent) override
Listener callback function.