PointCloudProcessor.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package VisionX::Core
19  * @author David Gonzalez Aguirre (david dot gonzalez at kit dot edu)
20  * @date 2014
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 // ArmarXCore
32 
33 // VisionXInterfaces
34 #include <VisionX/interface/core/DataTypes.h>
35 #include <VisionX/interface/core/PointCloudProcessorInterface.h>
36 
37 // VisionXTools
39 #include "PointCloudConversions.h"
40 #include "PointCloudProvider.h"
41 
42 #include <IceUtil/IceUtil.h>
43 
44 #include <condition_variable>
45 #include <shared_mutex>
46 #include <mutex>
47 
48 namespace visionx
49 {
50  // ====================================================================== //
51  // == class PointCloudTransferStats declaration ============================== //
52  // ====================================================================== //
53 
54  /**
55  * The PointCloudTransferStats class provides information on the connection
56  * between PointCloudProvider and PointCloudProcessor. Use
57  * PointCloudProcessorBase::getPointCloudTransferStats() in order to retrieve the
58  * statistics
59  */
61  {
62 
63  public:
64 
66  {
68  pollingFPS.reset();
69  }
70 
71  /// Statistics for the PointClouds announced by the PointCloudProvider.
73 
74  /// Statistics for the PointClouds polled by the PointCloudProcessor.
76  };
77 
78 
79  // ====================================================================== //
80  // == class PointCloudProviderInfo declaration ========================== //
81  // ====================================================================== //
82 
84  {
85  public:
86  /// Proxy to PointCloud provider.
87  PointCloudProviderInterfacePrx proxy;
88 
89  /// Memory block.
90  std::vector<unsigned char> buffer;
91 
92  /// PointCloud format struct that contains all necessary PointCloud information.
93  MetaPointCloudFormatPtr pointCloudFormat;
94 
95  /// Indicates whether an PointCloud is available.
97 
98  /// Transfer mode of images
99  ImageTransferMode pointCloudTransferMode;
100 
101  /// Conditional variable used internally for synchronization purposes
102  std::shared_ptr<std::condition_variable> pointCloudAvailableEvent;
103  };
104 
105 
108  {
109  public:
111  };
112 
113 
114  // ====================================================================== //
115  // == class ResultPointCloudProvider declaration ======================== //
116  // ====================================================================== //
117  /**
118  * The ResultPointCloudProvider is used by the PointCloudProcessor to stream
119  * result PointClouds to any other processor (e.g. PointCloudMonitor)
120  * Use PointCloudProcessor::enableVisualization() and PointCloudProcessor::provideResultPointClouds()
121  * in order to offer result PointClouds in an PointCloud processor.
122  */
124  virtual public PointCloudProvider
125  {
126  friend class PointCloudProcessor;
127 
128  public:
130 
131  template <typename PointCloudPtrT>
132  void provideResultPointClouds(PointCloudPtrT pointCloudPtr)
133  {
134  providePointCloud(pointCloudPtr);
135  }
136 
137  protected:
138 
139  void setResultPointCloudProviderName(const std::string& name);
140 
141  virtual std::string getDefaultName() const override;
142 
143  void setShmCapacity(size_t shmCapacity);
144  size_t getShmCapacity();
145 
146  void setPointContentType(PointContentType type);
147  PointContentType getPointContentType() const;
148 
149 
150  virtual void onInitPointCloudProvider() override;
151  virtual void onExitPointCloudProvider() override;
152 
153  virtual MetaPointCloudFormatPtr getDefaultPointCloudFormat() override;
155 
156  private:
157 
158  std::string resultPointCloudProviderName;
159 
160  size_t shmCapacity;
161 
162  PointContentType pointContentType;
163  };
164 
165 
166  /**
167  * @brief Properties of `PointCloudProcessor`.
168  *
169  * Let your own point cloud processor's properties derive from this class
170  * to get the default properties of `PointCloudProcessor`. These include
171  * `ProviderName`, `FrameRate` and `AutomaticTypeConversion`.
172  */
175  {
176  public:
178  };
179 
180 
181  /**
182  * The PointCloudProcessor class provides an interface for access to
183  * PointCloudProviders via Ice and shared memory. The interface defines a set of
184  * convenience methods which simplify the PointCloud access.
185  */
187  virtual public armarx::Component,
188  virtual public PointCloudProcessorInterface
189  {
190  public:
191  /**
192  * Registers a delayed topic subscription and a delayed provider proxy
193  * retrieval which will be available on the start of the component.
194  *
195  * @param name Provider name
196  */
197  void usingPointCloudProvider(std::string providerName);
198  void usingPointCloudProviderFromProperty(const std::string& prop)
199  {
200  usingPointCloudProvider(getProperty<std::string>(prop).getValue());
201  }
202 
203  /**
204  * Removes topic subscription and provider proxy dependency to release
205  * a point cloud provider. After this, provider is not available in
206  * waitForPointClouds() or getPointClouds() calls.
207  */
208  void releasePointCloudProvider(std::string providerName);
209 
210  /**
211  * Select an PointCloudProvider.
212  *
213  * This method subscribes to an an PointCloudProvider and makes the provider
214  * available in the waitForPointClouds() and getPointClouds() methods.
215  *
216  * @param name Ice adapter name of the PointCloudProvider
217  * @param waitForProxy If true, this function blocks until the proxy for the pointCloudProvider becomes available.
218  *
219  * @return Information of the PointCloud provider
220  */
221  PointCloudProviderInfo getPointCloudProvider(std::string name, bool waitForProxy = false);
223 
224  /// Get the names of providers for which `usingPointCloudProvider()` has been called.
225  std::vector<std::string> getPointCloudProviderNames() const;
226  /// Indicate whether the given name identifies a known point cloud provider.
227  bool isPointCloudProviderKnown(const std::string& providerName) const;
228 
229 
230  /**
231  * Enables visualization
232  *
233  * @param numberPointClouds number of PointClouds provided by the visualization
234  * @param PointCloud::Grid2DDimensions size of PointClouds
235  * @param PointCloudFormatInfo type of PointClouds
236  *
237  * @return Information of the PointCloud provider
238  */
239  template<typename PointT>
240  void enableResultPointClouds(std::string resultProviderName = "")
241  {
242  std::shared_lock lock(pointCloudProviderInfoMutex);
243 
244  if (pointCloudProviderInfoMap.size() == 1)
245  {
246  enableResultPointCloudForInputProvider<PointT>(pointCloudProviderInfoMap.begin()->first, resultProviderName);
247  }
248  else
249  {
250  ARMARX_ERROR << "unable to determine shared memory capacity for result provider. (result provider is not enabled!)";
251  }
252  }
253 
254  template<typename PointT>
255  void enableResultPointCloudForInputProvider(const std::string& inputProviderName, const std::string& resultProviderName = "")
256  {
257  std::shared_lock lock(pointCloudProviderInfoMutex);
258 
259  if (pointCloudProviderInfoMap.count(inputProviderName))
260  {
261  MetaPointCloudFormatPtr info = pointCloudProviderInfoMap.at(inputProviderName).pointCloudFormat;
262 
263  PointContentType pointContentType = tools::getPointContentType<PointT>();
264 
265  size_t capacity = info->capacity * tools::getBytesPerPoint(pointContentType) / tools::getBytesPerPoint(info->type);
266 
267  enableResultPointClouds(resultProviderName, capacity, pointContentType);
268  }
269  else
270  {
271  ARMARX_ERROR << "unable to determine shared memory capacity for result provider. (result provider is not enabled!)"
272  << "\nThe according input provider is " << inputProviderName;
273  }
274  }
275 
276  void enableResultPointClouds(std::string resultProviderName, size_t shmCapacity, PointContentType pointContentType);
277 
278 
279  /**
280  * sends result PointClouds for visualization
281  * @see enableVisualization
282  *
283  * @param PointClouds array of PointClouds to send
284  */
285  template <typename PointCloudPtrT>
286  void provideResultPointClouds(const PointCloudPtrT& pointClouds, std::string providerName = "")
287  {
288  std::shared_lock lock(resultProviderMutex);
289 
290  if (providerName == "" && resultPointCloudProviders.size() > 0)
291  {
292  providerName = resultPointCloudProviders.begin()->first;
293  }
294 
295  if (resultPointCloudProviders.count(providerName))
296  {
297  resultPointCloudProviders[providerName] -> template provideResultPointClouds(pointClouds);
298  }
299  else
300  {
301  ARMARX_WARNING << "unable to find provider name: " << providerName
302  << "\nknown names :\n" << armarx::getMapKeys(resultPointCloudProviders);
303  }
304  }
305 
306  template <typename PointCloudPtrT>
307  void provideResultPointClouds(const std::string& providerName, const PointCloudPtrT& pointClouds)
308  {
309  provideResultPointClouds(pointClouds, providerName);
310  }
311  /**
312  * Wait for new PointClouds.
313  *
314  * Wait for new PointCloud of an PointCloud provider. Use if only one
315  * PointCloudProvider is used (see usingPointCloudProvider).
316  *
317  * @param milliseconds Timeout for waiting
318  *
319  * @return True if new PointClouds are available. False in case of error or
320  * timeout
321  */
322  bool waitForPointClouds(int milliseconds = 1000);
323 
324  /**
325  * Wait for new PointClouds.
326  *
327  * Wait for new PointCloud of an PointCloud provider. Use if multiple
328  * PointCloudProviders are used (see usingPointCloudProvider).
329  *
330  * @param providerName Name of provider to wait for PointClouds
331  * @param milliseconds Timeout for waiting
332  *
333  * @return True if new PointClouds are available. False in case of error or
334  * timeout
335  */
336  bool waitForPointClouds(const std::string& providerName, int milliseconds = 1000);
337 
338  /**
339  * Returns current status for the given point cloud. True if new data is available, false otherwise.
340  *
341  * This operation does not block. It just returns the current status.
342  * Use this if you want to get status of a point cloud without polling
343  * it for a given time like the other methods do.
344  *
345  * @param providerName Name of provider to wait for PointClouds
346  *
347  * @return True if new data from the provider is available. False otherwise.
348  */
349  bool pointCloudHasNewData(std::string providerName);
350 
351  /**
352  * Poll PointClouds from provider.
353  *
354  * Polls PointClouds from a used PointCloudProvider either via shared memory or
355  * via Ice. If both components run on the same machine, shared memory
356  * transfer is used. Otherwise Ice is used for PointCloud transmission. The
357  * transfer type is decided in the usingPointCloudProvider method and is set
358  * in the corresponding PointCloudFormatInfo.
359  *
360  * Use this method if only one PointCloudProvider is used.
361  *
362  * @param ppPointClouds PointCloud buffers where the PointClouds are
363  * copied to. The buffers have to be
364  * initialized by the component. All
365  * required information for the allocation
366  * of the buffers can be found in the
367  * corresponding PointCloudFormatInfo.
368  *
369  * @return Number of PointClouds copied. Zero if no new PointClouds have been
370  * available.
371  */
372  template<typename PointCloudPtrT>
373  int getPointClouds(const PointCloudPtrT& pointCloudPtr)
374  {
375  if (pointCloudProviderInfoMap.size() != 1)
376  {
377  ARMARX_ERROR << "Calling getPointClouds without PointCloudProvider name but using multiple PointCloudProviders or without usingPointCloudProvider";
378  return false;
379  }
380 
381  std::shared_lock lock(pointCloudProviderInfoMutex);
382 
383  std::string providerName = pointCloudProviderInfoMap.begin()->first;
384 
385  lock.unlock();
386 
387  return getPointClouds(providerName, pointCloudPtr);
388  }
389 
390  /**
391  * Poll PointClouds from provider.
392  *
393  * Polls PointClouds from a used PointCloudProvider either via shared memory or
394  * via Ice. If both components run on the same machine, shared memory
395  * transfer is used. Otherwise Ice is used for PointCloud transmission. The
396  * transfer type is decided in the usingPointCloudProvider method and is set
397  * in the corresponding PointCloudFormatInfo.
398  *
399  * Use this method if multiple PointCloudProviders are used.
400  *
401  * @param providerName Name of provider to poll from
402  *
403  * @param ppPointClouds PointCloud buffers where the PointClouds are
404  * copied to. The buffers have to be
405  * initialized by the component. All
406  * required information for the allocation
407  * PointCloudProcessor.h of the buffers can be found in the
408  * corresponding PointCloudFormatInfo.
409  *
410  * @return Number of PointClouds copied. Zero if no new PointClouds have been
411  * available.
412  */
413  template<typename PointCloudPtrT>
414  bool getPointClouds(std::string providerName, const PointCloudPtrT& pointClouds)
415  {
416  using PointCloudT = typename PointCloudPtrT::element_type;
417  using PointT = typename PointCloudT::PointType;
418 
419  if (pointClouds == NULL)
420  {
421  ARMARX_ERROR << "pointClouds is NULL";
422  return false;
423  }
424 
425  std::shared_lock lock(pointCloudProviderInfoMutex);
426 
427  // find PointCloud provider
428  std::map<std::string, PointCloudProviderInfo>::iterator iter = pointCloudProviderInfoMap.find(providerName);
429 
430  if (iter == pointCloudProviderInfoMap.end())
431  {
432  ARMARX_ERROR << "Trying to retrieve PointClouds from unknown PointCloud provider. Call usingPointCloudProvider before";
433  return false;
434  }
435 
436  // check if new PointClouds are available
437  if (!iter->second.pointCloudAvailable)
438  {
439  ARMARX_WARNING << "no point cloud available. use waitForPointCloud()";
440  return false;
441  }
442 
443  PointCloudProviderInfo& providerInfo = iter->second;
444 
445  if (providerInfo.pointCloudFormat->type != visionx::tools::getPointContentType<PointT>()
447  {
448  auto requested = visionx::tools::getPointContentType<PointT>();
450  << "Requested point cloud format (" << tools::toString(requested) << ")"
451  << " differs from provided format (" << tools::toString(providerInfo.pointCloudFormat->type) << "),"
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.";
456  return false;
457  }
458 
459  try
460  {
461  if (providerInfo.pointCloudTransferMode == eIceTransfer)
462  {
463  // providerInfo.info->timeProvided = TimeUtil::GetTime().toMicroSeconds();
464  std::vector<Ice::Byte> blob = providerInfo.proxy->getPointCloud(providerInfo.pointCloudFormat);
465  blob.swap(providerInfo.buffer);
466  }
467  else
468  {
469  usedPointCloudProviders[providerName]->getData(providerInfo.buffer, providerInfo.pointCloudFormat);
470  }
471  // usedPointCloudProviders[providerName]->getData(providerInfo.buffer, providerInfo.pointCloudFormat);
472 
473  void* bufferPtr = providerInfo.buffer.data();
474  void** bufferPtrPtr = &bufferPtr; // Why though?
475  visionx::tools::convertToPCL(bufferPtrPtr, providerInfo.pointCloudFormat, pointClouds);
476  }
477  catch (...)
478  {
479  ARMARX_ERROR << "unable to get point cloud: " << armarx::GetHandledExceptionString();
480  return false;
481  }
482 
483 
484  // todo lock for writing...
485  iter->second.pointCloudAvailable = false;
486 
487  IceUtil::Time timeReceived = IceUtil::Time::now();
488  IceUtil::Time timeProvided = IceUtil::Time::microSeconds(providerInfo.pointCloudFormat->timeProvided);
489 
490  pointClouds->header.stamp = providerInfo.pointCloudFormat->timeProvided;
491  pointClouds->header.seq = providerInfo.pointCloudFormat->seq;
492  //pointClouds->header.frame_id = providerInfo.pointCloudFormat->frameId;
493 
494  long transferTime = (timeReceived - timeProvided).toMilliSeconds();
495 
496  ARMARX_DEBUG << "received point cloud size: " << pointClouds->width << "x" << pointClouds->height << ". took " << transferTime << " ms.";
497 
498  std::unique_lock lock2(statisticsMutex);
499 
500  statistics[providerName].pollingFPS.update();
501 
502  return true;
503  }
504 
505  MetaPointCloudFormatPtr getPointCloudFormat(std::string providerName);
506 
507 
508  /**
509  * Retrieve statistics for a connection to an PointCloudProvider.
510  *
511  * @param providerName Name of the provider
512  * @param resetStats Reset statistics
513  *
514  * @return Reference to statistics for the connection to the provder
515  */
516  PointCloudTransferStats getPointCloudTransferStats(std::string providerName,
517  bool resetStats = false);
518 
519  /**
520  * @brief Get the reference frame of the point cloud by given provider.
521  * @param providerName The point cloud provider's name.
522  * @return The point cloud's reference frame, or empty string if provider
523  * is unknown or has not specified a reference frame.
524  */
525  std::string getPointCloudFrame(const std::string& providerName, const std::string& defaultFrame = "");
526 
527  protected:
528  // ================================================================== //
529  // == Interface of an PointCloudProcessor =========================== //
530  // ================================================================== //
531  /**
532  * Setup the vision component.
533  *
534  * Implement this method in the PointCloudProcessor in order to setup its
535  * parameters. Use this for the registration of adaptars and
536  * subscription to topics
537  *
538  * @param argc number of filtered command line arguments
539  * @param argv filtered command line arguments
540  */
541  virtual void onInitPointCloudProcessor() = 0;
542 
543  /**
544  * Implement this method in the PointCloudProcessor in order execute parts
545  * when the component is fully initialized and about to run.
546  */
547  virtual void onConnectPointCloudProcessor() = 0;
548 
549  /**
550  * Implement this method in the PointCloudProcessor in order execute parts
551  * when the component looses network connectivity.
552  */
554 
555  /**
556  * Exit the ImapeProcessor component.
557  *
558  * Implement this method in order to clean up the PointCloudProcessor
559  */
560  virtual void onExitPointCloudProcessor() = 0;
561 
562  /**
563  * Process the vision component.
564  *
565  * The main loop of the PointCloudProcessor to be implemented in the
566  * subclass. Do not block this method. One process should execute
567  * exactly one PointCloud processing step.
568  */
569  virtual void process() = 0;
570 
571  // ================================================================== //
572  // == RunningComponent implementation =============================== //
573  // ================================================================== //
574 
575  /// @see Component::onInitComponent()
576  virtual void onInitComponent() override;
577 
578  /// @see Component::onConnectComponent()
579  virtual void onConnectComponent() override;
580 
581  /// @see Component::onDisconnectComponent()
582  virtual void onDisconnectComponent() override;
583 
584  /// @see Component::onExitComponent()
585  virtual void onExitComponent() override;
586 
587  /// @see RunningTask
588  virtual void runProcessor();
589 
590 
591  protected:
592  // ================================================================== //
593  // == PointCloudListener Ice interface ============================== //
594  // ================================================================== //
595  /**
596  * Listener callback function. This is called by the used PointCloud
597  * providers to report the availability of a newly captured
598  * PointCloud.
599  *
600  * @param providerName The reporting PointCloud provider name
601  */
602  void reportPointCloudAvailable(const std::string& providerName,
603  const Ice::Current& c = Ice::emptyCurrent) override;
604 
605  // PointCloud provider.
606 
607  using PointCloudProviderMap = std::map<std::string, armarx::IceSharedMemoryConsumer<unsigned char, MetaPointCloudFormat>::pointer_type>;
609 
610  std::map<std::string, PointCloudProviderInfo> pointCloudProviderInfoMap;
611  std::shared_mutex pointCloudProviderInfoMutex;
612 
613  // Result PointCloud visualization.
614  std::map<std::string, IceInternal::Handle<ResultPointCloudProvider> > resultPointCloudProviders;
615  std::shared_mutex resultProviderMutex;
616 
617  // Statistics.
618  std::mutex statisticsMutex;
619  std::map<std::string, PointCloudTransferStats> statistics;
620 
622 
624  float frameRate;
625 
627  };
628 
629  /// Shared pointer for convenience.
631 
632 }
633 
634 
visionx::ResultPointCloudProvider::getShmCapacity
size_t getShmCapacity()
Definition: PointCloudProcessor.cpp:73
armarx::ManagedIceObject::waitForProxy
void waitForProxy(std::string const &name, bool addToDependencies)
Definition: ManagedIceObject.cpp:174
visionx::PointCloudProcessor::provideResultPointClouds
void provideResultPointClouds(const std::string &providerName, const PointCloudPtrT &pointClouds)
Definition: PointCloudProcessor.h:307
visionx::PointCloudProcessor::pointCloudHasNewData
bool pointCloudHasNewData(std::string providerName)
Returns current status for the given point cloud.
Definition: PointCloudProcessor.cpp:486
algorithm.h
visionx::PointCloudProcessor::getPointCloudTransferStats
PointCloudTransferStats getPointCloudTransferStats(std::string providerName, bool resetStats=false)
Retrieve statistics for a connection to an PointCloudProvider.
Definition: PointCloudProcessor.cpp:530
visionx::PointCloudProcessor::usingPointCloudProviderFromProperty
void usingPointCloudProviderFromProperty(const std::string &prop)
Definition: PointCloudProcessor.h:198
visionx::armem::pointcloud::PointType
PointType
Definition: constants.h:78
visionx::PointCloudProcessor::getPointCloudFormat
MetaPointCloudFormatPtr getPointCloudFormat(std::string providerName)
Definition: PointCloudProcessor.cpp:506
visionx::PointCloudProcessor::automaticConversion
bool automaticConversion
Definition: PointCloudProcessor.h:626
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::ResultPointCloudProvider::getPointContentType
PointContentType getPointContentType() const
Definition: PointCloudProcessor.cpp:83
visionx::PointCloudProcessor::enableResultPointCloudForInputProvider
void enableResultPointCloudForInputProvider(const std::string &inputProviderName, const std::string &resultProviderName="")
Definition: PointCloudProcessor.h:255
visionx::ResultPointCloudProvider::getDefaultName
virtual std::string getDefaultName() const override
Retrieve default name of component.
Definition: PointCloudProcessor.cpp:63
visionx::PointCloudProviderInfo::buffer
std::vector< unsigned char > buffer
Memory block.
Definition: PointCloudProcessor.h:90
visionx::PointCloudProcessor::PointCloudProviderMap
std::map< std::string, armarx::IceSharedMemoryConsumer< unsigned char, MetaPointCloudFormat >::pointer_type > PointCloudProviderMap
Definition: PointCloudProcessor.h:607
visionx::ResultPointCloudProviderPropertyDefinitions
Definition: PointCloudProcessor.h:106
visionx::PointCloudProviderInfo::proxy
PointCloudProviderInterfacePrx proxy
Proxy to PointCloud provider.
Definition: PointCloudProcessor.h:87
visionx::PointCloudProcessor::onConnectPointCloudProcessor
virtual void onConnectPointCloudProcessor()=0
Implement this method in the PointCloudProcessor in order execute parts when the component is fully i...
visionx::ResultPointCloudProvider::onInitPointCloudProvider
virtual void onInitPointCloudProvider() override
This is called when the Component::onInitComponent() is called.
Definition: PointCloudProcessor.cpp:88
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
visionx::PointCloudProcessor::onDisconnectComponent
virtual void onDisconnectComponent() override
Definition: PointCloudProcessor.cpp:217
PointCloudProvider.h
visionx::PointCloudProcessor::isPointCloudProviderKnown
bool isPointCloudProviderKnown(const std::string &providerName) const
Indicate whether the given name identifies a known point cloud provider.
Definition: PointCloudProcessor.cpp:392
visionx::PointCloudProcessor::statisticsMutex
std::mutex statisticsMutex
Definition: PointCloudProcessor.h:618
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
visionx::PointCloudProcessorPropertyDefinitions::PointCloudProcessorPropertyDefinitions
PointCloudProcessorPropertyDefinitions(std::string prefix)
Definition: PointCloudProcessor.cpp:111
visionx::PointCloudProcessor::pointCloudProviderInfoMutex
std::shared_mutex pointCloudProviderInfoMutex
Definition: PointCloudProcessor.h:611
visionx::PointCloudProcessor::onInitPointCloudProcessor
virtual void onInitPointCloudProcessor()=0
Setup the vision component.
RunningTask.h
visionx::PointCloudProcessor::processorTask
armarx::RunningTask< PointCloudProcessor >::pointer_type processorTask
Definition: PointCloudProcessor.h:621
visionx::PointCloudProcessor::onExitComponent
virtual void onExitComponent() override
Definition: PointCloudProcessor.cpp:223
visionx::PointCloudProcessor::getPointCloudFrame
std::string getPointCloudFrame(const std::string &providerName, const std::string &defaultFrame="")
Get the reference frame of the point cloud by given provider.
Definition: PointCloudProcessor.cpp:559
visionx::PointCloudProviderInfo
Definition: PointCloudProcessor.h:83
IceInternal::Handle
Definition: forward_declarations.h:8
visionx::PointCloudProcessor::onExitPointCloudProcessor
virtual void onExitPointCloudProcessor()=0
Exit the ImapeProcessor component.
armarx::GetHandledExceptionString
std::string GetHandledExceptionString()
Definition: Exception.cpp:147
visionx::FPSCounter::reset
void reset()
Resets the FPS counter to its initial state.
Definition: FPSCounter.cpp:49
visionx::PointCloudProcessor::pointCloudProviderInfoMap
std::map< std::string, PointCloudProviderInfo > pointCloudProviderInfoMap
Definition: PointCloudProcessor.h:610
visionx::ResultPointCloudProvider::provideResultPointClouds
void provideResultPointClouds(PointCloudPtrT pointCloudPtr)
Definition: PointCloudProcessor.h:132
visionx::PointCloudProcessor::provideResultPointClouds
void provideResultPointClouds(const PointCloudPtrT &pointClouds, std::string providerName="")
sends result PointClouds for visualization
Definition: PointCloudProcessor.h:286
visionx::PointCloudProviderInfo::pointCloudTransferMode
ImageTransferMode pointCloudTransferMode
Transfer mode of images.
Definition: PointCloudProcessor.h:99
visionx::PointCloudProcessor
The PointCloudProcessor class provides an interface for access to PointCloudProviders via Ice and sha...
Definition: PointCloudProcessor.h:186
visionx::PointCloudProviderInfo::pointCloudAvailable
bool pointCloudAvailable
Indicates whether an PointCloud is available.
Definition: PointCloudProcessor.h:96
visionx::PointCloudProcessor::process
virtual void process()=0
Process the vision component.
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:177
visionx::ResultPointCloudProvider::ResultPointCloudProvider
ResultPointCloudProvider()
Definition: PointCloudProcessor.cpp:52
visionx::PointCloudProviderPropertyDefinitions
Definition: PointCloudProvider.h:42
visionx::ResultPointCloudProvider::setPointContentType
void setPointContentType(PointContentType type)
Definition: PointCloudProcessor.cpp:78
visionx::PointCloudProcessor::waitForPointClouds
bool waitForPointClouds(int milliseconds=1000)
Wait for new PointClouds.
Definition: PointCloudProcessor.cpp:433
visionx::PointCloudTransferStats::pollingFPS
FPSCounter pollingFPS
Statistics for the PointClouds polled by the PointCloudProcessor.
Definition: PointCloudProcessor.h:75
visionx::PointCloudProviderInfo::pointCloudFormat
MetaPointCloudFormatPtr pointCloudFormat
PointCloud format struct that contains all necessary PointCloud information.
Definition: PointCloudProcessor.h:93
IceSharedMemoryConsumer.h
visionx::ResultPointCloudProvider::setResultPointCloudProviderName
void setResultPointCloudProviderName(const std::string &name)
Definition: PointCloudProcessor.cpp:58
visionx::PointCloudProcessor::fpsCounter
FPSCounter fpsCounter
Definition: PointCloudProcessor.h:623
visionx::ResultPointCloudProvider::onExitPointCloudProvider
virtual void onExitPointCloudProvider() override
This is called when the Component::onExitComponent() setup is called.
Definition: PointCloudProcessor.cpp:92
IceManager.h
armarx::PointCloudT
pcl::PointCloud< PointT > PointCloudT
Definition: Common.h:30
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
visionx::PointCloudProcessorPropertyDefinitions
Properties of PointCloudProcessor.
Definition: PointCloudProcessor.h:173
visionx::tools::toString
std::string toString(PointContentType pointContent)
Definition: PointCloudConversions.cpp:765
visionx::PointCloudProcessor::getPointClouds
int getPointClouds(const PointCloudPtrT &pointCloudPtr)
Poll PointClouds from provider.
Definition: PointCloudProcessor.h:373
visionx::ResultPointCloudProvider
The ResultPointCloudProvider is used by the PointCloudProcessor to stream result PointClouds to any o...
Definition: PointCloudProcessor.h:123
visionx::ResultPointCloudProvider::createPropertyDefinitions
virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PointCloudProcessor.cpp:105
visionx::PointCloudProviderInfo::pointCloudAvailableEvent
std::shared_ptr< std::condition_variable > pointCloudAvailableEvent
Conditional variable used internally for synchronization purposes.
Definition: PointCloudProcessor.h:102
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
visionx::PointCloudProcessor::frameRate
float frameRate
Definition: PointCloudProcessor.h:624
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
visionx::tools::convertToPCL
void convertToPCL(void **source, visionx::MetaPointCloudFormatPtr pointCloudFormat, pcl::PointCloud< pcl::PointXYZRGBA >::Ptr targetPtr)
Definition: PointCloudConversions.cpp:146
PointCloudConversions.h
visionx::PointCloudProcessor::releasePointCloudProvider
void releasePointCloudProvider(std::string providerName)
Removes topic subscription and provider proxy dependency to release a point cloud provider.
Definition: PointCloudProcessor.cpp:275
visionx::PointCloudProcessor::getPointClouds
bool getPointClouds(std::string providerName, const PointCloudPtrT &pointClouds)
Poll PointClouds from provider.
Definition: PointCloudProcessor.h:414
visionx::PointCloudProcessor::onConnectComponent
virtual void onConnectComponent() override
Definition: PointCloudProcessor.cpp:201
visionx::PointCloudProvider::providePointCloud
void providePointCloud(PointCloudPtrT pointCloudPtr)
offer the new point cloud.
Definition: PointCloudProvider.h:122
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
visionx::PointCloudProcessor::onDisconnectPointCloudProcessor
virtual void onDisconnectPointCloudProcessor()
Implement this method in the PointCloudProcessor in order execute parts when the component looses net...
Definition: PointCloudProcessor.h:553
visionx::ResultPointCloudProviderPropertyDefinitions::ResultPointCloudProviderPropertyDefinitions
ResultPointCloudProviderPropertyDefinitions(std::string prefix)
Definition: PointCloudProcessor.cpp:47
IceUtil::Handle< class PropertyDefinitionContainer >
visionx::PointCloudProcessor::usingPointCloudProvider
void usingPointCloudProvider(std::string providerName)
Registers a delayed topic subscription and a delayed provider proxy retrieval which will be available...
Definition: PointCloudProcessor.cpp:261
visionx::PointCloudProcessor::onInitComponent
virtual void onInitComponent() override
Definition: PointCloudProcessor.cpp:123
visionx::ResultPointCloudProvider::setShmCapacity
void setShmCapacity(size_t shmCapacity)
Definition: PointCloudProcessor.cpp:68
visionx::PointCloudProcessor::statistics
std::map< std::string, PointCloudTransferStats > statistics
Definition: PointCloudProcessor.h:619
visionx::PointCloudTransferStats
The PointCloudTransferStats class provides information on the connection between PointCloudProvider a...
Definition: PointCloudProcessor.h:60
visionx::tools::getBytesPerPoint
size_t getBytesPerPoint(visionx::PointContentType pointContent)
Definition: PointCloudConversions.cpp:64
armarx::Logging::deactivateSpam
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.
Definition: Logging.cpp:92
visionx::PointCloudProcessor::getPointCloudProvider
PointCloudProviderInfo getPointCloudProvider(std::string name, bool waitForProxy=false)
Select an PointCloudProvider.
Definition: PointCloudProcessor.cpp:304
visionx::PointCloudTransferStats::PointCloudTransferStats
PointCloudTransferStats()
Definition: PointCloudProcessor.h:65
visionx::ResultPointCloudProvider::getDefaultPointCloudFormat
virtual MetaPointCloudFormatPtr getDefaultPointCloudFormat() override
default point cloud format used to initialize shared memory
Definition: PointCloudProcessor.cpp:96
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
visionx::PointCloudTransferStats::pointCloudProviderFPS
FPSCounter pointCloudProviderFPS
Statistics for the PointClouds announced by the PointCloudProvider.
Definition: PointCloudProcessor.h:72
visionx::PointCloudProcessor::enableResultPointClouds
void enableResultPointClouds(std::string resultProviderName="")
Enables visualization.
Definition: PointCloudProcessor.h:240
visionx::PointCloudProcessor::getPointCloudProviderNames
std::vector< std::string > getPointCloudProviderNames() const
Get the names of providers for which usingPointCloudProvider() has been called.
Definition: PointCloudProcessor.cpp:381
FPSCounter.h
armarx::getMapKeys
void getMapKeys(const MapType &map, OutputIteratorType it)
Definition: algorithm.h:157
visionx::PointCloudProvider
PointCloudProvider abstract class defines a component which provide point clouds via ice or shared me...
Definition: PointCloudProvider.h:58
visionx::PointCloudProcessor::resultProviderMutex
std::shared_mutex resultProviderMutex
Definition: PointCloudProcessor.h:615
visionx::PointCloudProcessor::runProcessor
virtual void runProcessor()
Definition: PointCloudProcessor.cpp:236
visionx::FPSCounter
The FPSCounter class provides methods for calculating the frames per second (FPS) count in periodic t...
Definition: FPSCounter.h:36
visionx::PointCloudProcessor::resultPointCloudProviders
std::map< std::string, IceInternal::Handle< ResultPointCloudProvider > > resultPointCloudProviders
Definition: PointCloudProcessor.h:614
visionx::PointT
pcl::PointXYZRGBA PointT
Definition: MaskRCNNPointCloudObjectLocalizer.h:79
visionx::PointCloudProcessor::usedPointCloudProviders
PointCloudProviderMap usedPointCloudProviders
Definition: PointCloudProcessor.h:608
visionx::PointCloudProcessor::reportPointCloudAvailable
void reportPointCloudAvailable(const std::string &providerName, const Ice::Current &c=Ice::emptyCurrent) override
Listener callback function.
Definition: PointCloudProcessor.cpp:575