Extract straight lines from laser data

        If you want to charge back to the destination and don't want to add other sensors, you can only rely on lidar to identify the shape and positioning of the charging pile.

        Obviously, the surface of the charging pile is a flat straight line, so it is necessary to extract the straight line from so many points, and then identify which straight line is the charging pile. Extracting straight lines becomes the first step.

A better open source library on GitHub: GitHub - kam3k/laser_line_extraction: A ROS package that extracts line segments from LaserScan messages.

The effect is not bad

topics

      The subscribed topic is obviously scan, and two topics are published. We want to use /line_segments, and /line_markers are used to display on rviz and can be closed in launch.

Configuration

        The configuration list is as follows. It is basically easy to understand. I have divided it into three categories for easy understanding.

frame_id (default: "laser")  # The frame in which the line segments are published.
scan_topic (default: "scan")  # The LaserScan topic.
publish_markers (default: false) # Whether or not markers are published.

-----------------------------------------------------------------------------------------------------

bearing_std_dev (default: 0.001)  # The standard deviation of bearing uncertainty in the laser scans (rad).
least_sq_angle_thresh (default: 0.0001) # Change in angle (rad) threshold to stop iterating least squares (least_sq_radius_thresh must also be met).
least_sq_radius_thresh (default: 0.0001) # Change in radius (m) threshold to stop iterating least squares (least_sq_angle_thresh must also be met).
range_std_dev (default: 0.02) # The standard deviation of range uncertainty in the laser scans (m).

---------------------------------------------------------------------------------------------------------

max_line_gap (default: 0.4) # The maximum distance between two points in the same line (m).
min_line_length (default: 0.5) # Lines shorter than this are not published (m).
min_line_points (default: 9) # Lines with fewer points than this are not published.
min_range (default: 0.4) # Points closer than this are ignored (m).
min_split_dist (default: 0.05) # When performing "split" step of split and merge, a split between two points results when the two points are at least this far apart (m).
# 线段split的阈值,过大时很多线段被合并成一条,过小时,出现很多碎短的线段
outlier_dist (default: 0.05) # Points who are at least this distance from all their neighbours are considered outliers (m).

information

The most important thing is how to analyze the /line_segments message after we get it.
The message type is LineSegmentsList, as shown below. This is not important.

The type of each segment, LineSegment, is the most important:

The start and end are easy to understand:

  1. start and end are the starting point coordinates and end point coordinates of this line segment respectively.

  2. covariance is the 2x2 covariance matrix with respect to radius and angle  
  3. Radius and angle are difficult to understand, so we echo its message, as follows

A total of two straight lines were found in the picture above, the straight line below and the straight line on the right , which correspond to the contents of the red box and yellow box in the picture above respectively .

According to the coordinate system in ros, the front of the robot is 0 degrees, counterclockwise is positive, and the laser data is arranged from -90 to 90 degrees (my laser scanning range is 180 degrees), then the two line segments above are from the left To the right are 1,2.

In this way we can understand the meaning of radius and angle. The official explanation is the parameters in polar coordinates. What we can understand is:

Angle: The angle from the robot origin to the vertical line of the straight line. The angle is calculated using the robot as the coordinate system. The range is -PI~PI.
Radius: The distance from the robot origin to the straight line.

Then the red box corresponds to the straight line below the robot:

radius = d1 = 1.82962930202;

angle = α1 = -0.780158817768;

The yellow box corresponds to the straight line on the right side of the robot:

radius = d1 = 1.37234580517;

angle = α1 = 0.789116859436;

reference 

Guess you like

Origin blog.csdn.net/qq_34761779/article/details/129914295