Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions sensor_msgs_py/test/test_point_cloud2.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
PointField(name='z', offset=8, datatype=PointField.FLOAT32, count=1)]

itemsize = points.itemsize
data = points.tobytes()
data = bytearray(points.tobytes())

# 3D (xyz) point cloud (nx3)
pcd = PointCloud2(
Expand Down Expand Up @@ -101,7 +101,7 @@
# Every point consists of three float32s.
point_step=(itemsize * points3.shape[-1]),
row_step=(itemsize * points3.shape[-1] * points3.shape[0]),
data=points3.tobytes()
data=bytearray(points3.tobytes())
)

# Check multiple datatype pointclouds
Expand Down Expand Up @@ -132,15 +132,15 @@
# The itemsize therfore represents the size of a complete point
point_step=struct_points_itemsize,
row_step=(struct_points_itemsize * points.shape[0]),
data=struct_points.tobytes()
data=bytearray(struct_points.tobytes())
)

# Point cloud with a field with count > 1
count = 3
fields5 = [PointField(name='x', offset=0, datatype=PointField.FLOAT32, count=3)]

itemsize = points.itemsize * count
data = points.tobytes()
data = bytearray(points.tobytes())

pcd5 = PointCloud2(
header=Header(frame_id='frame'),
Expand Down Expand Up @@ -180,7 +180,7 @@
fields=struct_points_fields_6,
point_step=struct_points_itemsize_6,
row_step=(struct_points_itemsize_6 * points.shape[0]),
data=struct_points_6.tobytes()
data=bytearray(struct_points_6.tobytes())
)

# End padding in data layout
Expand Down Expand Up @@ -368,7 +368,7 @@ def test_read_cloud_with_non_standard_point_step(self):
fields=fields,
point_step=itemsize,
row_step=itemsize * points_larger_itemsize.shape[0],
data=points_larger_itemsize.tobytes()
data=bytearray(points_larger_itemsize.tobytes())
)

# Deserialize point cloud
Expand Down