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
74 : __pcl_manager(pcl_manager)
82 std::map<std::string, StorageAdapter *>::iterator i;
83 for (i = __sas.begin(); i != __sas.end(); ++i) {
97 template <
typename Po
intT>
100 unsigned int &width,
unsigned int &height,
101 std::string &frame_id,
bool &is_dense,
106 frame_id = p->header.frame_id;
107 is_dense = p->is_dense;
109 #if PCL_VERSION_COMPARE(>=,1,7,0) 110 std::vector<pcl::PCLPointField> pfields;
112 std::vector<sensor_msgs::PointField> pfields;
114 pcl::for_each_type<typename pcl::traits::fieldList<PointT>::type>
115 (pcl::detail::FieldAdder<PointT>(pfields));
118 pfi.resize(pfields.size());
119 for (
unsigned int i = 0; i < pfields.size(); ++i) {
120 #if PCL_VERSION_COMPARE(>=,1,7,0) 121 pcl::PCLPointField &pf = pfields[i];
123 sensor_msgs::PointField &pf = pfields[i];
126 pf.datatype, pf.count);
140 unsigned int &width,
unsigned int &height,
141 std::string &frame_id,
bool &is_dense,
144 if (__sas.find(
id) == __sas.end()) {
151 fill_info(p, width, height, frame_id, is_dense, pfi);
156 fill_info(p, width, height, frame_id, is_dense, pfi);
161 fill_info(p, width, height, frame_id, is_dense, pfi);
164 throw Exception(
"PointCloud '%s' does not exist or unknown type",
id.c_str());
181 unsigned int &width,
unsigned int &height,
fawkes::Time &time,
182 void **data_ptr,
size_t &point_size,
size_t &num_points)
184 if (__sas.find(
id) == __sas.end()) {
213 unsigned int &width,
unsigned int &height,
fawkes::Time &time,
215 void **data_ptr,
size_t &point_size,
size_t &num_points)
217 get_info(
id, width, height, frame_id, is_dense, pfi);
218 get_data(
id, frame_id, width, height, time, data_ptr, point_size, num_points);
228 if (__sas.find(
id) != __sas.end()) {
std::vector< PointFieldInfo > V_PointFieldInfo
Vector of PointFieldInfo.
void close(const std::string &id)
Close an adapter.
Fawkes library namespace.
virtual unsigned int width() const =0
Get width of point cloud.
Information about the data fields.
~PointCloudAdapter()
Destructor.
A class for handling time.
virtual size_t point_size() const =0
Get size of a point.
virtual unsigned int height() const =0
Get height of point cloud.
void get_data_and_info(const std::string &id, std::string &frame_id, bool &is_dense, unsigned int &width, unsigned int &height, fawkes::Time &time, V_PointFieldInfo &pfi, void **data_ptr, size_t &point_size, size_t &num_points)
Get data and info of point cloud.
virtual std::string frame_id() const =0
Get frame ID of point cloud.
virtual void * data_ptr() const =0
Get pointer on data.
const RefPtr< const pcl::PointCloud< PointT > > get_pointcloud(const char *id)
Get point cloud.
Base class for exceptions in Fawkes.
PointCloudAdapter(fawkes::PointCloudManager *pcl_manager, fawkes::Logger *logger)
Constructor.
void get_info(const std::string &id, unsigned int &width, unsigned int &height, std::string &frame_id, bool &is_dense, V_PointFieldInfo &pfi)
Get info about point cloud.
virtual void get_time(fawkes::Time &time) const =0
Get last capture time.
RefPtr<> is a reference-counting shared smartpointer.
virtual size_t num_points() const =0
Get numer of points in point cloud.
void get_data(const std::string &id, std::string &frame_id, unsigned int &width, unsigned int &height, fawkes::Time &time, void **data_ptr, size_t &point_size, size_t &num_points)
Get current data of point cloud.
const pcl_utils::StorageAdapter * get_storage_adapter(const char *id)
Get a storage adapter.
bool exists_pointcloud(const char *id)
Check if point cloud exists.