pointcloudXYZIR.cc
Go to the documentation of this file.
1 
2 
3 
5 
6 namespace velodyne_pointcloud
7 {
8 
10  const double max_range, const double min_range,
11  const std::string& target_frame, const std::string& fixed_frame,
12  const unsigned int scans_per_block, boost::shared_ptr<tf::TransformListener> tf_ptr)
13  : DataContainerBase(
14  max_range, min_range, target_frame, fixed_frame,
15  0, 1, true, scans_per_block, tf_ptr, 5,
16  "x", 1, sensor_msgs::PointField::FLOAT32,
17  "y", 1, sensor_msgs::PointField::FLOAT32,
18  "z", 1, sensor_msgs::PointField::FLOAT32,
19  "intensity", 1, sensor_msgs::PointField::FLOAT32,
20  "ring", 1, sensor_msgs::PointField::UINT16),
21  iter_x(cloud, "x"), iter_y(cloud, "y"), iter_z(cloud, "z"),
22  iter_ring(cloud, "ring"), iter_intensity(cloud, "intensity")
23  {};
24 
25  void PointcloudXYZIR::setup(const velodyne_msgs::VelodyneScan::ConstPtr& scan_msg){
26  DataContainerBase::setup(scan_msg);
32  }
33 
35  {}
36 
37  void PointcloudXYZIR::addPoint(float x, float y, float z, uint16_t ring, uint16_t /*azimuth*/, float distance, float intensity)
38  {
39  if(!pointInRange(distance)) return;
40 
41  // convert polar coordinates to Euclidean XYZ
42 
43  if(config_.transform)
44  transformPoint(x, y, z);
45 
46  *iter_x = x;
47  *iter_y = y;
48  *iter_z = z;
49  *iter_ring = ring;
50  *iter_intensity = intensity;
51 
52  ++cloud.width;
53  ++iter_x;
54  ++iter_y;
55  ++iter_z;
56  ++iter_ring;
58  }
59 }
60 
sensor_msgs::PointCloud2Iterator< float > iter_z
sensor_msgs::PointCloud2Iterator< float > iter_y
sensor_msgs::PointCloud2Iterator< uint16_t > iter_ring
sensor_msgs::PointCloud2Iterator< float > iter_x
virtual void setup(const velodyne_msgs::VelodyneScan::ConstPtr &scan_msg)
void transformPoint(float &x, float &y, float &z)
bool transform
enable / disable transform points
PointcloudXYZIR(const double max_range, const double min_range, const std::string &target_frame, const std::string &fixed_frame, const unsigned int scans_per_block, boost::shared_ptr< tf::TransformListener > tf_ptr=boost::shared_ptr< tf::TransformListener >())
sensor_msgs::PointCloud2Iterator< float > iter_intensity
virtual void addPoint(float x, float y, float z, uint16_t ring, uint16_t azimuth, float distance, float intensity)


velodyne_pointcloud
Author(s): Jack O'Quin, Piyush Khandelwal, Jesse Vera, Sebastian Pütz
autogenerated on Thu Jul 4 2019 19:09:30