0
$\begingroup$

Rosanswers logo

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


Originally posted by Astronaut on ROS Answers with karma: 330 on 2013-07-09

Post score: 1


Original comments

Comment by lindzey on 2013-07-09:
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 =)

Comment by Astronaut on 2013-07-09:
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??

Comment by lindzey on 2013-07-09:
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.

Comment by Astronaut on 2013-07-09:
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

Comment by lindzey on 2013-07-09:
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 =)

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

There is code for this readily available in PCL.

http://pointclouds.org/documentation/tutorials/random_sample_consensus.php

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.


Originally posted by Georg with karma: 328 on 2013-07-18

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.


Originally posted by Bill Smart with karma: 1263 on 2013-07-09

This answer was NOT ACCEPTED on the original site

Post score: 4


Original comments

Comment by po1 on 2013-07-10:
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.

Comment by dornhege on 2013-07-10:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.