Public Member Functions | Protected Attributes | List of all members
sensor_msgs::PointCloud2Modifier Class Reference

Enables modifying a sensor_msgs::PointCloud2 like a container. More...

#include <point_cloud2_iterator.h>

Public Member Functions

void clear ()
 remove all T's from the original sensor_msgs::PointCloud2 More...
 
 PointCloud2Modifier (PointCloud2 &cloud_msg)
 Default constructor. More...
 
void reserve (size_t size)
 
void resize (size_t size)
 
void setPointCloud2Fields (int n_fields,...)
 Function setting some fields in a PointCloud and adjusting the internals of the PointCloud2. More...
 
void setPointCloud2FieldsByString (int n_fields,...)
 Function setting some fields in a PointCloud and adjusting the internals of the PointCloud2. More...
 
size_t size () const
 

Protected Attributes

PointCloud2 & cloud_msg_
 

Detailed Description

Enables modifying a sensor_msgs::PointCloud2 like a container.

Definition at line 105 of file point_cloud2_iterator.h.

Constructor & Destructor Documentation

◆ PointCloud2Modifier()

sensor_msgs::PointCloud2Modifier::PointCloud2Modifier ( PointCloud2 &  cloud_msg)
inline

Default constructor.

Parameters
cloud_msgThe sensor_msgs::PointCloud2 to modify

Definition at line 102 of file impl/point_cloud2_iterator.h.

Member Function Documentation

◆ clear()

void sensor_msgs::PointCloud2Modifier::clear ( )
inline

remove all T's from the original sensor_msgs::PointCloud2

Definition at line 134 of file impl/point_cloud2_iterator.h.

◆ reserve()

void sensor_msgs::PointCloud2Modifier::reserve ( size_t  size)
inline
Parameters
sizeThe number of T's to reserve in the original sensor_msgs::PointCloud2 for

Definition at line 111 of file impl/point_cloud2_iterator.h.

◆ resize()

void sensor_msgs::PointCloud2Modifier::resize ( size_t  size)
inline
Parameters
sizeThe number of T's to change the size of the original sensor_msgs::PointCloud2 by

Definition at line 116 of file impl/point_cloud2_iterator.h.

◆ setPointCloud2Fields()

void sensor_msgs::PointCloud2Modifier::setPointCloud2Fields ( int  n_fields,
  ... 
)
inline

Function setting some fields in a PointCloud and adjusting the internals of the PointCloud2.

Parameters
n_fieldsthe number of fields to add. The fields are given as triplets: name of the field as char*, number of elements in the field, the datatype of the elements in the field

E.g, you create your PointCloud2 message with XYZ/RGB as follows:

  setPointCloud2Fields(cloud_msg, 4, "x", 1, sensor_msgs::PointField::FLOAT32,
                                             "y", 1, sensor_msgs::PointField::FLOAT32,
                                             "z", 1, sensor_msgs::PointField::FLOAT32,
                                             "rgb", 1, sensor_msgs::PointField::FLOAT32);

WARNING: THIS DOES NOT TAKE INTO ACCOUNT ANY PADDING AS DONE UNTIL HYDRO For simple usual cases, the overloaded setPointCloud2FieldsByString is what you want.

Parameters
n_fieldsthe number of fields to add. The fields are given as triplets: name of the field as char*, number of elements in the field, the datatype of the elements in the field

E.g, you create your PointCloud2 message with XYZ/RGB as follows:

  setPointCloud2FieldsByString(cloud_msg, 4, "x", 1, sensor_msgs::PointField::FLOAT32,
                                             "y", 1, sensor_msgs::PointField::FLOAT32,
                                             "z", 1, sensor_msgs::PointField::FLOAT32,
                                             "rgb", 1, sensor_msgs::PointField::FLOAT32);

WARNING: THIS DOES NOT TAKE INTO ACCOUNT ANY PADDING AS DONE UNTIL HYDRO For simple usual cases, the overloaded setPointCloud2FieldsByString is what you want.

Definition at line 166 of file impl/point_cloud2_iterator.h.

◆ setPointCloud2FieldsByString()

void sensor_msgs::PointCloud2Modifier::setPointCloud2FieldsByString ( int  n_fields,
  ... 
)
inline

Function setting some fields in a PointCloud and adjusting the internals of the PointCloud2.

Parameters
n_fieldsthe number of fields to add. The fields are given as strings: "xyz" (3 floats), "rgb" (3 uchar stacked in a float), "rgba" (4 uchar stacked in a float)
Returns
void

WARNING: THIS FUNCTION DOES ADD ANY NECESSARY PADDING TRANSPARENTLY

Definition at line 198 of file impl/point_cloud2_iterator.h.

◆ size()

size_t sensor_msgs::PointCloud2Modifier::size ( ) const
inline
Returns
the number of T's in the original sensor_msgs::PointCloud2

Definition at line 106 of file impl/point_cloud2_iterator.h.

Member Data Documentation

◆ cloud_msg_

PointCloud2& sensor_msgs::PointCloud2Modifier::cloud_msg_
protected

A reference to the original sensor_msgs::PointCloud2 that we read

Definition at line 166 of file point_cloud2_iterator.h.


The documentation for this class was generated from the following file:


sensor_msgs
Author(s): Tully Foote
autogenerated on Wed Mar 2 2022 00:06:55