Fitting a line needs the ranges in ray order with a known angular step. A costmap has neither: at 0.05 m with inflation it has already destroyed ray order and object shape, so the two 0.2 m wings of a dock plate are one blob there. This is the consumer that robot_sensor_ports keeps readings raw for. Pure geometry - the input is a scan layout and a vector of ranges, the output is segments in polar form with their endpoints, supporting rays and covariance. Eigen is the only dependency and only the merge step uses it. No robot_cpp, no costmap, no message types, which is what makes it testable against synthetic scans with no runtime around it: build the shape, generate the rays, and the answer is known in advance. Polar rather than slope-intercept because a vertical wall has no finite slope and a laser sees vertical walls constantly. Radius is kept non-negative so one line has one representation - otherwise the merge step sees two. Ported from laser_line_extraction (Marc Gallant, BSD) with the ROS layer removed, and four defects fixed, each with a test that fails without the fix: split() sliced with &indices[i_split - 1] and &indices.back(), dropping a point off each half at every split. Anything angular came out a ray short at both ends of every arm. mergeLines() called resize() and then inserted at end(), leaving the first half of the vector zero-filled. A merged line reported twice its real support and every index in that half pointed at ray 0. The least-squares loop had no iteration cap. The increment is a ratio of two sums that can both approach zero on a degenerate run, and when it oscillates the loop never exits - in a control thread that is a stopped robot, not a slow frame. Segments that will not converge are now dropped, since their covariance would be meaningless and the merge step decides by covariance. Merging compared line parameters and nothing else, so two halves of a wall either side of a doorway - perfectly collinear - were rejoined into one segment spanning the doorway, undoing the split that had just separated them for that exact reason. Merging now also requires the facing endpoints to be within max_line_gap, so split and merge agree on what one surface means. The corner point at a distance split now belongs to both halves. It is the last point of one surface and the first of the next; giving it to one side shortens the other arm by a ray and tilts its fit. split() is iterative over an explicit stack rather than recursive: depth is bounded only by the ray count, and a noisy scan that splits at nearly every point would recurse a thousand deep in the control thread. Parameters are validated at configure time rather than per scan. A threshold that can never produce a fit otherwise shows up as "the detector finds nothing", which is indistinguishable from a sensor fault.
32 lines
1.7 KiB
XML
32 lines
1.7 KiB
XML
<package>
|
|
<name>robot_line_extraction</name>
|
|
<version>0.1.0</version>
|
|
<description>
|
|
Trích đoạn thẳng từ một scan cự ly có thứ tự, bằng split-and-merge cộng khớp bình phương tối
|
|
thiểu có trọng số.
|
|
|
|
Hình học thuần: đầu vào là bố cục scan (`angle_min`, `angle_increment`, số tia) cộng một vector
|
|
`ranges`, đầu ra là các đoạn ở dạng cực (`angle`, `radius`) kèm hai đầu mút, tập tia đỡ nó và
|
|
ma trận hiệp phương sai. Không biết ROS, TF, costmap hay kiểu message nào — nên test được bằng
|
|
scan tổng hợp mà không cần dựng runtime.
|
|
|
|
Vì sao cần bản THÔ: khớp đường thẳng cần `ranges` đúng thứ tự tia kèm bước góc đã biết. Costmap
|
|
ở 0.05 m đã inflate và xoá cả hai thứ đó — hai cánh dài 0.2 m của tấm V ở trạm sạc trên lưới ấy
|
|
chỉ còn là một cục. Đây là lý do `robot_sensor_ports` giữ bản chưa lọc.
|
|
|
|
Port từ `laser_line_extraction` (Marc Gallant, BSD), bỏ toàn bộ phần ROS. Ba lỗi của bản gốc đã
|
|
được sửa và có test canh: điểm bị rơi ở mỗi lần tách, tập tia của đoạn đã gộp bị hỏng, và vòng
|
|
lặp bình phương tối thiểu không có trần.
|
|
</description>
|
|
<author>T800 Robotics</author>
|
|
<maintainer email="tdd@gmail.com">T800 Robotics</maintainer>
|
|
<license>BSD</license>
|
|
|
|
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
|
|
|
|
<!-- Eigen dùng cho phép gộp hai đoạn: nghịch đảo hiệp phương sai và khoảng cách chi-squared. -->
|
|
<build_depend>eigen</build_depend>
|
|
<run_depend>eigen</run_depend>
|
|
|
|
</package>
|