ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# RANSAC implementation for laser scans?

Hello

I would like to use RANSAC for detection straight lines from my laser scans. So my platform has a IMU, encoders and Laser. I would like to find the minimum distance to some obstacle using the laser range sensor. So in order to know if the closest point is in some wall or some high object that can detect the laser i would like to extract the straight lines. If the point is on the longest straight line than means the closest point is on the wall if not that on some other object. So i find several methods but was told that RANSAC “RANdom SAmple Consensus” methods is the robust one.Is similar as the one used in PCL but I would like to implement for laser scans. ANY help?? Any ROS/C++ code implementation of RANSAC??

Thanks

edit retag close merge delete

1

Not directly answering your question, but RANSAC for finding lines in a 2D laser scan should be relatively simple to code. I think it's one of those algorithms that's worth implementing once just to understand it better, and this is just about its simplest use case =)

( 2013-07-09 17:29:56 -0600 )edit

yes I think so , just wonted to ask here... Do I need to work with point clouds with that transform? I mean do I need to convert a Laser Scan to a Point Cloud, means to get laser scan as a set of 3D Cartesian (x,y,z) points, converting it to a point cloud message??

( 2013-07-09 17:54:37 -0600 )edit

I'd at least convert to cartesian coordinates, since I'd rather do that than work out the minimizations in polar ... however, for simplicity's sake, I might just do my own quick 2D conversion from R and theta and work in xy space, rather than xyz.

( 2013-07-09 18:00:43 -0600 )edit

So u mean to use the transformLaserScanToPointCloud to transform laser scan into a point cloud in another (preferably fixed) frame? Or projectLaser to do a straight projection from range-angle to 3D (x,y,z), without using tf?Or only 2D conversion from R and theta? Sorry for the questions

( 2013-07-09 18:10:31 -0600 )edit

How I'd do it would depend on the system it was fitting into, and my goals for writing the code in the first place ... if you have a specific question about best-practices for using those tools, I'd recommend creating an entirely new question. Otherwise, just code, and see if you can make it work =)

( 2013-07-09 18:13:38 -0600 )edit

Sort by » oldest newest most voted

There is code for this readily available in PCL.

The example given there is for planes ans spheres, but ransac for lines is also implemented. Just have a look at the PCL documentation. Besides the bare ransac, segmentation using ransac is also implemented. Just read the documentation.

Best

G.

more

RANSAC is a good approach when you have too much data to search exhaustively for things, but it's a probabilistic method and might not find the thing that you're looking for. If a randomly-selected point from your data set is likely to be part of the thing you're looking for (a wall in this case), the chances that RANSAC will find it are higher, but it's never a sure thing.

For 2d laser data, my recommendation would be to use a Hough transform. This will find the strongest straight line in your data, with probability 1.

more

I found that a RANSAC-based method could give good results for feature tracking, and not only extraction. You can help the RANSAC algorithm sample appropriate points when you look for features when you know where they are likely to be. You then only need a few iterations, sometimes even just one.

( 2013-07-10 00:16:42 -0600 )edit

I'd also not go for RANSAC, but we use a split-and-merge approach using the structured nature of a laser scan. Lines aren't arbitrary in a scan. They only appear within consecutive points that can be merged into a line as long as it fits the thresholds for a line.

( 2013-07-10 02:45:37 -0600 )edit