eric-wieser/ros_numpy

PointCloud2 issues/fixes

PatWie opened this issue · 0 comments

I identified 2 issues and have two fixes

message = get_a_ros_pointcloud2_message()

# For PointCloud2 topics, there are two issues.
# - the __class__ - mapping is buggy
message.__class__ = sensor_msgs.msg._PointCloud2.PointCloud2
# - the converter assumes the message.field are ordered by the offsets
offset_sorted = {f.offset: f for f in message.fields}
message.fields = [f for (_, f) in sorted(offset_sorted.items())]