Gazebo Msgs

API Reference

10.3.1
PointCloudPackedIterator< FieldType > Class Template Reference

Class that can iterate over a PointCloudPacked message. More...

#include <PointCloudPackedUtils.hh>

Public Member Functions

 PointCloudPackedIterator (PointCloudPacked &_cloudMsg, const std::string &_fieldName)
 

Detailed Description

template<typename FieldType>
class gz::msgs::PointCloudPackedIterator< FieldType >

Class that can iterate over a PointCloudPacked message.

E.g, you create your message and reserve space for data as follows:

PointCloudPacked pcMsg;
InitPointCloudPacked(pcMsg, "my_new_frame", false,
{{"a", PointCloudPacked::Field::FLOAT32}});
pcMsg.mutable_data()->resize(numPts * pcMsg.point_step());

For iterating over "a", you do :

PointCloudPackedIterator<float> iterA(pcMsg, "a");

And then access it through iterA[0] or *iterA.

For iterating over RGBA, you can access each element as uint8_t:

PointCloudPackedIterator<uint8_t> iterR(pcMsg, "r");
PointCloudPackedIterator<uint8_t> iterG(pcMsg, "g");
PointCloudPackedIterator<uint8_t> iterB(pcMsg, "b");
PointCloudPackedIterator<uint8_t> iterA(pcMsg, "a");
Template Parameters
FieldTypeType of the element being iterated upon

Constructor & Destructor Documentation

◆ PointCloudPackedIterator()

PointCloudPackedIterator ( PointCloudPacked &  _cloudMsg,
const std::string _fieldName 
)
inline

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