23 #include "pcl_adapter.h"
25 #include <pcl/point_cloud.h>
26 #include <pcl/point_types.h>
27 #if PCL_VERSION_COMPARE(>=, 1, 7, 0)
28 # include <pcl/PCLPointField.h>
30 #include <logging/logger.h>
31 #include <pcl_utils/pointcloud_manager.h>
37 class PointCloudAdapter::StorageAdapter
76 : pcl_manager_(pcl_manager)
83 std::map<std::string, StorageAdapter *>::iterator i;
84 for (i = sas_.begin(); i != sas_.end(); ++i) {
98 template <
typename Po
intT>
101 unsigned int & width,
102 unsigned int & height,
103 std::string & frame_id,
109 frame_id = p->header.frame_id;
110 is_dense = p->is_dense;
112 #if PCL_VERSION_COMPARE(>=, 1, 7, 0)
113 std::vector<pcl::PCLPointField> pfields;
115 std::vector<sensor_msgs::PointField> pfields;
117 pcl::for_each_type<typename pcl::traits::fieldList<PointT>::type>(
118 pcl::detail::FieldAdder<PointT>(pfields));
121 pfi.resize(pfields.size());
122 for (
unsigned int i = 0; i < pfields.size(); ++i) {
123 #if PCL_VERSION_COMPARE(>=, 1, 7, 0)
124 pcl::PCLPointField &pf = pfields[i];
126 sensor_msgs::PointField &pf = pfields[i];
142 unsigned int & width,
143 unsigned int & height,
144 std::string & frame_id,
148 if (sas_.find(
id) == sas_.end()) {
155 fill_info(p, width, height, frame_id, is_dense, pfi);
160 fill_info(p, width, height, frame_id, is_dense, pfi);
165 fill_info(p, width, height, frame_id, is_dense, pfi);
168 throw Exception(
"PointCloud '%s' does not exist or unknown type",
id.c_str());
184 std::string & frame_id,
185 unsigned int & width,
186 unsigned int & height,
192 if (sas_.find(
id) == sas_.end()) {
220 std::string & frame_id,
222 unsigned int & width,
223 unsigned int & height,
230 get_info(
id, width, height, frame_id, is_dense, pfi);
231 get_data(
id, frame_id, width, height, time, data_ptr, point_size, num_points);
240 if (sas_.find(
id) != sas_.end()) {