33 #include <VisionX/interface/components/RGBDImageProvider.h>
36 #include <condition_variable>
39 #include <Eigen/Geometry>
41 #include <pcl/common/transforms.h>
42 #include <pcl/io/openni2_grabber.h>
43 #include <pcl/point_cloud.h>
44 #include <pcl/point_types.h>
46 #include <opencv2/opencv.hpp>
50 #include <RobotAPI/interface/components/RobotHealthInterface.h>
53 #include <Image/IplImageAdaptor.h>
69 defineOptionalProperty<Eigen::Vector2i>(
"dimensions", Eigen::Vector2i(640, 480),
"")
70 .map(
"320x240", Eigen::Vector2i(320, 240))
71 .map(
"640x480", Eigen::Vector2i(640, 480))
72 .map(
"800x600", Eigen::Vector2i(800, 600))
73 .map(
"1280x1024", Eigen::Vector2i(1280, 1024))
74 .map(
"1600x1200", Eigen::Vector2i(1600, 1200));
76 defineOptionalProperty<std::string>(
"depthCameraCalibrationFile",
77 "VisionX/camera_calibration/asus_xtion_depth.yaml",
79 defineOptionalProperty<std::string>(
80 "RGBCameraCalibrationFile",
"VisionX/camera_calibration/asus_xtion_rgb.yaml",
"");
82 defineOptionalProperty<bool>(
"EnableAutoExposure",
true,
"enable auto exposure.");
83 defineOptionalProperty<bool>(
84 "EnableAutoWhiteBalance",
true,
"enable auto white balance.");
86 defineOptionalProperty<std::string>(
87 "ReferenceFrameName",
"DepthCamera",
"Optional reference frame name.");
88 defineOptionalProperty<std::string>(
"OpenNIDeviceId",
90 "Device id of the openni device, e.g. empty for "
91 "first device, or index in the format #n, e.g. 0");
92 defineOptionalProperty<float>(
95 "In Milliseconds. Time offset between capturing the image on the hardware and "
96 "receiving the image in this process.",
98 defineOptionalProperty<std::string>(
99 "RobotHealthTopicName",
"RobotHealthTopic",
"Name of the RobotHealth topic");
100 defineOptionalProperty<std::string>(
"DebugObserverName",
102 "Name of the topic the DebugObserver listens on");
114 virtual public RGBDPointCloudProviderInterface,
127 return "OpenNIPointCloudProvider";
130 std::vector<imrec::ChannelPreferences>
204 return getProperty<std::string>(
"ReferenceFrameName");
208 void callbackFunctionForOpenNIGrabberPointCloudWithRGB(
209 const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr& newCloud);
210 void callbackFunctionForOpenNIGrabberPointCloud(
211 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& newCloud);
212 void callbackFunctionForOpenNIGrabberImage(
const pcl::io::Image::Ptr& newImage);
213 void grabImages(
const pcl::io::Image::Ptr& RGBImage,
214 const pcl::io::DepthImage::Ptr& depthImage,
215 float reciprocalFocalLength);
216 void grabDepthImage(
const pcl::io::IRImage::Ptr& RGBImage,
217 const pcl::io::DepthImage::Ptr& depthImage,
221 bool loadCalibrationFile(std::string fileName, visionx::CameraParameters& calibration);
223 ImageProviderInterfacePrx imageProviderPrx;
224 std::string providerName;
225 CByteImage** rgbImages;
227 mutable std::mutex syncMutex;
229 pcl::io::OpenNI2Grabber::Ptr grabberInterface;
230 std::condition_variable condition;
231 bool newPointCloudCapturingRequested, newImageCapturingRequested;
232 long timeOfLastImageCapture, timeOfLastPointCloudCapture;
233 pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloudBuffer;
234 StereoCalibration calibration;
235 long captureTimeOffset;
237 armarx::RobotHealthInterfacePrx robotHealthTopic;