PointCloudProcessor.cpp
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 #include "PointCloudProcessor.h"
26 
27 #include <chrono>
28 #include <thread>
29 
30 #include <pcl/console/print.h>
31 
37 
38 #include <VisionX/interface/components/Calibration.h> // For ReferenceFrameInterface
39 
40 
41 using namespace armarx;
42 
43 
44 namespace visionx
45 {
46 
47  ResultPointCloudProviderPropertyDefinitions::ResultPointCloudProviderPropertyDefinitions(std::string prefix) :
49  {
50  }
51 
53  resultPointCloudProviderName("ResultPointCloudProvider"),
54  pointContentType(PointContentType::eColoredPoints)
55  {
56  }
57 
59  {
60  resultPointCloudProviderName = name;
61  }
62 
64  {
65  return resultPointCloudProviderName;
66  }
67 
69  {
70  this->shmCapacity = shmCapacity;
71  }
72 
74  {
75  return shmCapacity;
76  }
77 
79  {
80  pointContentType = type;
81  }
82 
84  {
85  return pointContentType;
86  }
87 
89  {
90  }
91 
93  {
94  }
95 
97  {
98  MetaPointCloudFormatPtr info = new MetaPointCloudFormat();
99  info->capacity = static_cast<Ice::Int>(shmCapacity);
100  info->size = static_cast<Ice::Int>(shmCapacity);
101  info->type = pointContentType;
102  return info;
103  }
104 
106  {
108  }
109 
110 
113  {
114  defineOptionalProperty<float>("FrameRate", 0.0,
115  "Number of frames per second. If zero then this property is ignored.");
116  defineOptionalProperty<bool>("AutomaticTypeConversion", false,
117  "Automatically convert different point cloud types.");
118  defineOptionalProperty<std::string>("ProviderName", "",
119  "Name(s) of the point cloud provider(s).");
120  }
121 
122 
124  {
125 
126  switch (getProperty<armarx::MessageTypeT>("MinimumLoggingLevel"))
127  {
129  pcl::console::setVerbosityLevel(pcl::console::L_VERBOSE);
130  break;
132  pcl::console::setVerbosityLevel(pcl::console::L_DEBUG);
133  break;
136  pcl::console::setVerbosityLevel(pcl::console::L_INFO);
137  break;
139  pcl::console::setVerbosityLevel(pcl::console::L_WARN);
140  break;
143  pcl::console::setVerbosityLevel(pcl::console::L_ERROR);
144  break;
145  default:
146  pcl::console::setVerbosityLevel(pcl::console::L_ALWAYS);
147  break;
148  }
149 
150 
151 
152  if (hasProperty("FrameRate"))
153  {
154  getProperty(frameRate, "FrameRate");
155  }
156  else
157  {
158  frameRate = 0.0;
159  }
160 
161  if (hasProperty("AutomaticTypeConversion"))
162  {
163  getProperty(automaticConversion, "AutomaticTypeConversion");
164  }
165  else
166  {
167  automaticConversion = false;
168  }
169 
170  if (hasProperty("ProviderName") && !getProperty<std::string>("ProviderName").getValue().empty())
171  {
172  std::vector<std::string> providerNames =
173  armarx::Split(getProperty<std::string>("ProviderName"), ",", true);
174 
175  for (const std::string& providerName : providerNames)
176  {
177  if(providerName.empty())
178  {
179  ARMARX_ERROR << "Property " << VAROUT(providerNames) << " contains an invalid value";
180  }
181  else
182  {
183  usingPointCloudProvider(providerName);
184  }
185  }
186  }
187  else
188  {
189  ARMARX_INFO << "The PointCloudProcessor " << getDefaultName() << "'s properties seem to"
190  << "\nnot derive from PointCloudProcessorPropertyDefinitions. Consider"
191  << "\nderiving " << getDefaultName() << "'s properties from this class to get"
192  << "\ndefault point cloud processor properties, such as 'ProviderName', and"
193  << "\nthe respective features.";
194  }
195 
196 
197 
199  }
200 
202  {
204 
205  for (const auto& [providerName, _] : usedPointCloudProviders)
206  {
207  if (pointCloudProviderInfoMap.count(providerName) == 0)
208  {
209  getPointCloudProvider(providerName);
210  }
211  }
212 
214  processorTask->start();
215  }
216 
218  {
220  processorTask->stop();
221  }
222 
224  {
225  ARMARX_VERBOSE << "PointCloudProcessor::onExitComponent()";
227 
228  std::shared_lock lock(pointCloudProviderInfoMutex);
229 
230  for (auto& resultProvider : resultPointCloudProviders)
231  {
232  getArmarXManager()->removeObjectBlocking(resultProvider.first);
233  }
234  }
235 
237  {
238  ARMARX_INFO << "Starting PointCloud Processor";
239 
240  // main loop of component
241  while (!processorTask->isStopped())
242  {
243  // call process method of sub class
244  process();
245 
246  if (frameRate > 0)
247  {
249  }
250  else
251  {
252  std::this_thread::sleep_for(std::chrono::milliseconds(1));
253  }
254 
255  }
256 
257  ARMARX_INFO << "Stopping PointCloud Processor";
258  }
259 
260 
261  void PointCloudProcessor::usingPointCloudProvider(std::string providerName)
262  {
263  std::unique_lock lock(pointCloudProviderInfoMutex);
264 
265  // use PointCloud event topic
266  usingTopic(providerName + ".PointCloudListener");
267 
268  // create shared memory consumer
270  new IceSharedMemoryConsumer<unsigned char, MetaPointCloudFormat>(this, providerName, "PointCloudProvider");
271 
272  usedPointCloudProviders.emplace(providerName, consumer);
273  }
274 
275  void PointCloudProcessor::releasePointCloudProvider(std::string providerName)
276  {
277  std::unique_lock lock(pointCloudProviderInfoMutex);
278 
279  if (usedPointCloudProviders.count(providerName))
280  {
281  usedPointCloudProviders.erase(providerName);
282  }
283 
284  {
285  if (pointCloudProviderInfoMap.count(providerName))
286  {
287  pointCloudProviderInfoMap.erase(providerName);
288  }
289  }
290 
291  // Following calls take care of existence of argument themself, no need to check.
292  // If they return false, we can still be sure the dependency is removed and the
293  // topic unsubscribed.
294 
295  // Unsubscribe topic
296  this->unsubscribeFromTopic(providerName + ".PointCloudListener");
297 
298  // Remove proxy dependencies
299  this->removeProxyDependency(providerName);
300  std::string memoryName = providerName + "Memory" + "PointCloudProvider";
301  this->removeProxyDependency(memoryName);
302  }
303 
304  PointCloudProviderInfo PointCloudProcessor::getPointCloudProvider(std::string providerName, bool waitForProxy)
305  {
306  std::unique_lock lock(pointCloudProviderInfoMutex);
307 
308  if (pointCloudProviderInfoMap.count(providerName))
309  {
310  // return pointCloudProviderInfoMap[providerName];
311  ARMARX_INFO << "Point cloud provider already started: " << providerName;
312  }
313 
314  PointCloudProviderInfo providerInfo;
315 
316  // get proxy for PointCloud polling
317  ARMARX_DEBUG << "getProxy '" << providerName << "' waitForProxy = " << waitForProxy
318  << "\nproviders: " << getMapKeys(pointCloudProviderInfoMap);
319  providerInfo.proxy = getProxy<PointCloudProviderInterfacePrx>(providerName, waitForProxy);
320  ARMARX_DEBUG << "getProxy '" << providerName << "'...done!";
321  providerInfo.pointCloudFormat = providerInfo.proxy->getPointCloudFormat();
322 
323  providerInfo.pointCloudAvailableEvent.reset(new std::condition_variable);
324  providerInfo.pointCloudAvailable = false;
325 
326  size_t pointCloudBufferSize = static_cast<size_t>(providerInfo.pointCloudFormat->size);
327  providerInfo.buffer.resize(pointCloudBufferSize);
328 
329 
330  {
331  pointCloudProviderInfoMap.emplace(providerName, providerInfo);
332  }
333 
334 
335  std::unique_lock lock2(statisticsMutex);
336 
337  statistics[providerName].pollingFPS.reset();
338  statistics[providerName].pointCloudProviderFPS.reset();
339 
340  if (!providerInfo.proxy->hasSharedMemorySupport())
341  {
342  ARMARX_WARNING << "shared memory not available for provider " << providerName;
343  usedPointCloudProviders[providerName]->setTransferMode(eIce);
344  pointCloudProviderInfoMap[providerName].pointCloudTransferMode = eIceTransfer;
345  // pointCloudProviderInfoMap[providerName].info = new MetaInfoSizeBase(0, 0, TimeUtil::GetTime().toMicroSeconds());
346  removeProxyDependency(usedPointCloudProviders[providerName]->getMemoryName());
347  }
348  else
349  {
350  //////////////////////////
351  // start communication
352  //////////////////////////
353  usedPointCloudProviders[providerName]->start();
354  }
355 
356 
357  // usedPointCloudProviders[providerName]->start();
358 
359  return providerInfo;
360  }
361 
363  {
364  std::string providerName;
365  {
366  std::shared_lock lock(pointCloudProviderInfoMutex);
368  ARMARX_TRACE;
369  if (pointCloudProviderInfoMap.size() > 1)
370  {
371  ARMARX_ERROR << "Calling getPointCloudProvider without "
372  << "PointCloudProvider name but using multiple "
373  << "PointCloudProviders";
374  }
375  ARMARX_TRACE;
376  providerName = pointCloudProviderInfoMap.begin()->first;
377  }
378  return getPointCloudProvider(providerName, waitForProxy);
379  }
380 
381  std::vector<std::string> PointCloudProcessor::getPointCloudProviderNames() const
382  {
383  std::vector<std::string> names;
384  names.reserve(usedPointCloudProviders.size());
385  for (const auto& [name, _] : usedPointCloudProviders)
386  {
387  names.push_back(name);
388  }
389  return names;
390  }
391 
392  bool PointCloudProcessor::isPointCloudProviderKnown(const std::string& providerName) const
393  {
394  return usedPointCloudProviders.count(providerName) > 0;
395  }
396 
397 
398  void PointCloudProcessor::enableResultPointClouds(std::string resultProviderName, size_t shmCapacity, PointContentType pointContentType)
399  {
400  if (resultProviderName == "")
401  {
402  resultProviderName = getName() + "Result";
403  }
404 
405  std::unique_lock lock(resultProviderMutex);
406 
407  if (resultPointCloudProviders.count(resultProviderName))
408  {
409  ARMARX_WARNING << "result point cloud provider already exists: " << resultProviderName;
410  }
411  else
412  {
413  IceInternal::Handle<ResultPointCloudProvider> resultProvider = Component::create<ResultPointCloudProvider>();
414  resultProvider->setName(resultProviderName);
415  resultProvider->setShmCapacity(shmCapacity);
416  resultProvider->setPointContentType(pointContentType);
417 
418  getArmarXManager()->addObject(resultProvider);
419 
420  {
421  resultPointCloudProviders.emplace(resultProvider->getName(), resultProvider);
422  }
423 
424  lock.unlock();
425 
426  resultProvider->getObjectScheduler()->waitForObjectState(eManagedIceObjectStarted);
427 
428  }
429  }
430 
431 
432 
434  {
435  std::shared_lock lock(pointCloudProviderInfoMutex);
436 
437  ARMARX_TRACE;
438  if (pointCloudProviderInfoMap.size() > 1)
439  {
440  ARMARX_ERROR << "Calling waitForPointClouds without PointCloudProvider name but using multiple PointCloudProviders";
441  return false;
442  }
443 
444  ARMARX_TRACE;
445  const std::string& providerName = pointCloudProviderInfoMap.begin()->first;
446 
447  ARMARX_TRACE;
448  return waitForPointClouds(providerName, milliseconds);
449  }
450 
451  bool PointCloudProcessor::waitForPointClouds(const std::string& providerName, int milliseconds)
452  {
453  std::shared_lock lock(pointCloudProviderInfoMutex);
454 
455  ARMARX_TRACE;
456  // find PointCloud provider by name
457  auto iter = pointCloudProviderInfoMap.find(providerName);
458  if (iter == pointCloudProviderInfoMap.end())
459  {
461  << "Trying to wait for PointClouds from unknown PointCloud provider '"
462  << providerName << "'. Call usingPointCloudProvider before."
463  << "\nKnown providers: " << getPointCloudProviderNames();
464  return false;
465  }
466 
467  if (iter->second.pointCloudAvailable)
468  {
469  return true;
470  }
471  ARMARX_TRACE;
472 
473  auto cond = iter->second.pointCloudAvailableEvent;
474 
475  lock.unlock();
476 
477  // wait for conditionale
478  std::mutex mut;
479  std::unique_lock lock2(mut);
480  auto td = std::chrono::milliseconds(milliseconds);
481 
482 
483  return cond->wait_for(lock2, td) != std::cv_status::timeout;
484  }
485 
486  bool PointCloudProcessor::pointCloudHasNewData(std::string providerName)
487  {
488  std::shared_lock lock(pointCloudProviderInfoMutex);
489 
490  // find PointCloud provider by name
491  auto iter = pointCloudProviderInfoMap.find(providerName);
492  if (iter == pointCloudProviderInfoMap.end())
493  {
495  << "Asked for new point cloud data for unknown PointCloud provider '"
496  << providerName << "'. Call usingPointCloudProvider() beforehand."
497  << "\nKnown providers: " << getPointCloudProviderNames();
498 
499  return false;
500  }
501 
502  return iter->second.pointCloudAvailable;
503  }
504 
505 
506  MetaPointCloudFormatPtr PointCloudProcessor::getPointCloudFormat(std::string providerName)
507  {
508  std::shared_lock lock(pointCloudProviderInfoMutex);
509 
510  MetaPointCloudFormatPtr format;
511 
512  // find PointCloud provider
513  auto iter = pointCloudProviderInfoMap.find(providerName);
514  if (iter == pointCloudProviderInfoMap.end())
515  {
517  << "Trying to wait for PointClouds from unknown PointCloud provider '"
518  << providerName << "'. Call usingPointCloudProvider before."
519  << "\nKnown providers: " << getPointCloudProviderNames();
520  }
521  else
522  {
523  format = iter->second.proxy->getPointCloudFormat();
524  }
525 
526  return format;
527  }
528 
529 
531  {
532  std::unique_lock lock(statisticsMutex);
533 
534  auto iter = statistics.find(providerName);
535  if (iter == statistics.end())
536  {
537  ARMARX_ERROR << "Requesting statistics for unknown PointCloud provider '" << providerName << "'"
538  << "\nKnown providers: " << getPointCloudProviderNames();
539  return PointCloudTransferStats();
540  }
541 
542  PointCloudTransferStats stats = iter->second;
543 
544  if (resetStats)
545  {
546  iter->second.pointCloudProviderFPS.reset();
547  iter->second.pollingFPS.reset();
548  }
549  else
550  {
551  iter->second.pointCloudProviderFPS.recalculate();
552  iter->second.pollingFPS.recalculate();
553  }
554 
555  return stats;
556  }
557 
558 
559  std::string PointCloudProcessor::getPointCloudFrame(const std::string& providerName, const std::string& defaultFrame)
560  {
561  std::shared_lock lock(pointCloudProviderInfoMutex);
562 
563  auto find = pointCloudProviderInfoMap.find(providerName);
565  << "Requesting information about unknown point cloud provider ''" << providerName << "'."
566  << "\nKnown providers: " << getPointCloudProviderNames();
567 
568  const PointCloudProviderInfo& providerInfo = find->second;
569  auto frameProv = ReferenceFrameInterfacePrx::checkedCast(providerInfo.proxy);
570 
571  return frameProv ? frameProv->getReferenceFrame() : defaultFrame;
572  }
573 
574 
575  void PointCloudProcessor::reportPointCloudAvailable(const std::string& providerName, const Ice::Current&)
576  {
577  std::shared_lock lock(pointCloudProviderInfoMutex);
578 
579  // find provider
580  std::map<std::string, PointCloudProviderInfo>::iterator iter = pointCloudProviderInfoMap.find(providerName);
581 
582  if (iter == pointCloudProviderInfoMap.end())
583  {
584  ARMARX_ERROR << "Received notification from unknown point cloud provider '" << providerName << "'."
585  << "\nKnown providers: " << getPointCloudProviderNames();
586  return;
587  }
588 
589  iter->second.pointCloudAvailable = true;
590  iter->second.pointCloudAvailableEvent->notify_all();
591 
592  // update statistics
593  std::unique_lock lock2(statisticsMutex);
594  statistics[providerName].pointCloudProviderFPS.update();
595  }
596 
597 }
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
armarx::MessageTypeT::ERROR
@ ERROR
visionx::PointCloudProcessor::pointCloudHasNewData
bool pointCloudHasNewData(std::string providerName)
Returns current status for the given point cloud.
Definition: PointCloudProcessor.cpp:486
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:180
ARMARX_CHECK_NOT_EQUAL
#define ARMARX_CHECK_NOT_EQUAL(lhs, rhs)
This macro evaluates whether lhs is inequal (!=) rhs and if it turns out to be false it will throw an...
Definition: ExpressionException.h:137
visionx::PointCloudProcessor::getPointCloudTransferStats
PointCloudTransferStats getPointCloudTransferStats(std::string providerName, bool resetStats=false)
Retrieve statistics for a connection to an PointCloudProvider.
Definition: PointCloudProcessor.cpp:530
armarx::MessageTypeT::WARN
@ WARN
armarx::MessageTypeT::FATAL
@ FATAL
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::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
ArmarXManager.h
armarx::MessageTypeT::INFO
@ INFO
armarx::MessageTypeT::VERBOSE
@ VERBOSE
visionx::ResultPointCloudProviderPropertyDefinitions
Definition: PointCloudProcessor.h:106
visionx::PointCloudProviderInfo::proxy
PointCloudProviderInterfacePrx proxy
Proxy to PointCloud provider.
Definition: PointCloudProcessor.h:87
armarx::Split
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
Definition: StringHelperTemplates.h:35
visionx::PointCloudProcessor::onConnectPointCloudProcessor
virtual void onConnectPointCloudProcessor()=0
Implement this method in the PointCloudProcessor in order execute parts when the component is fully i...
armarx::ManagedIceObject::getArmarXManager
ArmarXManagerPtr getArmarXManager() const
Returns the ArmarX manager used to add and remove components.
Definition: ManagedIceObject.cpp:348
armarx::MessageTypeT::IMPORTANT
@ IMPORTANT
trace.h
visionx::ResultPointCloudProvider::onInitPointCloudProvider
virtual void onInitPointCloudProvider() override
This is called when the Component::onInitComponent() is called.
Definition: PointCloudProcessor.cpp:88
armarx::ManagedIceObject::removeProxyDependency
bool removeProxyDependency(const std::string &name)
This function removes the dependency of this object on the in parameter name specified object.
Definition: ManagedIceObject.cpp:326
visionx::PointCloudProcessor::onDisconnectComponent
virtual void onDisconnectComponent() override
Definition: PointCloudProcessor.cpp:217
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
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.
armarx::PropertyUser::hasProperty
bool hasProperty(const std::string &name)
Definition: PropertyUser.cpp:243
visionx::PointCloudProcessor::processorTask
armarx::RunningTask< PointCloudProcessor >::pointer_type processorTask
Definition: PointCloudProcessor.h:621
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::PointCloudProcessor::onExitComponent
virtual void onExitComponent() override
Definition: PointCloudProcessor.cpp:223
armarx::RunningTask
Definition: ArmarXMultipleObjectsScheduler.h:35
visionx::PointCloudProviderInfo
Definition: PointCloudProcessor.h:83
cxxopts::empty
bool empty(const std::string &s)
Definition: cxxopts.hpp:255
IceInternal::Handle
Definition: forward_declarations.h:8
visionx::PointCloudProcessor::onExitPointCloudProcessor
virtual void onExitPointCloudProcessor()=0
Exit the ImapeProcessor component.
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
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::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::PointCloudProviderInfo::pointCloudFormat
MetaPointCloudFormatPtr pointCloudFormat
PointCloud format struct that contains all necessary PointCloud information.
Definition: PointCloudProcessor.h:93
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
ArmarXObjectScheduler.h
ARMARX_ERROR
#define ARMARX_ERROR
Definition: Logging.h:189
PointCloudProcessor.h
visionx::ResultPointCloudProvider::createPropertyDefinitions
virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: PointCloudProcessor.cpp:105
armarx::ManagedIceObject::unsubscribeFromTopic
bool unsubscribeFromTopic(const std::string &name)
Unsubscribe from a topic.
Definition: ManagedIceObject.cpp:271
visionx::PointCloudProviderInfo::pointCloudAvailableEvent
std::shared_ptr< std::condition_variable > pointCloudAvailableEvent
Conditional variable used internally for synchronization purposes.
Definition: PointCloudProcessor.h:102
visionx::PointCloudProcessor::frameRate
float frameRate
Definition: PointCloudProcessor.h:624
armarx::ManagedIceObject::getDefaultName
virtual std::string getDefaultName() const =0
Retrieve default name of component.
ExpressionException.h
armarx::ManagedIceObject::usingTopic
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
Definition: ManagedIceObject.cpp:248
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:74
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::onConnectComponent
virtual void onConnectComponent() override
Definition: PointCloudProcessor.cpp:201
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
armarx::viz::data::ElementFlags::names
const simox::meta::IntEnumNames names
Definition: json_elements.cpp:14
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::FPSCounter::assureFPS
void assureFPS(float fFrameRate)
Synchronize to FPS.
Definition: FPSCounter.cpp:82
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:174
armarx::PropertyUser::getProperty
Property< PropertyType > getProperty(const std::string &name)
Property creation and retrieval.
Definition: PropertyUser.h:179
VAROUT
#define VAROUT(x)
Definition: StringHelpers.h:182
armarx::armem::laser_scans::constants::memoryName
const std::string memoryName
Definition: constants.h:28
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
armarx::MessageTypeT::DEBUG
@ DEBUG
visionx::ResultPointCloudProvider::setShmCapacity
void setShmCapacity(size_t shmCapacity)
Definition: PointCloudProcessor.cpp:68
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:916
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
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
armarx::IceSharedMemoryConsumer
Definition: IceSharedMemoryConsumer.h:50
visionx::PointCloudProcessor::getPointCloudProvider
PointCloudProviderInfo getPointCloudProvider(std::string name, bool waitForProxy=false)
Select an PointCloudProvider.
Definition: PointCloudProcessor.cpp:304
armarx::ManagedIceObject::getName
std::string getName() const
Retrieve name of object.
Definition: ManagedIceObject.cpp:107
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
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:34
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
armarx::getMapKeys
void getMapKeys(const MapType &map, OutputIteratorType it)
Definition: algorithm.h:157
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
visionx::PointCloudProcessor::resultProviderMutex
std::shared_mutex resultProviderMutex
Definition: PointCloudProcessor.h:615
Exception.h
visionx::PointCloudProcessor::runProcessor
virtual void runProcessor()
Definition: PointCloudProcessor.cpp:236
visionx::PointCloudProcessor::resultPointCloudProviders
std::map< std::string, IceInternal::Handle< ResultPointCloudProvider > > resultPointCloudProviders
Definition: PointCloudProcessor.h:614
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