Go to the documentation of this file.
34 #include <VisionX/interface/core/DataTypes.h>
35 #include <VisionX/interface/core/PointCloudProcessorInterface.h>
42 #include <IceUtil/IceUtil.h>
44 #include <condition_variable>
45 #include <shared_mutex>
87 PointCloudProviderInterfacePrx
proxy;
131 template <
typename Po
intCloudPtrT>
158 std::string resultPointCloudProviderName;
162 PointContentType pointContentType;
188 virtual public PointCloudProcessorInterface
239 template<
typename Po
intT>
250 ARMARX_ERROR <<
"unable to determine shared memory capacity for result provider. (result provider is not enabled!)";
254 template<
typename Po
intT>
263 PointContentType pointContentType = tools::getPointContentType<PointT>();
271 ARMARX_ERROR <<
"unable to determine shared memory capacity for result provider. (result provider is not enabled!)"
272 <<
"\nThe according input provider is " << inputProviderName;
276 void enableResultPointClouds(std::string resultProviderName,
size_t shmCapacity, PointContentType pointContentType);
285 template <
typename Po
intCloudPtrT>
301 ARMARX_WARNING <<
"unable to find provider name: " << providerName
306 template <
typename Po
intCloudPtrT>
372 template<
typename Po
intCloudPtrT>
377 ARMARX_ERROR <<
"Calling getPointClouds without PointCloudProvider name but using multiple PointCloudProviders or without usingPointCloudProvider";
413 template<
typename Po
intCloudPtrT>
416 using PointCloudT =
typename PointCloudPtrT::element_type;
419 if (pointClouds == NULL)
432 ARMARX_ERROR <<
"Trying to retrieve PointClouds from unknown PointCloud provider. Call usingPointCloudProvider before";
437 if (!iter->second.pointCloudAvailable)
439 ARMARX_WARNING <<
"no point cloud available. use waitForPointCloud()";
445 if (providerInfo.
pointCloudFormat->type != visionx::tools::getPointContentType<PointT>()
448 auto requested = visionx::tools::getPointContentType<PointT>();
450 <<
"Requested point cloud format (" <<
tools::toString(requested) <<
")"
452 <<
"\nbut automatic type conversion is disabled."
453 <<
"\nTo enable automatic type conversion, set the property 'AutomaticTypeConversion' to true"
454 <<
"\n (make sure your point cloud processor's properties derive from 'PointCloudProcessorPropertyDefinitions')."
455 <<
"\nThe received point cloud will appear empty.";
465 blob.swap(providerInfo.
buffer);
473 void* bufferPtr = providerInfo.
buffer.data();
474 void** bufferPtrPtr = &bufferPtr;
485 iter->second.pointCloudAvailable =
false;
494 long transferTime = (timeReceived - timeProvided).toMilliSeconds();
496 ARMARX_DEBUG <<
"received point cloud size: " << pointClouds->width <<
"x" << pointClouds->height <<
". took " << transferTime <<
" ms.";
517 bool resetStats =
false);
525 std::string
getPointCloudFrame(
const std::string& providerName,
const std::string& defaultFrame =
"");
603 const Ice::Current&
c = Ice::emptyCurrent)
override;
607 using PointCloudProviderMap = std::map<std::string, armarx::IceSharedMemoryConsumer<unsigned char, MetaPointCloudFormat>::pointer_type>;
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.
std::map< std::string, armarx::IceSharedMemoryConsumer< unsigned char, MetaPointCloudFormat >::pointer_type > PointCloudProviderMap
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.
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.