Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semantic_slam using python3 #45

Open
reem90 opened this issue May 30, 2021 · 0 comments
Open

semantic_slam using python3 #45

reem90 opened this issue May 30, 2021 · 0 comments

Comments

@reem90
Copy link

reem90 commented May 30, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant