41 #include <pcl/pcl_config.h>
44 #include <pcl/common/io.h>
45 #include <Eigen/Geometry>
46 #include <Eigen/StdVector>
48 #include <pcl/io/grabber.h>
49 #include <pcl/common/synchronizer.h>
68 using PairOfImages = std::pair<pcl::PCLImage, pcl::PCLImage>;
72 using Ptr = shared_ptr<EnsensoGrabber>;
73 using ConstPtr = shared_ptr<const EnsensoGrabber>;
78 using sig_cb_ensenso_images = void(
const shared_ptr<PairOfImages>&);
100 openDevice (const
int device = 0);
119 isRunning () const override;
124 isTcpPortOpen () const;
129 getName () const override;
150 configureCapture (const
bool auto_exposure = true,
151 const
bool auto_gain = true,
152 const
int bining = 1,
153 const
float exposure = 0.32,
154 const
bool front_light = false,
156 const
bool gain_boost = false,
157 const
bool hardware_gamma = false,
158 const
bool hdr = false,
159 const
int pixel_clock = 10,
160 const
bool projector = true,
161 const
int target_brightness = 80,
162 const std::
string trigger_mode = "Software",
163 const
bool use_disparity_map_area_of_interest = false) const;
184 initExtrinsicCalibration (const
int grid_spacing) const;
188 clearCalibrationPatternBuffer () const;
195 captureCalibrationPattern () const;
203 estimateCalibrationPatternPose (
Eigen::Affine3d &pattern_pose) const;
217 computeCalibrationMatrix (const std::vector<
Eigen::Affine3d,
Eigen::aligned_allocator<
Eigen::Affine3d> > &robot_poses,
219 const std::
string setup = "Moving",
220 const std::
string target = "Hand",
221 const
Eigen::Affine3d &guess_tf =
Eigen::Affine3d::Identity (),
222 const
bool pretty_format = true) const;
230 storeEEPROMExtrinsicCalibration () const;
235 clearEEPROMExtrinsicCalibration ();
254 setExtrinsicCalibration (const
double euler_angle,
255 Eigen::Vector3d &rotation_axis,
256 const
Eigen::Vector3d &translation,
257 const std::
string target = "Hand") const;
263 setExtrinsicCalibration (const std::
string target = "Hand");
280 setExtrinsicCalibration (const
Eigen::Affine3d &transformation,
281 const std::
string target = "Hand");
285 getFramesPerSecond () const override;
291 openTcpPort (const
int port = 24000);
304 getTreeAsJson (const
bool pretty_format = true) const;
311 getResultAsJson (const
bool pretty_format = true) const;
326 jsonTransformationToEulerAngles (const std::
string &json,
344 jsonTransformationToAngleAxis (const std::
string json,
346 Eigen::Vector3d &axis,
347 Eigen::Vector3d &translation) const;
358 jsonTransformationToMatrix (const std::
string transformation,
359 Eigen::Affine3d &matrix) const;
376 eulerAnglesTransformationToJson (const
double x,
383 const
bool pretty_format = true) const;
400 angleAxisTransformationToJson (const
double x,
408 const
bool pretty_format = true) const;
419 matrixTransformationToJson (const
Eigen::Affine3d &matrix,
421 const
bool pretty_format = true) const;
426 shared_ptr<const NxLibItem> root_;
434 std::thread grabber_thread_;
437 boost::signals2::signal<sig_cb_ensenso_point_cloud>* point_cloud_signal_;
440 boost::signals2::signal<sig_cb_ensenso_images>* images_signal_;
443 boost::signals2::signal<sig_cb_ensenso_point_cloud_images>* point_cloud_images_signal_;
446 bool device_open_{
false};
449 bool tcp_open_{
false};
452 bool running_{
false};
Grabber for IDS-Imaging Ensenso's devices.
static std::uint64_t getPCLStamp(const double ensenso_stamp)
Convert an Ensenso time stamp into a PCL/ROS time stamp.
static std::string getOpenCVType(const int channels, const int bpe, const bool isFlt)
Get OpenCV image type corresponding to the parameters given.
void processGrabbing()
Continuously asks for images and or point clouds data from the device and publishes them if available...
~EnsensoGrabber() noexcept override
Destructor inherited from the Grabber interface.
pcl::EventFrequency frequency_
Point cloud capture/processing frequency.
EnsensoGrabber()
Constructor.
std::mutex fps_mutex_
Mutual exclusion for FPS computation.
A helper class to measure frequency of a certain event.
Grabber interface for PCL 1.x device drivers.
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
Define methods for measuring time spent in code blocks.
A point structure representing Euclidean xyz coordinates.