I changed from:
x_index = np.array([range(width)*height], dtype = '<f4')y_index = np.array([[i]*width for i in range(height)], dtype = '<f4').ravel()
to:
x_index = np.array([list(range(width))*height], dtype = '<f4')y_index = np.array([[i]*width for i in list(range(height))], dtype = '<f4').ravel()
because I got an error that says: TypeError: unsupported operand type(s) for *: 'range' and 'int'
I changed it from:
self.cloud_ros.data = np.getbuffer(self.ros_data.ravel())[:]
to:
self.cloud_ros.data = self.ros_data.ravel().tobytes()
because I got the following error: AttributeError: module 'numpy' has no attribute 'getbuffer'
The code works without any syntax error. However, even if I filled the pointcloud2 data with zeros, I will still have some pointcloud published with non-zero values that I can visualize in RVIZ. I tried to print the min and max which are always 0. But again I still can visualize one pointcloud that propagates to my occupancy map.
Are there any changes that should be done for the pointcloud data fields or bytes in the color_pcl_generator file? How to make sure that the performance in python 3 is the same as python 2? How to discard the unknown published pointcloud?
I run sematic_slam using python 3. I had to change three lines in the color_pcl_generator as follows:
In the line: https://github.com/floatlazer/semantic_slam/blob/master/semantic_cloud/include/color_pcl_generator/color_pcl_generator.py#L30:L31
I changed from:
x_index = np.array([range(width)*height], dtype = '<f4')
y_index = np.array([[i]*width for i in range(height)], dtype = '<f4').ravel()
to:x_index = np.array([list(range(width))*height], dtype = '<f4')
y_index = np.array([[i]*width for i in list(range(height))], dtype = '<f4').ravel()
because I got an error that says: TypeError: unsupported operand type(s) for *: 'range' and 'int'Also, I modified the line https://github.com/floatlazer/semantic_slam/blob/master/semantic_cloud/include/color_pcl_generator/color_pcl_generator.py#L134
I changed it from:
self.cloud_ros.data = np.getbuffer(self.ros_data.ravel())[:]
to:self.cloud_ros.data = self.ros_data.ravel().tobytes()
because I got the following error: AttributeError: module 'numpy' has no attribute 'getbuffer'
The code works without any syntax error. However, even if I filled the pointcloud2 data with zeros, I will still have some pointcloud published with non-zero values that I can visualize in RVIZ. I tried to print the min and max which are always 0. But again I still can visualize one pointcloud that propagates to my occupancy map.
Are there any changes that should be done for the pointcloud data fields or bytes in the color_pcl_generator file? How to make sure that the performance in python 3 is the same as python 2? How to discard the unknown published pointcloud?