37 armarx::Blob PointCloudProvider::getPointCloud(MetaPointCloudFormatPtr& info,
const Ice::Current&
c)
39 MetaInfoSizeBasePtr infoBase;
40 armarx::Blob result = sharedMemoryProvider->getData(infoBase);
42 info = MetaPointCloudFormatPtr::dynamicCast(infoBase);
46 MetaPointCloudFormatPtr PointCloudProvider::getPointCloudFormat(
const Ice::Current&
c)
50 return sharedMemoryProvider->getMetaInfo();
59 void PointCloudProvider::onInitComponent()
66 onInitPointCloudProvider();
68 MetaPointCloudFormatPtr info = getDefaultPointCloudFormat();
69 intermediateBuffer.resize(info->capacity);
73 offeringTopic(getName() +
".PointCloudListener");
77 void PointCloudProvider::onConnectComponent()
80 pointCloudProcessorProxy = getTopic<PointCloudProcessorInterfacePrx>(getName() +
".PointCloudListener");
82 if (!sharedMemoryProvider)
85 ARMARX_INFO <<
"Shared memory provider is null: Recreating it";
86 MetaPointCloudFormatPtr info = getDefaultPointCloudFormat();
89 sharedMemoryProvider->start();
91 onConnectPointCloudProvider();
95 void PointCloudProvider::onDisconnectComponent()
98 if (sharedMemoryProvider)
100 sharedMemoryProvider->stop();
101 sharedMemoryProvider =
nullptr;
106 void PointCloudProvider::onExitComponent()
109 if (sharedMemoryProvider)
111 sharedMemoryProvider->stop();
112 sharedMemoryProvider =
nullptr;
115 onExitPointCloudProvider();
118 void PointCloudProvider::updateComponentMetaInfo(
const MetaPointCloudFormatPtr& info)
121 setMetaInfo(
"PointCloudTimestamp",
new armarx::Variant(IceUtil::Time::microSeconds(info->timeProvided).toDateTime()));
123 setMetaInfo(
"MaxCycleTimeMS",
new armarx::Variant(fps.getMaxCycleTimeMS()));
124 setMetaInfo(
"MeanCycleTimeMS",
new armarx::Variant(fps.getMeanCycleTimeMS()));
125 setMetaInfo(
"MinCycleTimeMS",
new armarx::Variant(fps.getMinCycleTimeMS()));
132 MetaPointCloudFormatPtr PointCloudProvider::getDefaultPointCloudFormat()
135 MetaPointCloudFormatPtr info =
new MetaPointCloudFormat();
137 info->type = PointContentType::eColoredPoints;
138 info->capacity = 640 * 480 *
sizeof(ColoredPoint3D);
139 info->size = info->capacity;