40 #ifndef PCL_IO_PCD_GRABBER_H_
41 #define PCL_IO_PCD_GRABBER_H_
66 PCDGrabberBase (
const std::string& pcd_file,
float frames_per_second,
bool repeat);
73 PCDGrabberBase (
const std::vector<std::string>& pcd_files,
float frames_per_second,
bool repeat);
124 getFramesPerSecond () const;
132 publish (const sensor_msgs::PointCloud2& blob, const Eigen::Vector4f& origin, const Eigen::Quaternionf& orientation) const = 0;
135 struct PCDGrabberImpl;
136 PCDGrabberImpl* impl_;
144 PCDGrabber (
const std::string& pcd_path,
float frames_per_second = 0,
bool repeat =
false);
145 PCDGrabber (
const std::vector<std::string>& pcd_files,
float frames_per_second = 0,
bool repeat =
false);
148 publish (
const sensor_msgs::PointCloud2& blob,
const Eigen::Vector4f& origin,
const Eigen::Quaternionf& orientation)
const;
150 boost::signals2::signal<void (const boost::shared_ptr<const pcl::PointCloud<PointT> >&)>* signal_;
153 boost::signals2::signal<void (const boost::shared_ptr<openni_wrapper::DepthImage>&)>* depth_image_signal_;
158 template<
typename Po
intT>
162 signal_ = createSignal<void (const boost::shared_ptr<const pcl::PointCloud<PointT> >&)>();
164 depth_image_signal_ = createSignal <void (const boost::shared_ptr<openni_wrapper::DepthImage>&)> ();
169 template<
typename Po
intT>
171 :
PCDGrabberBase (pcd_files, frames_per_second, repeat), signal_ ()
173 signal_ = createSignal<void (const boost::shared_ptr<const pcl::PointCloud<PointT> >&)>();
175 depth_image_signal_ = createSignal <void (const boost::shared_ptr<openni_wrapper::DepthImage>&)> ();
180 template<
typename Po
intT>
void
185 cloud->sensor_origin_ = origin;
186 cloud->sensor_orientation_ = orientation;
188 signal_->operator () (cloud);
192 if (!cloud->isOrganized ())
195 boost::shared_ptr<xn::DepthMetaData> depth_meta_data (
new xn::DepthMetaData);
196 depth_meta_data->AllocateData (cloud->width, cloud->height);
197 XnDepthPixel* depth_map = depth_meta_data->WritableData ();
199 for (uint32_t i = 0; i < cloud->height; ++i)
200 for (uint32_t j = 0; j < cloud->width; ++j)
202 depth_map[k] =
static_cast<XnDepthPixel
> ((*cloud)[k].z * 1000);
206 boost::shared_ptr<openni_wrapper::DepthImage> depth_image (
new openni_wrapper::DepthImage (depth_meta_data, 0.075f, 525, 0, 0));
207 if (depth_image_signal_->num_slots() > 0)
208 depth_image_signal_->operator()(depth_image);