ros / common_msgs

Commonly used messages in ROS. Includes messages for actions (actionlib_msgs), diagnostics (diagnostic_msgs), geometric primitives (geometry_msgs), robot navigation (nav_msgs), and common sensors (sensor_msgs), such as laser range finders, cameras, point clouds.
http://wiki.ros.org/common_msgs
179 stars 191 forks source link

Support for dynamic PointCloud2 creation #108

Open spuetz opened 7 years ago

spuetz commented 7 years ago

This enhancement enables a dynamic creation of sensor_msgs::PointCloud2 messages with dynamic point fields at creation time of the cloud. This means a node or driver providing sensor_msgs::PointCloud2 clouds can now publish configurable clouds. That is useful for devices which provide much extra information to each point in the cloud. With this enhancement, e.g. the user of a high resolution laser scanner, could configure which extra information should be published within the cloud. This is useful to only publish necessary information and to keep the network communication load smaller.

With the method bool PointCloud2Modifier::addPointCloud2Field(std::string name, std::string datatype) it is now possible to dynamically add fields if a field was enabled in the config.

spuetz commented 6 years ago

@tfoote I changed the things you commented. The PointCloud2Modifier::addPointCloud2Fields as well as the whole PointCloud2Modifier will only work at creation time of a PointCloud2. Once the buffer is filled, the step size is fixed. That should be clear for the developers using that class.

Having the PointCloud2Modifier::addPointCloud2Fields(const std::vector<PointFieldInfo>& fields) method with a vector of PointFieldInfo will enable dynamic point field and point cloud creation at run time. For example you could switch on and off some fields in a laser scanner driver.

The next thing I want to do here is working on the PointCloud2Iterator to enable organized point structure access with something like a matrix access operation, e.g. cloud(i, j), which is very useful for organized clouds to enable a fast access of neighboring points in the cloud. However, it would be very good to finish this pull request fast, so that I could start the next one. ;)

spuetz commented 6 years ago

@tfoote

spuetz commented 6 years ago

Hi @tfoote we would need the pull request now for the Sick MRS1000 Driver to dynamically enable a intensity channel in the point cloud.

tfoote commented 6 years ago

Thanks for resolving the direct comments. However it still does not have any test coverage of the new API, they would also provide examples of how it's designed to be used which would be helpful in checking the design.

We're approaching Melodic release and getting this in before then would be great.

spuetz commented 6 years ago

Okay I'll add one or more tests in the next days. Thank you. Would be could to have it in Melodic.

ctieben commented 4 years ago

Are there any news about this PR?

spuetz commented 4 years ago

We are planning on writing some tests soonish. @ctieben Do you need the feature?

ctieben commented 4 years ago

I’m interested in this PR and looking forward to using these changes in some future experiments. It would be great to have this in the default branch / repos.