Fawkes API Fawkes Development Version
pcl_adapter.h
1
2/***************************************************************************
3 * pcl_adapter.h - Thread to exchange point clouds
4 *
5 * Created: Tue Nov 08 00:36:10 2011
6 * Copyright 2011-2014 Tim Niemueller [www.niemueller.de]
7 * 2012 Bastian Klingen
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _LIBS_PCL_UTILS_PCL_ADAPTER_H_
24#define _LIBS_PCL_UTILS_PCL_ADAPTER_H_
25
26#include <utils/time/time.h>
27
28#include <map>
29#include <stdint.h>
30#include <string>
31#include <vector>
32
33namespace fawkes {
34class PointCloudManager;
35class Logger;
36} // namespace fawkes
37
39{
40public:
41 /** Information about the data fields. */
43 {
44 public:
45 std::string name; ///< Name of field
46 uint32_t offset; ///< Offset from start of point struct
47 uint8_t datatype; ///< Datatype enumeration see above
48 uint32_t count; ///< How many elements in field
49
50 /** Constructor for pre-allocation. */
52 {
53 }
54 /** Constructor.
55 * @param name field name
56 * @param offset data offset
57 * @param datatype data type ID, see sensor_msgs::PointField
58 * @param count number of data entries
59 */
60 PointFieldInfo(std::string name, uint32_t offset, uint8_t datatype, uint32_t count)
62 {
63 }
64 };
65 /** Vector of PointFieldInfo. */
66 typedef std::vector<PointFieldInfo> V_PointFieldInfo;
67
70
71 void get_info(const std::string &id,
72 unsigned int & width,
73 unsigned int & height,
74 std::string & frame_id,
75 bool & is_dense,
76 V_PointFieldInfo & pfi);
77
78 void get_data(const std::string &id,
79 std::string & frame_id,
80 unsigned int & width,
81 unsigned int & height,
82 fawkes::Time & time,
83 void ** data_ptr,
84 size_t & point_size,
85 size_t & num_points);
86
87 void get_data_and_info(const std::string &id,
88 std::string & frame_id,
89 bool & is_dense,
90 unsigned int & width,
91 unsigned int & height,
92 fawkes::Time & time,
93 V_PointFieldInfo & pfi,
94 void ** data_ptr,
95 size_t & point_size,
96 size_t & num_points);
97
98 void close(const std::string &id);
99
100private:
101 fawkes::PointCloudManager *pcl_manager_;
102
103 class StorageAdapter;
104 std::map<std::string, StorageAdapter *> sas_;
105};
106
107#endif
Information about the data fields.
Definition: pcl_adapter.h:43
PointFieldInfo(std::string name, uint32_t offset, uint8_t datatype, uint32_t count)
Constructor.
Definition: pcl_adapter.h:60
uint32_t count
How many elements in field.
Definition: pcl_adapter.h:48
std::string name
Name of field.
Definition: pcl_adapter.h:45
uint8_t datatype
Datatype enumeration see above.
Definition: pcl_adapter.h:47
PointFieldInfo()
Constructor for pre-allocation.
Definition: pcl_adapter.h:51
uint32_t offset
Offset from start of point struct.
Definition: pcl_adapter.h:46
Point cloud adapter class.
Definition: pcl_adapter.h:39
PointCloudAdapter(fawkes::PointCloudManager *pcl_manager, fawkes::Logger *logger)
Constructor.
Definition: pcl_adapter.cpp:75
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.
void close(const std::string &id)
Close an adapter.
~PointCloudAdapter()
Destructor.
Definition: pcl_adapter.cpp:81
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.
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.
std::vector< PointFieldInfo > V_PointFieldInfo
Vector of PointFieldInfo.
Definition: pcl_adapter.h:66
Interface for logging.
Definition: logger.h:42
Point Cloud manager.
A class for handling time.
Definition: time.h:93
Fawkes library namespace.