eric-wieser/ros_numpy

TypeError: 'NoneType' object is not iterable

germal opened this issue · 1 comments

Hi all,
I am trying to convert a ( previously cropped ) 3d array of pixel coordinates to a pointcloud to be published on ROS topic
`
for i in range(len(label_store)):
#create custom message with 3D points of mask
mask_message = Mask_Coordinates()
mask_message.class_name = label_store[i]
mask_message.score = score_store[i]
array_x,array_y,array_z = [],[],[]
score=score_store[i]
for j in range(0,len(path_points[i]))

                array_x.append(array[path_points[i][j][0]][path_points[i][j][1]][0])   
                array_y.append(array[path_points[i][j][0]][path_points[i][j][1]][1])
                array_z.append(array[path_points[i][j][0]][path_points[i][j][1]][2])

        XYZ_array=np.vstack((array_x,array_y,array_z)).T            
        message=rosnp.point_cloud2.array_to_pointcloud2(XYZ_array)

`

I get the following error message

message=rosnp.point_cloud2.array_to_pointcloud2(XYZ_array)
/ros_numpy/point_cloud2.py", line 147, in array_to_pointcloud2
cloud_msg.fields = dtype_to_fields(cloud_arr.dtype)
/ros_numpy/point_cloud2.py", line 92, in dtype_to_fields
for field_name in dtype.names:
TypeError: 'NoneType' object is not iterable

Could you please point me to the errors ?
Thank you
Regards

My mistake it was alist not an array for this reason the error