slam_toolbox
slam_toolbox copied to clipboard
ignore measurements outside lidar range
According to the comment in sensor_msgs/LaserScan, values < range_min or > range_max should be discarded. Without this, scan matching will fail for lidars publishing 0 for invalid measurements.
Basic Info
Info | Please fill out this column |
---|---|
Primary OS tested on | Ubuntu 22.04 / ROS2 Humble |
Robotic platform tested on | My DIY robot with LeiShen Lidar |
Description of contribution in a few bullet points
- Don't add a point to UnfilteredPoingReadings when the range reading is outside lidar range.
I moved the filtration outside karto_sdk in the latest iteration. The scan matching is fixed in both the old and this version, but loop closure still doesn't seem right with my half-blocked lidar.
I placed a second lidar on top of the half-blocked one to do some comparison. Here's my robot setup:
With async slam node, the top lidar and all the default configuration, it works perfectly:
But here's the result using the bottom one:
I wrote the lidar driver myself: https://github.com/981213/ls01_ros2 and the blocked measurements are set to 0 with memset in my code.
It would be great if someone can give me some suggestions on debugging. Here's the ros2 bag for the test above. rosbag2_2023_04_04-14_16_58.zip
/scan is the half-blocked lidar and /scan2 is the one on top. The missing lidar transform:
ros2 run tf2_ros static_transform_publisher 0.03 0.0 0.1415 0 0 0 base_footprint laser_link
Fixed with the latest commit, but I'm not sure if it's the correct fix because I haven't actually understood how ScanMatcher works yet.
edit: dropped this. I should simply lower the threshold in config file instead.