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

Port to ROS 2 #53

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Port to ROS 2 #53

wants to merge 12 commits into from

Conversation

mitukou1109
Copy link

@mitukou1109 mitukou1109 commented Jan 26, 2025

This PR ports the package to ROS 2.
I tested the branch on Humble (Ubuntu 22.04) and it works the same as on ROS 1.
I think it should be merged to the newly created branch.

In addition to the migration, the following improvements are applied:

  • adds an parameter debug to toggle debug output (Segmenting cloud with N points..., etc.)
  • addresses compiler warnings (Wreorder, Wsign-compare, etc.)

@mitukou1109 mitukou1109 changed the title Port to ros2 Port to ROS 2 Jan 26, 2025
@tiesus
Copy link

tiesus commented Jan 28, 2025

Hi,

thanks for porting the code to ros2!
@mitukou1109 I just took your PR to do some tests on our data and had a problem with the frames. The line which causes the error is in my opinion https://github.com/mitukou1109/linefit_ground_segmentation/blob/4aff7cca7ca6d17b9d2bd534be583595b3c81ff8/linefit_ground_segmentation_ros/src/ground_segmentation_node.cc#L131 . The published cloud there has the frame before the transform. I think it has to be updated if gravity_aligned_frame is not empty.

@mitukou1109
Copy link
Author

@tiesus Thank you for your tests,
but I cannot figure out what causes the problem.
AFAIK, the published cloud should always have the same frame ID as the input, and the transform from or to the frame is not needed to be provided.
Could you please share the error message?

BTW the visualization using pcl::visualization::PCLVisualizer is not working in my environment with the following errors. I guess it's related to WSLg and the code itself does not have issues, but due to this I have not been able to check the visualized test result.

[ground_segmentation_test_node-1] X Error of failed request:  BadAccess (attempt to access private resource denied)
[ground_segmentation_test_node-1]   Major opcode of failed request:  148 (GLX)
[ground_segmentation_test_node-1]   Minor opcode of failed request:  5 (X_GLXMakeCurrent)
[ground_segmentation_test_node-1]   Serial number of failed request:  81
[ground_segmentation_test_node-1]   Current serial number in output stream:  81

@tiesus
Copy link

tiesus commented Feb 1, 2025

If you don't update the frame, the resulting pointcloud is not aligned any more with your tf and transformation in rviz fails. For example if we have a lidar which is tilted or faces down in the code we apply a rotation to the pointcloud. I f we publish this pointcloud with the input frame, the data is not aligned any more since we applied a rotation.

Maybe I'm getting something wrong but this fixed my errors and the ground pointcloud is stitched together correctly in rviz.

@mitukou1109
Copy link
Author

I kind of understood, but the frame does not seem to be updated in the original implementation either...

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

Successfully merging this pull request may close these issues.

2 participants