Ask Your Question
0

Trouble Subscribing to PointCloud2 msg

asked 2021-03-14 23:04:14 -0500

edenselement99@gmail.com gravatar image

I am trying to edit the PointCloud2 msg from a realsense d435 camera, so I am first attempting to pass through the PointCloud2 msg without any sort of edits. Some data seems to pass through but the number of points seems to be reduced very considerably. I am using the PCL voxel gird example example and subscribing to /camera/depth/color/points under the rosrun command:

rosrun my_pcl_tutorial example input:=/camera/depth/color/points

Viewed in RVIZ I get this output. If I pan the camera around the pointcloud seems to be correct, just with far too few points.

When using the voxel grid nodelet in a launch file instead of my own code I get this output. How can I get the PCL voxel grid example to simply pass through the PointCloud2 message, or at least match the nodelet version?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-15 20:03:26 -0500

tryan gravatar image

I suspect you're using two different leaf sizes. The tutorial you linked to shows a leaf size of 0.1 (line 26):

sor.setLeafSize (0.1, 0.1, 0.1);

The default leaf size for the nodelet is 0.01 as seen in the config file, line 13:

gen.add ("leaf_size", double_t, 0, "The size of a leaf (on x,y,z) used for downsampling.", 0.01, 0, 1.0)

As shown in this tutorial, you can set the leaf size for the nodelet in the launch file for comparison, but to change your code to match the nodelet, try changing line 26 to:

sor.setLeafSize (0.01, 0.01, 0.01);

If that doesn't work, please post both your code and the launch file you're using for comparison.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-03-14 23:00:06 -0500

Seen: 96 times

Last updated: Mar 15