Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef __PLUGINS_ROS_PCL_ADAPTER_H_
23 #define __PLUGINS_ROS_PCL_ADAPTER_H_
24 
25 #include <utils/time/time.h>
26 
27 #include <map>
28 #include <vector>
29 #include <string>
30 #include <stdint.h>
31 
32 namespace fawkes {
33  class PointCloudManager;
34  class Logger;
35 }
36 
38 {
39  public:
40  /** Information about the data fields. */
42  public:
43  std::string name; ///< Name of field
44  uint32_t offset; ///< Offset from start of point struct
45  uint8_t datatype; ///< Datatype enumeration see above
46  uint32_t count; ///< How many elements in field
47 
48  /** Constructor for pre-allocation. */
50  /** Constructor.
51  * @param name field name
52  * @param offset data offset
53  * @param datatype data type ID, see sensor_msgs::PointField
54  * @param count number of data entries
55  */
56  PointFieldInfo(std::string name, uint32_t offset,
57  uint8_t datatype, uint32_t count)
58  : name(name), offset(offset), datatype(datatype), count(count) {}
59  };
60  /** Vector of PointFieldInfo. */
61  typedef std::vector<PointFieldInfo> V_PointFieldInfo;
62 
64  fawkes::Logger *logger);
66 
67  void get_info(std::string &id,
68  unsigned int &width, unsigned int &height,
69  std::string &frame_id, bool &is_dense,
70  V_PointFieldInfo &pfi);
71 
72  void get_data(const std::string &id,
73  unsigned int &width, unsigned int &height, fawkes::Time &time,
74  void **data_ptr, size_t &point_size, size_t &num_points);
75 
76  void close(const std::string &id);
77 
78  private:
79  fawkes::PointCloudManager *__pcl_manager;
80 
81  class StorageAdapter;
82  std::map<std::string, StorageAdapter *> __sas;
83 };
84 
85 
86 #endif