ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to add filter to pointcloud_to_laserscan package and depthimage_to_laserscan package

asked 2022-11-04 14:55:19 -0600

distro gravatar image

I need to add filters to my pointcloud anddepthimage data before converting them to laserscan data due to noise. Seeing as there are weel knwon packages (pointcloud-to-laserscan, depthimage-to-laserscan) that do these conversions, I was thinking to modify the source code of these packages by adding a median filter for instance,in the case of depthimage. Looking at the source code of the pointcloud-to-laserscan package for instance, it's unclear where in the code I can implement the filter, if that's possible. Does anyone have experience with this? or is there an easier way about this?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2022-11-05 05:27:59 -0600

ljaniec gravatar image

What exactly do you mean by filtering here?

The whole transformation seems to happen in this callback:

So it is the place you should look into - IF it is needed. Perhaps you can achieve what you want with e.g. message_filters package (e.g. cache last N messages and publish it every second as a median etc.)?

edit flag offensive delete link more

Comments

@ljaniec I want to remove outliers that dont make sense basically. What I'm getting from message filter is it gets a bunch of different messages(stores each type of message in cache) and realeses the data for use if some conditions are met. THis isn't quite what I want. For instance a median filter in the case of depth image simply simply targets anomaly pixels and replaces them with the average value of the pixels around them.

distro gravatar image distro  ( 2022-11-06 01:35:13 -0600 )edit

So it should be a node that transforms a pointcloud (remove outliers) and feeds these transformed pointclouds to the pointcloud-to-laserscan package. Perhaps these transformations also can be done with the laserscan (so after the pointcloud-to-laserscan transformation). Modyfing the code is not necessary here, just a new nodelet.

ljaniec gravatar image ljaniec  ( 2022-11-06 05:09:36 -0600 )edit

@ljaniec you mean using packages like this?

distro gravatar image distro  ( 2022-11-06 13:54:21 -0600 )edit

Yes, pretty much. If this answer helped you, please mark & upvote it!

ljaniec gravatar image ljaniec  ( 2022-11-06 15:05:51 -0600 )edit
1

answered 2022-11-06 02:56:04 -0600

jorge gravatar image

To me it makes more sense to create another nodelet implementing the filter you propose, and chaining it in between the camera driver and pointcloud-to-laserscan or depthimage-to-laserscan. Using nodelets means that the performance won't get reduced by publishing / subscribing, and the code will be reusable for other use cases.

Indeed, I would be surprised if there aren't filters already available as open source. If not, it would make a nice contribution to https://github.com/ros-perception

edit flag offensive delete link more

Comments

@jorge I've been trying to get the laser_filter to work, how do I chain it between a cmaera driver and the other packages?

distro gravatar image distro  ( 2022-11-08 12:23:32 -0600 )edit

What I understood is that you have a noisy 3D camera and you want to filter the pointcloud or the depth images. For that, you need to find or write a filter nodelet for each case, and chain with publish-subscribe (represented as ----> here), e.g.

cam driver    ---->    point cloud filter   ---->      pointcloud-to-laserscan
cam driver    ---->    depth image filter   ---->      depthimage-to-laserscan
jorge gravatar image jorge  ( 2022-11-08 22:20:47 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2022-11-04 14:55:19 -0600

Seen: 199 times

Last updated: Nov 06 '22