Skip to content

Decoding CompressedPointCloud2 using point_cloud_transport_py #102

@FranzAlbers

Description

@FranzAlbers

Hello,

thanks for developing this useful package!

We have recorded some point clouds with Draco compression as point_cloud_interfaces/CompressedPointCloud2 in ROS2 bags. Our goal is to decode these into regular sensor_msgs/PointCloud2 messages by directly reading the compressed point clouds from the bag file using Python.

We figured the decode method from the point_cloud_transport_py package would handle this, but the returned pointcloud2_buffer is empty after decoding.

Here is a snippet from our current approach:

import point_cloud_transport_py as pct
from point_cloud_interfaces.msg import CompressedPointCloud2
from rclpy.serialization import serialize_message
...

pct_codec = pct.PointCloudCodec()
pct_vec_str = pct.VectorString()
pct_names_vec_str = pct.VectorString()
codec.getLoadableTransports(self._pct_vec_str, self._pct_names_vec_str)
# Verified: Draco Transport is available
...

# load compressed_pointcloud2_msg from bag
# Verified: compressed_pointcloud2_msg properly loaded  

compressed_pointcloud2_buffer = serialize_message(compressed_pointcloud2_msg)
pointcloud2_buffer = pct_codec.decode(compressed_pointcloud2_msg.format, bytes(compressed_pointcloud2_buffer))

Are there specific steps we might be missing when using the decode method?
Are there any example scripts or documentation available that show how to decode CompressedPointCloud2 messages in Python?

Thank you in advance for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions