30 #ifndef POINT_CLOUD_TRANSFORMERS_H 31 #define POINT_CLOUD_TRANSFORMERS_H 33 #include <sensor_msgs/PointCloud2.h> 42 class EditableEnumProperty;
46 typedef std::vector<std::string>
V_string;
48 inline int32_t
findChannelIndex(
const sensor_msgs::PointCloud2ConstPtr& cloud,
const std::string& channel)
50 for (
size_t i = 0; i < cloud->fields.size(); ++i)
52 if (cloud->fields[i].name == channel)
62 inline T
valueFromCloud(
const sensor_msgs::PointCloud2ConstPtr& cloud, uint32_t offset, uint8_t type, uint32_t point_step, uint32_t index)
64 const uint8_t* data = &cloud->data[(point_step * index) + offset];
69 case sensor_msgs::PointField::INT8:
70 case sensor_msgs::PointField::UINT8:
72 uint8_t val = *
reinterpret_cast<const uint8_t*
>(data);
73 ret =
static_cast<T
>(val);
77 case sensor_msgs::PointField::INT16:
78 case sensor_msgs::PointField::UINT16:
80 uint16_t val = *
reinterpret_cast<const uint16_t*
>(data);
81 ret =
static_cast<T
>(val);
85 case sensor_msgs::PointField::INT32:
86 case sensor_msgs::PointField::UINT32:
88 uint32_t val = *
reinterpret_cast<const uint32_t*
>(data);
89 ret =
static_cast<T
>(val);
93 case sensor_msgs::PointField::FLOAT32:
95 float val = *
reinterpret_cast<const float*
>(data);
96 ret =
static_cast<T
>(val);
100 case sensor_msgs::PointField::FLOAT64:
102 double val = *
reinterpret_cast<const double*
>(data);
103 ret =
static_cast<T
>(val);
117 virtual uint8_t
supports(
const sensor_msgs::PointCloud2ConstPtr& cloud);
118 virtual bool transform(
const sensor_msgs::PointCloud2ConstPtr& cloud,
122 virtual uint8_t
score(
const sensor_msgs::PointCloud2ConstPtr& cloud);
124 void updateChannels(
const sensor_msgs::PointCloud2ConstPtr& cloud);
147 virtual uint8_t
supports(
const sensor_msgs::PointCloud2ConstPtr& cloud);
157 virtual uint8_t
supports(
const sensor_msgs::PointCloud2ConstPtr& cloud);
176 virtual uint8_t
supports(
const sensor_msgs::PointCloud2ConstPtr& cloud);
186 virtual uint8_t
supports(
const sensor_msgs::PointCloud2ConstPtr& cloud);
189 virtual uint8_t
score(
const sensor_msgs::PointCloud2ConstPtr& cloud);
199 virtual uint8_t
supports(
const sensor_msgs::PointCloud2ConstPtr& cloud);
202 virtual uint8_t
score(
const sensor_msgs::PointCloud2ConstPtr& cloud);
212 void updateAutoComputeBounds();
224 #endif // POINT_CLOUD_TRANSFORMERS_H
A single element of a property tree, with a name, value, description, and possibly children...
Property specialized to enforce floating point max/min.
std::vector< PointCloud::Point > V_PointCloudPoint
std::vector< std::string > V_string
T valueFromCloud(const sensor_msgs::PointCloud2ConstPtr &cloud, uint32_t offset, uint8_t type, uint32_t point_step, uint32_t index)
int32_t findChannelIndex(const sensor_msgs::PointCloud2ConstPtr &cloud, const std::string &channel)
Property specialized to provide getter for booleans.