DepthImageProviderDynamicSimulation.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2013-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
19 * @author Raphael Grimm
20 * @date 2015
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
26
27#include <Eigen/Geometry>
28
29#include <pcl/common/transforms.h>
30#include <pcl/compression/organized_pointcloud_conversion.h>
31
32#include <SimoxUtility/math/convert/deg_to_rad.h>
33#include <VirtualRobot/Nodes/RobotNode.h>
34#include <VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.h>
35
38
41
42#include <Inventor/SoInteraction.h>
43#include <Inventor/actions/SoGLRenderAction.h>
44
45namespace armarx
46{
47
51 {
53 "FloatImageMode", false, "Whether to provide a CFloatImage or the standard CByteImage");
55 0.0f,
56 "Noise of the point cloud position results as standard "
57 "deviation of the normal distribution (in mm)")
58 .setMin(0);
59 defineOptionalProperty<float>("DistanceZNear",
60 20.0f,
61 "Distance of the near clipping plain. (If set too small "
62 "the agent's model's inside may be visible")
63 .setMin(1e-8);
65 "DistanceZFar",
66 5000.0f,
67 "Distance of the far clipping plain. (DistanceZFar-DistanceZNear should be "
68 "minimal, DistanceZFar > DistanceZNear)")
69 .setMin(1e-8);
71 "FieldOfView", 90, "Vertical field of view (FOV) in degrees.");
73 "BaseLine", 0.075, "The value returned from getBaseline(). It has no other effect.");
75 std::nan(""),
76 "Value of points that are farther away than DistanceZFar. "
77 "Most cameras return NaN here.");
78
80 "ImageSize",
81 visionx::ImageDimension(640, 480),
82 "Target resolution of the images. Captured images will be converted to this size.")
83 .setCaseInsensitive(true)
84 .map("200x200", visionx::ImageDimension(200, 200))
85 .map("320x240", visionx::ImageDimension(320, 240))
86 .map("640x480", visionx::ImageDimension(640, 480))
87 .map("800x600", visionx::ImageDimension(800, 600))
88 .map("768x576", visionx::ImageDimension(768, 576))
89 .map("1024x768", visionx::ImageDimension(1024, 768))
90 .map("1280x960", visionx::ImageDimension(1280, 960))
91 .map("1600x1200", visionx::ImageDimension(1600, 1200))
92 .map("1920x1080", visionx::ImageDimension(1920, 1080))
93 .map("none", visionx::ImageDimension(0, 0));
94 defineOptionalProperty<std::string>("RobotName", "Armar3", "The robot's name.");
96 "RobotNodeCamera", "DepthCameraSim", "The coordinate system of the used camera");
97
98 //used to draw the cloud to the simulator
100 "DrawPointCloud",
101 false,
102 "Whether the point cloud is drawn to the given DebugDrawerTopic");
103 defineOptionalProperty<std::string>("DrawPointCloud_DebugDrawerTopic",
104 "DebugDrawerUpdates",
105 "Name of the DebugDrawerTopic");
107 "DrawPointCloud_DrawDelay",
108 1000,
109 "The time between updates of the drawn point cloud (in ms)");
110 defineOptionalProperty<float>("DrawPointCloud_PointSize", 4, "The size of a point.");
112 "DrawPointCloud_PointSkip",
113 3,
114 "Only draw every n'th point in x and y direction (n=DrawPointCloud_PointSkip). "
115 "Increase this whenever the ice buffer size is to small to transmitt the cloud "
116 "size. (>0)");
117
119 "DrawPointCloud_ClipPoints",
120 true,
121 "Whether to clip the point cloud drawn to the given DebugDrawerTopic");
122
124 "DrawPointCloud_ClipXHi", 25000, "Skip points with x higher than this limit.");
126 "DrawPointCloud_ClipYHi", 25000, "Skip points with y higher than this limit.");
128 "DrawPointCloud_ClipZHi", 25000, "Skip points with z higher than this limit.");
129
131 "DrawPointCloud_ClipXLo", -25000, "Skip points with x lower than this limit.");
133 "DrawPointCloud_ClipYLo", -25000, "Skip points with y lower than this limit.");
135 "DrawPointCloud_ClipZLo", -25000, "Skip points with z lower than this limit.");
136 }
137
138 void
140 {
142 ARMARX_VERBOSE_S << "DepthImageProviderDynamicSimulation::onInitComponent";
143 baseline = getProperty<float>("BaseLine").getValue();
144 robotName = getProperty<std::string>("RobotName").getValue();
145 camNodeName = getProperty<std::string>("RobotNodeCamera").getValue();
146
147 zNear = getProperty<float>("DistanceZNear").getValue();
148 zFar = getProperty<float>("DistanceZFar").getValue();
149 vertFov = simox::math::deg_to_rad(getProperty<float>("FieldOfView").getValue());
150 nanValue = getProperty<float>("NanValue").getValue();
151
152 floatImageMode = getProperty<bool>("FloatImageMode").getValue();
153
154 drawPointCloud = getProperty<bool>("DrawPointCloud").getValue();
155 if (drawPointCloud)
156 {
157 lastUpdate = std::chrono::high_resolution_clock::now() -
158 std::chrono::seconds{pointCloudDrawDelay};
160 getProperty<std::string>("DrawPointCloud_DebugDrawerTopic").getValue();
162 pointCloudDrawDelay = getProperty<unsigned int>("DrawPointCloud_DrawDelay").getValue();
163 pointCloudPointSize = getProperty<float>("DrawPointCloud_PointSize").getValue();
164
165 pointSkip = getProperty<std::size_t>("DrawPointCloud_PointSkip").getValue();
166
167 clipDrawnCloudXLo = getProperty<float>("DrawPointCloud_ClipXLo").getValue();
168 clipDrawnCloudYLo = getProperty<float>("DrawPointCloud_ClipYLo").getValue();
169 clipDrawnCloudZLo = getProperty<float>("DrawPointCloud_ClipZLo").getValue();
170
171 clipDrawnCloudXHi = getProperty<float>("DrawPointCloud_ClipXHi").getValue();
172 clipDrawnCloudYHi = getProperty<float>("DrawPointCloud_ClipYHi").getValue();
173 clipDrawnCloudZHi = getProperty<float>("DrawPointCloud_ClipZHi").getValue();
174
175 clipPointCloud = getProperty<bool>("DrawPointCloud_ClipPoints").getValue();
176 }
177 noise = getProperty<float>("Noise").getValue();
178 if (noise > 0)
179 {
180 distribution = std::normal_distribution<double>(0, noise);
181 randValues.resize(1000, 0);
182 for (float& val : randValues)
183 {
184 val = distribution(generator);
185 }
186 }
187
188 ImageProvider::onInitComponent();
189 CapturingPointCloudProvider::onInitComponent();
190 ARMARX_VERBOSE_S << "done DepthImageProviderDynamicSimulation::onInitComponent";
191 }
192
193 void
195 {
197 ARMARX_VERBOSE_S << "DepthImageProviderDynamicSimulation::onConnectComponent";
198
199 if (drawPointCloud)
200 {
202 }
203
204 ImageProvider::onConnectComponent();
205 CapturingPointCloudProvider::onConnectComponent();
206 ARMARX_VERBOSE_S << "done DepthImageProviderDynamicSimulation::onConnectComponent";
207 }
208
209 void
211 {
212 ARMARX_VERBOSE_S << "DepthImageProviderDynamicSimulation::onExitComponent";
213 CapturingPointCloudProvider::onExitComponent();
214 ImageProvider::onExitComponent();
215 ARMARX_VERBOSE_S << "done DepthImageProviderDynamicSimulation::onExitComponent";
216 }
217
218 void
220 {
222 ARMARX_INFO << "DepthImageProviderDynamicSimulation::onStartCapture";
223 // ensure that all data is loaded
224 while (!simVisu || !simVisu->getRobot(robotName))
225 {
226 if (simVisu)
227 {
229 simVisu->synchronizeVisualizationData();
230 }
231 usleep(100000);
232 ARMARX_INFO << deactivateSpam(3) << "Waiting for visu";
233 }
234 syncVisu();
235 ARMARX_INFO << "Got visu";
236
238 std::unique_lock lock(captureMutex);
239 auto l = simVisu->getScopedLock();
240
241 // some checks...
243 offscreenRenderer.reset(
244 VirtualRobot::CoinVisualizationFactory::createOffscreenRenderer(width, height));
245 ARMARX_INFO << "done DepthImageProviderDynamicSimulation::onStartCapture";
246 }
247
248 void
252
256
257 std::string
262
263 std::string
265 {
266 return "DepthImageProviderDynamicSimulation";
267 }
268
269 bool
271 {
272 return true;
273 }
274
275 visionx::StereoCalibration
277 {
278 visionx::StereoCalibration stereoCalibration;
279
280 float r = static_cast<float>(width) / static_cast<float>(height);
281
282 visionx::CameraParameters RGBCameraIntrinsics;
283 RGBCameraIntrinsics.distortion = {0, 0, 0, 0};
284 RGBCameraIntrinsics.focalLength = {
285 static_cast<float>(width) / (2 * std::tan((vertFov * r) / 2)),
286 static_cast<float>(height) / (2 * std::tan(vertFov / 2))};
287 RGBCameraIntrinsics.height = height;
288 RGBCameraIntrinsics.principalPoint = {width / 2.0f, height / 2.0f};
289 RGBCameraIntrinsics.rotation =
290 visionx::tools::convertEigenMatToVisionX(Eigen::Matrix3f::Identity());
291 RGBCameraIntrinsics.translation =
292 visionx::tools::convertEigenVecToVisionX(Eigen::Vector3f::Zero());
293 RGBCameraIntrinsics.width = width;
294
295 visionx::CameraParameters DepthCameraIntrinsics;
296 DepthCameraIntrinsics.distortion = {0, 0, 0, 0};
297 DepthCameraIntrinsics.focalLength = {
298 static_cast<float>(width) / (2 * std::tan((vertFov * r) / 2)),
299 static_cast<float>(height) / (2 * std::tan(vertFov / 2))};
300 DepthCameraIntrinsics.height = height;
301 DepthCameraIntrinsics.principalPoint = {width / 2.0f, height / 2.0f};
302 DepthCameraIntrinsics.rotation =
303 visionx::tools::convertEigenMatToVisionX(Eigen::Matrix3f::Identity());
304 DepthCameraIntrinsics.translation = {0.075, 0, 0};
305 DepthCameraIntrinsics.width = width;
306
307
308 stereoCalibration.calibrationLeft = visionx::tools::createDefaultMonocularCalibration();
309 stereoCalibration.calibrationRight = visionx::tools::createDefaultMonocularCalibration();
310 stereoCalibration.calibrationLeft.cameraParam = RGBCameraIntrinsics;
311 stereoCalibration.calibrationRight.cameraParam = DepthCameraIntrinsics;
312 stereoCalibration.rectificationHomographyLeft =
313 visionx::tools::convertEigenMatToVisionX(Eigen::Matrix3f::Zero());
314 stereoCalibration.rectificationHomographyRight =
315 visionx::tools::convertEigenMatToVisionX(Eigen::Matrix3f::Zero());
316
317
318 return stereoCalibration;
319 }
320
321 bool
323 {
324 return true;
325 }
326
327 std::string
329 {
330 return getProperty<std::string>("RobotNodeCamera");
331 }
332
333 void
337
338 void
340 {
342 rgbImage.reset();
343 dImage.reset();
344 dFloatImage.reset();
345 imgPtr[0] = nullptr;
346 imgPtr[1] = nullptr;
347 imgPtrFlt[0] = nullptr;
348
349 if (simVisu)
350 {
351 simVisu->releaseResources();
352 getArmarXManager()->removeObjectBlocking(simVisu);
353 }
354 simVisu = nullptr;
355 cameraNode = nullptr;
356 visualization = nullptr;
357
358 offscreenRenderer.reset();
359
360 SoDB::finish();
361 }
362
363 void
365 {
367 ARMARX_VERBOSE_S << "DepthImageProviderDynamicSimulation::onInitImageProvider";
368
369 const auto imgSz = getProperty<visionx::ImageDimension>("ImageSize").getValue();
370 height = imgSz.height;
371 width = imgSz.width;
372
373 if (!floatImageMode)
374 {
375 setImageFormat(visionx::ImageDimension(imgSz), visionx::eRgb);
377
378 rgbImage.reset(new CByteImage{
379 static_cast<int>(width), static_cast<int>(height), CByteImage::eRGB24});
380 dImage.reset(new CByteImage{
381 static_cast<int>(width), static_cast<int>(height), CByteImage::eRGB24});
382 imgPtr[0] = rgbImage.get();
383 imgPtr[1] = dImage.get();
384 }
385 else
386 {
387 setImageFormat(visionx::ImageDimension(imgSz), visionx::eFloat1Channel);
389
390 dFloatImage.reset(
391 new CFloatImage{static_cast<int>(width), static_cast<int>(height), 1});
392 imgPtrFlt[0] = dFloatImage.get();
393 }
394
395
396 pointcloud.reset(new pcl::PointCloud<PointT>{static_cast<unsigned int>(width),
397 static_cast<unsigned int>(height)});
398
399 rgbBuffer.resize(width * height);
400 depthBuffer.resize(width * height);
401 pointCloudBuffer.resize(width * height);
402
403 // init SoDB / Coin3D
404 SoDB::init();
405
406 VirtualRobot::init(getName());
407
408 // needed for SoSelection
409 SoInteraction::init();
410
411 std::stringstream svName;
412 svName << getName() << "_PhysicsWorldVisualization";
414 getIceProperties(), getName() + "_PhysicsWorldVisualization");
415 getArmarXManager()->addObject(simVisu);
416 ARMARX_VERBOSE_S << "done DepthImageProviderDynamicSimulation::onInitImageProvider";
417
419 sumRenderTimes = 0;
421 }
422
423 void
425 {
427 ImageProvider::onDisconnectComponent();
428 CapturingPointCloudProvider::onDisconnectComponent();
429 }
430
431 void
435
441
442 bool
444 {
446 bool succeeded = true;
447 Ice::Long timestamp;
448 try
449 {
450 timestamp = TimeUtil::HasTimeServer() ? simVisu->getSyncTimestamp()
451 : IceUtil::Time::now().toMicroSeconds();
452 syncVisu();
454 {
455 return false;
456 }
457 succeeded = render();
458 }
459 catch (...)
460 {
462 succeeded = false;
463 }
464
465 if (succeeded)
466 {
467 Eigen::Matrix4f rotate = Eigen::Matrix4f::Identity();
468 // rotate to conform to ArmarX standards
469 rotate.block(0, 0, 3, 3) =
470 Eigen::AngleAxis<float>(M_PI_2, Eigen::Vector3f::UnitZ()).toRotationMatrix();
471 pcl::PointCloud<PointT>::Ptr cloudTransformedPtr(new pcl::PointCloud<PointT>());
472 pcl::transformPointCloud(*pointcloud, *cloudTransformedPtr, rotate);
473 cloudTransformedPtr->header.stamp = timestamp;
474 providePointCloud(cloudTransformedPtr);
475
477 if (!floatImageMode)
478 {
480 }
481 else
482 {
484 }
485
486 if (drawPointCloud && (std::chrono::high_resolution_clock::now() - lastUpdate >
487 std::chrono::milliseconds{pointCloudDrawDelay}))
488 {
489 lastUpdate = std::chrono::high_resolution_clock::now();
490 DebugDrawer24BitColoredPointCloud dbgPcl;
491 dbgPcl.points.reserve(cloudTransformedPtr->size());
492
493 dbgPcl.pointSize = pointCloudPointSize;
494
495 const auto pointCloudBaseNode =
496 simVisu->getRobot(robotName)->getRobotNode(camNodeName);
497
498 if (!pointCloudBaseNode)
499 {
500 ARMARX_ERROR_S << deactivateSpam() << robotName << " has no node "
501 << camNodeName
502 << "\nthe point cloud will be attached to (0,0,0)";
503 }
504
505 Eigen::Matrix4f rotate = Eigen::Matrix4f::Identity();
506 // rotate.block(0, 0, 3, 3) = Eigen::AngleAxis<float>(M_PI_2, Eigen::Vector3f::UnitZ()). toRotationMatrix();
507 Eigen::Matrix4f transformCamToWorld =
508 (pointCloudBaseNode ? pointCloudBaseNode->getGlobalPose()
509 : Eigen::Matrix4f::Identity()) *
510 rotate;
511
512
513 assert(static_cast<std::size_t>(width) == pointcloud->width);
514 assert(static_cast<std::size_t>(height) == pointcloud->height);
515 for (std::size_t x = 0; x < static_cast<std::size_t>(width); x += pointSkip)
516 {
517 for (std::size_t y = 0; y < static_cast<std::size_t>(height); y += pointSkip)
518 {
519 const auto& pclPoint = cloudTransformedPtr->at(x, y);
520
521 //transform to point in world coord
522 const Eigen::Vector4f pointFromPcl{pclPoint.x, pclPoint.y, pclPoint.z, 1};
523
524 const Eigen::Vector4f pointInWorld = transformCamToWorld * pointFromPcl;
525 const Eigen::Vector4f pointInWorldNormalizedW =
526 pointInWorld / pointInWorld(3);
527
528 DebugDrawer24BitColoredPointCloudElement dbgPoint;
529
530 dbgPoint.x = pointInWorldNormalizedW(0);
531 dbgPoint.y = pointInWorldNormalizedW(1);
532 dbgPoint.z = pointInWorldNormalizedW(2);
533
534 //clip to space
535 if (clipPointCloud &&
536 (dbgPoint.x < clipDrawnCloudXLo || dbgPoint.x > clipDrawnCloudXHi ||
537 dbgPoint.y < clipDrawnCloudYLo || dbgPoint.y > clipDrawnCloudYHi ||
538 dbgPoint.z < clipDrawnCloudZLo || dbgPoint.z > clipDrawnCloudZHi))
539 {
540 continue;
541 }
542
543 dbgPoint.color.r = pclPoint.r;
544 dbgPoint.color.g = pclPoint.g;
545 dbgPoint.color.b = pclPoint.b;
546
547 dbgPcl.points.emplace_back(dbgPoint);
548 }
549 }
550
551 debugDrawer->set24BitColoredPointCloudVisu(
552 "PointClouds", getName() + "::PointCloud", dbgPcl);
553 // debugDrawer->setPoseVisu("PointClouds", getName() + "::PointCloudBaseNode", new Pose { (pointCloudBaseNode ? pointCloudBaseNode->getGlobalPose() : Eigen::Matrix4f::Identity()) });
554 }
555 }
556 return succeeded;
557 }
558
559 bool
561 {
563 //render images
564 if (!cameraNode)
565 {
566 ARMARX_ERROR << deactivateSpam() << "No camera node:" << camNodeName;
567 return false;
568 }
569
570 bool renderOK = false;
571 {
572 auto l = simVisu->getScopedLock();
573 auto start = IceUtil::Time::now();
574
576 renderOK = VirtualRobot::CoinVisualizationFactory::renderOffscreenRgbDepthPointcloud(
577 offscreenRenderer.get(),
580 width,
581 height,
582 true,
583 rgbBuffer,
584 true,
586 true,
588 zNear,
589 zFar,
590 vertFov,
591 nanValue);
592
593 ARMARX_DEBUG << deactivateSpam(1) << "Offscreen rendering took: "
594 << (IceUtil::Time::now() - start).toMilliSecondsDouble() << " ms";
595 }
596 if (renderOK)
597 {
599 //get images + cloud
600 std::unique_lock lock(captureMutex);
601
602 auto start = std::chrono::high_resolution_clock::now();
603
604 auto randValuesSize = randValues.size();
605 int noiseOffset = noise > 0 ? rand() % randValuesSize : 0;
606
607 float* depthBufferEndOfRow = depthBuffer.data() + width - 1;
608 if (floatImageMode)
609 {
610 float* dFloatImageRow = dFloatImage->pixels;
611 for (int y = 0; y < height; y++)
612 {
613 for (int x = 0; x < width; x++)
614 {
615 float value = depthBufferEndOfRow[-x];
616 value = std::max(value, 0.0f);
617 value = std::min(value, static_cast<float>(0xffffff));
618 dFloatImageRow[x] = value;
619 }
620 dFloatImageRow += width;
621 depthBufferEndOfRow += width;
622 }
623 }
624 else
625 {
627 std::uint8_t* rgbImageRow = rgbImage->pixels;
628 std::uint8_t* rgbBufferEndOfRow = rgbBuffer.data() + (width - 1) * 3;
629 std::uint8_t* dImageRow = dImage->pixels;
630 for (int y = 0; y < height; ++y)
631 {
632 for (int x = 0; x < width; ++x)
633 {
634 memcpy(static_cast<void*>(&(rgbImageRow[x * 3])), //dest
635 static_cast<const void*>(&(rgbBufferEndOfRow[-x * 3])), //src
636 3 //count
637 );
638 float valueF = depthBufferEndOfRow[-x];
639 valueF = std::max(0.0f, valueF);
640 valueF = std::min(valueF, static_cast<float>(0xffffff));
641 std::uint32_t value = static_cast<std::uint32_t>(valueF);
642 memcpy(static_cast<void*>(&(dImageRow[x * 3])), //dest
643 static_cast<const void*>(&value), //src
644 3 //count
645 );
646 }
647 rgbImageRow += width * 3;
648 rgbBufferEndOfRow += width * 3;
649 dImageRow += width * 3;
650 depthBufferEndOfRow += width;
651 }
652 }
653
655 float* randValuesData = randValues.data();
656 std::uint8_t* rgbBufferEntry = rgbBuffer.data();
657 Eigen::Vector3f* inputRow = pointCloudBuffer.data();
658 PointT* outputEndOfRow = pointcloud->points.data() + (width - 1);
659 for (int y = 0; y < height; ++y)
660 {
662 for (int x = 0; x < width; ++x)
663 {
664 PointT& point = outputEndOfRow[-x];
665 Eigen::Vector3f pointCloudBufferPoint = inputRow[x];
666
667 int noiseIndex = (y * width + x) + noiseOffset;
668 float noiseX =
669 noise > 0.0f ? randValuesData[(noiseIndex) % randValuesSize] : 0.0f;
670 float noiseY =
671 noise > 0.0f ? randValuesData[(noiseIndex + 1) % randValuesSize] : 0.0f;
672 float noiseZ =
673 noise > 0.0f ? randValuesData[(noiseIndex + 2) % randValuesSize] : 0.0f;
674
675 point.x = pointCloudBufferPoint[0] + noiseX;
676 point.y = pointCloudBufferPoint[1] + noiseY;
677 point.z = pointCloudBufferPoint[2] + noiseZ;
678 point.r = rgbBufferEntry[0];
679 point.g = rgbBufferEntry[1];
680 point.b = rgbBufferEntry[2];
681
682 rgbBufferEntry += 3;
683 }
684 inputRow += width;
685 outputEndOfRow += width;
686 }
687
688 auto end = std::chrono::high_resolution_clock::now();
689 std::int64_t timeDiff =
690 std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
691 sumRenderTimes += timeDiff;
692 sumRenderTimesSquared += timeDiff * timeDiff;
693 renderTimesCount += 1;
694
695 if (renderTimesCount > 256)
696 {
698 double averageTime = sumRenderTimes * 1.0e-3 / renderTimesCount;
699 double averageSquaredTime = sumRenderTimesSquared * 1.0e-6 / renderTimesCount;
700 double stddevTime = std::sqrt(averageSquaredTime - averageTime * averageTime);
701
702 ARMARX_DEBUG << "Copying depth buffer data took: " << averageTime << "ms +- "
703 << stddevTime << "ms";
704
706 sumRenderTimes = 0;
709 }
710 }
711 return renderOK;
712 }
713
714 void
716 {
718 if (simVisu)
719 {
721 simVisu->synchronizeVisualizationData();
722 if (simVisu->getRobot(robotName))
723 {
725 cameraNode = simVisu->getRobot(robotName)->getRobotNode(camNodeName);
726 }
727 visualization = simVisu->getVisualization();
728 if (!cameraNode)
729 {
730 ARMARX_WARNING << "The camera node is not in the scene";
731 }
732 if (!visualization)
733 {
734 ARMARX_WARNING << "No physics visualization scene";
735 }
736 }
737 }
738
740
741} // namespace armarx
std::string timestamp()
#define ARMARX_REGISTER_COMPONENT_EXECUTABLE(ComponentT, applicationName)
Definition Decoupled.h:29
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition Logging.cpp:75
constexpr T c
static TPtr create(Ice::PropertiesPtr properties=Ice::createProperties(), const std::string &configName="", const std::string &configDomain="ArmarX")
Factory method for a component.
Definition Component.h:116
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition Component.cpp:90
Property< PropertyType > getProperty(const std::string &name)
std::string getReferenceFrame(const Ice::Current &c=Ice::emptyCurrent) override
bool hasSharedMemorySupport(const Ice::Current &c=Ice::emptyCurrent) override
void onInitComponent() override
Pure virtual hook for the subclass.
void onExitCapturingPointCloudProvider() override
This is called when the Component::onExitComponent() setup is called.
visionx::StereoCalibration getStereoCalibration(const Ice::Current &c=Ice::emptyCurrent) override
std::chrono::high_resolution_clock::time_point lastUpdate
void onStartCapture(float frameRate) override
This is called when the point cloud provider capturing has been started.
void onInitCapturingPointCloudProvider() override
This is called when the Component::onInitComponent() is called.
bool getImagesAreUndistorted(const Ice::Current &c=Ice::emptyCurrent) override
void onConnectComponent() override
Pure virtual hook for the subclass.
void onStopCapture() override
This is called when the point cloud provider capturing has been stopped.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onInitImageProvider() override
This is called when the Component::onInitComponent() is called.
void onExitImageProvider() override
This is called when the Component::onExitComponent() setup is called.
std::string getDefaultName() const override
Retrieve default name of component.
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
std::string getName() const
Retrieve name of object.
ArmarXManagerPtr getArmarXManager() const
Returns the ArmarX manager used to add and remove components.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
Ice::PropertiesPtr getIceProperties() const
Returns the set of Ice properties.
static bool HasTimeServer()
check if we have been initialized with a Timeserver
Definition TimeUtil.cpp:124
void updateTimestamp(Ice::Long timestamp, bool threadSafe=true)
Updates the timestamp of the currently captured image.
void start(const Ice::Current &c) override
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 setNumberImages(int numberImages)
Sets the number of images on each capture.
void providePointCloud(PointCloudPtrT pointCloudPtr)
offer the new point cloud.
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_ERROR_S
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:216
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:196
#define ARMARX_VERBOSE_S
Definition Logging.h:207
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
Definition Logging.h:184
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
Definition Logging.h:193
This file offers overloads of toIce() and fromIce() functions for STL container types.
void handleExceptions()
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
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