OpenNIPointCloudProvider.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::ArmarXObjects::OpenNIPointCloudProvider
19 * @author David Schiebener (schiebener at kit dot edu)
20 * @date 2015
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
26
28
29#include <pcl/io/openni2/openni2_device_manager.h>
30#include <pcl/io/pcd_io.h>
31
34
37
38#include <Calibration/Calibration.h>
39#include <Image/ImageProcessor.h>
40
41
42using namespace armarx;
43using namespace pcl;
44using namespace cv;
45
46#if PCL_VERSION > PCL_VERSION_CALC(1, 12, 0)
47template <typename T>
48using FctT = std::function<T>;
49#else
50template <typename T>
51using FctT = boost::function<T>;
52#endif
53
54namespace visionx
55{
56 void
68
69 void
71 {
73 ARMARX_VERBOSE << "onConnectComponent()";
74
75 getTopicFromProperty(debugObserver, "DebugObserverName");
76 getTopicFromProperty(robotHealthTopic, "RobotHealthTopicName");
77
80 }
81
82 void
91
92 void
94 {
96 ARMARX_VERBOSE << "onExitComponent()";
97
100 ARMARX_INFO << "Resetting grabber interface";
101 grabberInterface.reset();
102 }
103
104 bool
105 OpenNIPointCloudProvider::loadCalibrationFile(std::string fileName,
106 visionx::CameraParameters& calibration)
107 {
109 ArmarXDataPath::getAbsolutePath(fileName, fileName);
110 FileStorage fs(fileName, FileStorage::READ);
111
112 if (!fs.isOpened())
113 {
114 ARMARX_WARNING << "unable to read calibration file " << fileName;
115 return false;
116 }
117
118 std::string cameraName = fs["camera_name"];
119 ARMARX_LOG << "loading calibration file for " << cameraName;
120
121
122 Eigen::Vector2i dimensions = getProperty<Eigen::Vector2i>("dimensions").getValue();
123 int imageWidth = fs["image_width"];
124 int imageHeight = fs["image_height"];
125
126 if (imageWidth != dimensions(0) || imageHeight != dimensions(1))
127 {
128 ARMARX_ERROR << "invalid camera size";
129 return false;
130 }
131
132 Mat cameraMatrix, distCoeffs;
133
134 fs["camera_matrix"] >> cameraMatrix;
135 fs["distortion_coefficients"] >> distCoeffs;
136
137 for (int i = 0; i < 5; i++)
138 {
139 calibration.distortion[i] = distCoeffs.at<float>(0, i);
140 }
141
142 calibration.focalLength[0] = cameraMatrix.at<float>(0, 0);
143 calibration.focalLength[1] = cameraMatrix.at<float>(1, 1);
144
145 calibration.principalPoint[0] = cameraMatrix.at<float>(0, 2);
146 calibration.principalPoint[1] = cameraMatrix.at<float>(1, 2);
147
148 return true;
149 }
150
151 void
153 {
155 ARMARX_VERBOSE << "onInitCapturingPointCloudProvider()";
156
157
158 Eigen::Vector2i dimensions = getProperty<Eigen::Vector2i>("dimensions").getValue();
159
160 width = dimensions(0);
161 height = dimensions(1);
162
163 newPointCloudCapturingRequested = true;
164 newImageCapturingRequested = true;
165
166 ARMARX_VERBOSE << "creating OpenNI2Grabber " << width << "x" << height << "@" << frameRate
167 << " fps";
168 std::string configuredDeviceId = getProperty<std::string>("OpenNIDeviceId").getValue();
169 using namespace pcl::io::openni2;
170 auto connectedDeviceURIs = *OpenNI2DeviceManager::getInstance()->getConnectedDeviceURIs();
171 ARMARX_INFO << "connected devices: " << connectedDeviceURIs;
172 if (!configuredDeviceId.empty() && configuredDeviceId.size() > 2)
173 {
175 size_t i = 1;
176 std::string deviceIndexNumber;
177 ARMARX_INFO << "Trying to find device with configured URI: '" << configuredDeviceId
178 << "'";
179 for (auto& uri : connectedDeviceURIs)
180 {
181 if (uri == configuredDeviceId)
182 {
183 ARMARX_INFO << "Found device with URI " << configuredDeviceId << " at index "
184 << i;
185 deviceIndexNumber = "#" + std::to_string(i);
186 break;
187 }
188 i++;
189 }
190 if (deviceIndexNumber.empty())
191 {
192 ARMARX_WARNING << "Could not find device with URI: " << configuredDeviceId
193 << " - Connecting now to any device";
194 grabberInterface.reset(new pcl::io::OpenNI2Grabber());
195 }
196 else
197 {
198 grabberInterface.reset(new pcl::io::OpenNI2Grabber(deviceIndexNumber));
199 }
200 }
201 else if (!configuredDeviceId.empty())
202 {
204 ARMARX_INFO << "Connecting to device id " << configuredDeviceId;
205 grabberInterface.reset(new pcl::io::OpenNI2Grabber("#" + configuredDeviceId));
206 }
207 else
208 {
210 grabberInterface.reset(new pcl::io::OpenNI2Grabber());
211 }
213
214 visionx::CameraParameters RGBCameraIntrinsics;
215 RGBCameraIntrinsics.focalLength.resize(2, 0.0f);
216 RGBCameraIntrinsics.principalPoint.resize(2, 0.0f);
217 RGBCameraIntrinsics.distortion.resize(4, 0.0f);
218
219 //Eigen::Matrix3f id = Eigen::Matrix3f::Identity();
220 RGBCameraIntrinsics.rotation =
221 visionx::tools::convertEigenMatToVisionX(Eigen::Matrix3f::Identity());
222 RGBCameraIntrinsics.translation =
223 visionx::tools::convertEigenVecToVisionX(Eigen::Vector3f::Zero());
224
226 std::string rgbCameraCalibrationFile =
227 getProperty<std::string>("RGBCameraCalibrationFile").getValue();
228 if (!rgbCameraCalibrationFile.empty() &&
229 loadCalibrationFile(rgbCameraCalibrationFile, RGBCameraIntrinsics))
230 {
232 grabberInterface->setRGBCameraIntrinsics(RGBCameraIntrinsics.focalLength[0],
233 RGBCameraIntrinsics.focalLength[1],
234 RGBCameraIntrinsics.principalPoint[0],
235 RGBCameraIntrinsics.principalPoint[1]);
236 }
237 else
238 {
240 ARMARX_INFO << "unable to load calibration file. using default values.";
241 double fx, fy, cx, cy;
242 grabberInterface->getRGBCameraIntrinsics(fx, fy, cx, cy);
243
244 if (std::isnan(fx))
245 {
246 if (grabberInterface->getDevice()->hasColorSensor())
247 {
248 fx = fy = grabberInterface->getDevice()->getColorFocalLength();
249 }
250
251 cx = (width - 1) / 2.0;
252 cy = (height - 1) / 2.0;
253 }
254 ARMARX_INFO << "rgb camera fx: " << fx << " fy: " << fy << " cx: " << cx
255 << " cy: " << cy;
256
257 RGBCameraIntrinsics.principalPoint[0] = cx;
258 RGBCameraIntrinsics.principalPoint[1] = cy;
259 RGBCameraIntrinsics.focalLength[0] = fx;
260 RGBCameraIntrinsics.focalLength[1] = fy;
261 RGBCameraIntrinsics.width = width;
262 RGBCameraIntrinsics.height = height;
263 }
264
265 visionx::CameraParameters depthCameraIntrinsics;
266 depthCameraIntrinsics.focalLength.resize(2, 0.0f);
267 depthCameraIntrinsics.principalPoint.resize(2, 0.0f);
268 depthCameraIntrinsics.distortion.resize(4, 0.0f);
269 depthCameraIntrinsics.rotation =
270 visionx::tools::convertEigenMatToVisionX(Eigen::Matrix3f::Identity());
271 depthCameraIntrinsics.translation =
272 visionx::tools::convertEigenVecToVisionX(Eigen::Vector3f::Zero());
273
274 std::string depthCameraCalibrationFile =
275 getProperty<std::string>("depthCameraCalibrationFile").getValue();
276 if (!depthCameraCalibrationFile.empty() &&
277 loadCalibrationFile(depthCameraCalibrationFile, depthCameraIntrinsics))
278 {
280 grabberInterface->setDepthCameraIntrinsics(depthCameraIntrinsics.focalLength[0],
281 depthCameraIntrinsics.focalLength[1],
282 depthCameraIntrinsics.principalPoint[0],
283 depthCameraIntrinsics.principalPoint[1]);
284 }
285 else
286 {
288 ARMARX_INFO << "unable to load calibration file. using default values.";
289 double fx, fy, cx, cy;
290 grabberInterface->getDepthCameraIntrinsics(fx, fy, cx, cy);
291
292 if (std::isnan(fx))
293 {
294 if (grabberInterface->getDevice()->hasDepthSensor())
295 {
296 fx = fy = grabberInterface->getDevice()->getDepthFocalLength();
297 }
298 cx = (width - 1) / 2.0;
299 cy = (height - 1) / 2.0;
300 }
301 ARMARX_INFO << "depth camera fx: " << fx << " fy: " << fy << " cx: " << cx
302 << " cy: " << cy;
303
304 depthCameraIntrinsics.principalPoint[0] = cx;
305 depthCameraIntrinsics.principalPoint[1] = cy;
306 depthCameraIntrinsics.focalLength[0] = fx;
307 depthCameraIntrinsics.focalLength[1] = fy;
308 depthCameraIntrinsics.width = width;
309 depthCameraIntrinsics.height = height;
310 }
311
313
314 calibration.calibrationLeft = visionx::tools::createDefaultMonocularCalibration();
315 calibration.calibrationRight = visionx::tools::createDefaultMonocularCalibration();
316 calibration.calibrationLeft.cameraParam = RGBCameraIntrinsics;
317 calibration.calibrationRight.cameraParam = depthCameraIntrinsics;
318 calibration.rectificationHomographyLeft =
319 visionx::tools::convertEigenMatToVisionX(Eigen::Matrix3f::Zero());
320 calibration.rectificationHomographyRight =
321 visionx::tools::convertEigenMatToVisionX(Eigen::Matrix3f::Zero());
322
323 ARMARX_INFO << "Baseline:" << grabberInterface->getDevice()->getBaseline();
324
325 pointcloudBuffer = pcl::PointCloud<pcl::PointXYZRGBA>::Ptr(
326 new pcl::PointCloud<pcl::PointXYZRGBA>(width, height));
327
328 rgbImages = new CByteImage*[2];
329
330 rgbImages[0] = new CByteImage(width, height, CByteImage::eRGB24);
331 rgbImages[1] = new CByteImage(width, height, CByteImage::eRGB24);
332 ::ImageProcessor::Zero(rgbImages[0]);
333 ::ImageProcessor::Zero(rgbImages[1]);
334
335 if (grabberInterface->getDevice()->hasColorSensor())
336 {
337 FctT<void(const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr&)> pointCloudCallback =
338 [this](auto&& PH1)
339 {
340 callbackFunctionForOpenNIGrabberPointCloudWithRGB(std::forward<decltype(PH1)>(PH1));
341 };
342 grabberInterface->registerCallback(pointCloudCallback);
343
344 FctT<void(const pcl::io::Image::Ptr&, const pcl::io::DepthImage::Ptr&, float)>
345 imageCallback = [this](auto&& PH1, auto&& PH2, auto&& PH3)
346 {
347 grabImages(std::forward<decltype(PH1)>(PH1),
348 std::forward<decltype(PH2)>(PH2),
349 std::forward<decltype(PH3)>(PH3));
350 };
351 grabberInterface->registerCallback(imageCallback);
352 }
353 else
354 {
355 ARMARX_INFO << "depth sensor. no color image available.";
356
357 FctT<void(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr&)> pointCloudCallback =
358 [this](auto&& PH1)
359 { callbackFunctionForOpenNIGrabberPointCloud(std::forward<decltype(PH1)>(PH1)); };
360 grabberInterface->registerCallback(pointCloudCallback);
361
362 FctT<void(const pcl::io::IRImage::Ptr&, const pcl::io::DepthImage::Ptr&, float)>
363 imageCallback = [this](auto&& PH1, auto&& PH2, auto&& PH3)
364 {
365 grabDepthImage(std::forward<decltype(PH1)>(PH1),
366 std::forward<decltype(PH2)>(PH2),
367 std::forward<decltype(PH3)>(PH3));
368 };
369 grabberInterface->registerCallback(imageCallback);
370 }
371 }
372
373 void
375 {
376 ARMARX_CHECK_NOT_NULL(heartbeatPlugin);
377 heartbeatPlugin->signUp(armarx::Duration::MilliSeconds(500),
379 {"Vision", "Camera"},
380 "OpenNIPointCloudProvider");
381 }
382
383 void
385 {
386 ARMARX_INFO << "Openni grabber interface name: " << grabberInterface->getName();
387 ARMARX_INFO << "Openni device interface name: " << grabberInterface->getDevice()->getName()
388 << " id: " << grabberInterface->getDevice()->getStringID();
389
390
391 grabberInterface->getDevice()->setAutoExposure(
392 getProperty<bool>("EnableAutoExposure").getValue());
393 grabberInterface->getDevice()->setAutoWhiteBalance(
394 getProperty<bool>("EnableAutoWhiteBalance").getValue());
395
396 grabberInterface->start();
397
398 lastReportTimestamp = TimeUtil::GetTime();
399 }
400
401 void
403 {
405 ARMARX_INFO << "Stopping OpenNI Grabber Interface";
406 if (grabberInterface)
407 {
408 grabberInterface->stop();
409 }
410 ARMARX_INFO << "Stopped OpenNI Grabber Interface";
411
412 std::scoped_lock lock(syncMutex);
413
414 condition.notify_one();
415 }
416
417 void
419 {
421 ARMARX_VERBOSE << "onExitCapturingPointCloudProvider()";
422
423 delete rgbImages[0];
424 delete rgbImages[1];
425
426 delete[] rgbImages;
427 }
428
429 void
431 {
433 Eigen::Vector2i dimensions = getProperty<Eigen::Vector2i>("dimensions").getValue();
434 setImageFormat(visionx::ImageDimension(dimensions(0), dimensions(1)), visionx::eRgb);
436 }
437
438 StereoCalibration
440 {
441 return calibration;
442 }
443
444 void
445 OpenNIPointCloudProvider::callbackFunctionForOpenNIGrabberPointCloudWithRGB(
446 const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr& newCloud)
447 {
449 ARMARX_INFO << deactivateSpam(1e10) << "got first pointcloud";
450 if (newPointCloudCapturingRequested)
451 {
452 long offset = getProperty<float>("CaptureTimeOffset").getValue() * 1000.0f;
453 timeOfLastPointCloudCapture = IceUtil::Time::now().toMicroSeconds() - offset;
454 pcl::copyPointCloud(*newCloud, *pointcloudBuffer);
455 std::scoped_lock lock(syncMutex);
456 auto size = newCloud->size();
457 pointcloudBuffer->resize(size);
458 float scaling = 1000.f;
459 for (size_t i = 0; i < size; i++)
460 {
461 pointcloudBuffer->at(i).x = newCloud->at(i).x * scaling;
462 pointcloudBuffer->at(i).y = newCloud->at(i).y * scaling;
463 pointcloudBuffer->at(i).z = newCloud->at(i).z * scaling;
464 }
465
466 newPointCloudCapturingRequested = false;
467
468 condition.notify_one();
469 }
470 }
471
472 void
473 OpenNIPointCloudProvider::callbackFunctionForOpenNIGrabberPointCloud(
474 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& newCloud)
475 {
477 ARMARX_INFO << deactivateSpam(1e10) << "got first pointcloud";
478
479 if (newPointCloudCapturingRequested)
480 {
481
482 long offset = getProperty<float>("CaptureTimeOffset").getValue() * 1000.0f;
483 timeOfLastPointCloudCapture = IceUtil::Time::now().toMicroSeconds() - offset;
484 Eigen::Affine3f transform(Eigen::Scaling(1000.0f));
485
486 std::scoped_lock lock(syncMutex);
487 pcl::copyPointCloud(*newCloud, *pointcloudBuffer);
488 pcl::transformPointCloud(*pointcloudBuffer, *pointcloudBuffer, transform);
489
490
491 newPointCloudCapturingRequested = false;
492
493 condition.notify_one();
494 }
495 }
496
497 void
498 OpenNIPointCloudProvider::grabDepthImage(const pcl::io::IRImage::Ptr& IRImage,
499 const pcl::io::DepthImage::Ptr& depthImage,
500 float x)
501 {
503 ARMARX_INFO << deactivateSpam(1e10) << "got first depthImage";
504
505 if (newImageCapturingRequested)
506 {
507 long offset = getProperty<float>("CaptureTimeOffset").getValue() * 1000.0f;
508 timeOfLastImageCapture = IceUtil::Time::now().toMicroSeconds() - offset;
509 cv::Mat depthBuffer(height, width, CV_16UC1);
510 depthImage->fillDepthImageRaw(width, height, (unsigned short*)depthBuffer.data);
511
512 std::scoped_lock lock(syncMutex);
513
514 // boost::chrono::high_resolution_clock::time_point timestamp = depthImage->getSystemTimestamp(); <-- wrong timestamp!
515
516 for (int j = 0; j < depthBuffer.rows; j++)
517 {
518 int index = 3 * (j * width);
519 for (int i = 0; i < depthBuffer.cols; i++)
520 {
521 unsigned short value = depthBuffer.at<unsigned short>(j, i);
523 rgbImages[1]->pixels[index + 0],
524 rgbImages[1]->pixels[index + 1],
525 rgbImages[1]->pixels[index + 2],
526 false);
527 // rgbImages[1]->pixels[3 * (j * width + i) + 0] = value & 0xFF;
528 // rgbImages[1]->pixels[3 * (j * width + i) + 1] = (value >> 8) & 0xFF;
529 index += 3;
530 }
531 }
532
533
534 newImageCapturingRequested = false;
535
536 condition.notify_one();
537 }
538 }
539
540 void
541 OpenNIPointCloudProvider::grabImages(const pcl::io::Image::Ptr& RGBImage,
542 const pcl::io::DepthImage::Ptr& depthImage,
543 float reciprocalFocalLength)
544 {
546 ARMARX_INFO << deactivateSpam(1e10) << "got first image";
547
548 if (newImageCapturingRequested)
549 {
550 long offset = getProperty<float>("CaptureTimeOffset").getValue() * 1000.0f;
551 timeOfLastImageCapture = IceUtil::Time::now().toMicroSeconds() - offset;
552
553 cv::Mat depthBuffer(height, width, CV_16UC1);
554 depthImage->fillDepthImageRaw(width, height, (unsigned short*)depthBuffer.data);
555
556 std::scoped_lock lock(syncMutex);
557
558 // boost::chrono::high_resolution_clock::time_point timestamp = depthImage->getSystemTimestamp(); <-- wrong timestamp!
559
560
561 for (int j = 0; j < depthBuffer.rows; j++)
562 {
563 int index = 3 * (j * width);
564 for (int i = 0; i < depthBuffer.cols; i++)
565 {
566 unsigned short value = depthBuffer.at<unsigned short>(j, i);
568 rgbImages[1]->pixels[index + 0],
569 rgbImages[1]->pixels[index + 1],
570 rgbImages[1]->pixels[index + 2],
571 false);
572 // rgbImages[1]->pixels[3 * (j * width + i) + 0] = value & 0xFF;
573 // rgbImages[1]->pixels[3 * (j * width + i) + 1] = (value >> 8) & 0xFF;
574 index += 3;
575 }
576 }
577
578 /*
579
580
581 cv::Mat depthBuffer = cv::Mat(height, width, CV_32FC1);
582 depthImage->fillDisparityImage(width, height, (float*) depthBuffer.data);
583 boost::mutex::scoped_lock lock(captureMutex);
584
585 calibration.calibrationRight.cameraParam.translation[0] = depthImage->getBaseline();
586
587 for (int j = 0; j < depthBuffer.rows; j++)
588 {
589 for (int i = 0; i < depthBuffer.cols; i++)
590 {
591 int value = static_cast<int>(depthBuffer.at<float>(j, i));
592 rgbImages[1]->pixels[3 * (j * width + i) + 0] = value & 0xFF;
593 rgbImages[1]->pixels[3 * (j * width + i) + 1] = (value >> 8) & 0xFF;
594 rgbImages[1]->pixels[3 * (j * width + i) + 2] = (value >> 16) & 0xFF;
595 }
596 } for (int j = 0; j < depthBuffer.rows; j++)
597 {
598 for (int i = 0; i < depthBuffer.cols; i++)
599 {
600 unsigned short value = depthBuffer.at<unsigned short>(j, i);
601
602 rgbImages[1]->pixels[3 * (j * width + i) + 0] = value & 0xFF;
603 rgbImages[1]->pixels[3 * (j * width + i) + 1] = (value >> 8) & 0xFF;
604 }
605 }
606
607 */
608
609 RGBImage->fillRGB(width, height, rgbImages[0]->pixels);
610
611 newImageCapturingRequested = false;
612
613 condition.notify_one();
614 }
615 }
616
617 bool
619 {
621 std::unique_lock lock(syncMutex);
622
623 newPointCloudCapturingRequested = true;
624 newImageCapturingRequested = true;
625
626 while (captureEnabled && (newPointCloudCapturingRequested || newImageCapturingRequested))
627 {
628 // condition.wait(lock);
629 condition.wait_for(lock, std::chrono::milliseconds(100));
630 }
631
632 if (!captureEnabled)
633 {
634 return false;
635 }
636
637 // provide images
638 provideImages(rgbImages, IceUtil::Time::microSeconds(timeOfLastImageCapture));
639 // provide pointclpoud
640 pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloud(
641 new pcl::PointCloud<PointXYZRGBA>(*pointcloudBuffer));
642 // pointcloud->header.stamp = pointcloudBuffer->header.stamp; <<- wrong timestamp!
643 pointcloud->header.stamp = timeOfLastPointCloudCapture;
644 providePointCloud(pointcloud);
645
646 heartbeatPlugin->heartbeat();
647
648 IceUtil::Time now = TimeUtil::GetTime();
649 IceUtil::Time reportTime = now - lastReportTimestamp;
650
651 StringVariantBaseMap durations;
652 durations["report_time_ms"] = new armarx::Variant(reportTime.toMilliSecondsDouble());
653 debugObserver->setDebugChannel(getName(), durations);
654
655
656 lastReportTimestamp = now;
657
658 return true;
659 }
660
661 std::vector<imrec::ChannelPreferences>
663 {
665
666 imrec::ChannelPreferences rgb;
667 rgb.requiresLossless = false;
668 rgb.name = "rgb";
669
670 imrec::ChannelPreferences depth;
671 depth.requiresLossless = true;
672 depth.name = "depth";
673
674 return {rgb, depth};
675 }
676
683
688
689std::string
691{
692 return "OpenNIPointCloudProvider";
693}
694
695std::string
700
701
703} // namespace visionx
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
Definition Decoupled.h:29
uint8_t index
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition Logging.cpp:75
boost::function< T > FctT
static bool getAbsolutePath(const std::string &relativeFilename, std::string &storeAbsoluteFilename, const std::vector< std::string > &additionalSearchPaths={}, bool verbose=true)
TopicProxyType getTopicFromProperty(const std::string &propertyName)
Get a topic proxy whose name is specified by the given property.
Definition Component.h:221
void offeringTopicFromProperty(const std::string &propertyName)
Offer a topic whose name is specified by the given property.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
Property< PropertyType > getProperty(const std::string &name)
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:48
virtual void onExitComponent()
Hook for subclass.
virtual void onDisconnectComponent()
Hook for subclass.
PluginT * addPlugin(const std::string prefix="", ParamsT &&... params)
virtual void onConnectComponent()=0
Pure virtual hook for the subclass.
std::string getName() const
Retrieve name of object.
virtual void onInitComponent()=0
Pure virtual hook for the subclass.
static IceUtil::Time GetTime(TimeMode timeMode=TimeMode::VirtualTime)
Get the current time.
Definition TimeUtil.cpp:42
The Variant class is described here: Variants.
Definition Variant.h:224
std::atomic_bool captureEnabled
Indicates that capturing is enabled and running.
void onInitComponent() override
void onDisconnectComponent() override
Hook for subclass.
void setImageFormat(ImageDimension imageDimension, ImageType imageType, BayerPatternType bayerPatternType=visionx::eBayerPatternRg)
Sets the image basic format data.
void provideImages(void **inputBuffers, const IceUtil::Time &imageTimestamp=IceUtil::Time())
send images raw.
void onConnectComponent() override
void setNumberImages(int numberImages)
Sets the number of images on each capture.
void onExitComponent() override
void onInitComponent() override
Pure virtual hook for the subclass.
void onDisconnectComponent() override
Hook for subclass.
void onStartCapture(float frameRate) override
void onConnectComponent() override
Pure virtual hook for the subclass.
StereoCalibration getStereoCalibration(const Ice::Current &c=Ice::emptyCurrent) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
std::vector< imrec::ChannelPreferences > getImageRecordingChannelPreferences(const Ice::Current &) override
void onExitComponent() override
Hook for subclass.
std::string getDefaultName() const override
Retrieve default name of component.
void providePointCloud(PointCloudPtrT pointCloudPtr)
offer the new point cloud.
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:196
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
Definition Logging.h:193
#define ARMARX_LOG
Definition Logging.h:165
#define ARMARX_VERBOSE
The logging level for verbose information.
Definition Logging.h:187
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::map< std::string, VariantBasePtr > StringVariantBaseMap
auto transform(const Container< InputT, Alloc > &in, OutputT(*func)(InputT const &)) -> Container< OutputT, typename std::allocator_traits< Alloc >::template rebind_alloc< OutputT > >
Convenience function (with less typing) to transform a container of type InputT into the same contain...
Definition algorithm.h:351
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition helper.h:35
std::shared_ptr< Value > value()
Definition cxxopts.hpp:855
void depthValueToRGB(unsigned int depthInMM, unsigned char &r, unsigned char &g, unsigned char &b, bool noiseResistant=false)
Definition ImageUtil.h:183
visionx::types::Vec convertEigenVecToVisionX(Eigen::VectorXf v)
visionx::types::Mat convertEigenMatToVisionX(Eigen::MatrixXf m)
MonocularCalibration createDefaultMonocularCalibration()
Creates a MonocularCalibration with all parameters set to a neutral value.
ArmarX headers.
#define ARMARX_TRACE
Definition trace.h:77