SteveMacenski / slam_toolbox

Slam Toolbox for lifelong mapping and localization in potentially massive maps with ROS
GNU Lesser General Public License v2.1
1.65k stars 519 forks source link

Why slam_toolbox expect constant size of ranges ? #602

Closed oenzan closed 1 year ago

oenzan commented 1 year ago

We use YDLIDARS2PRO and it's driver cannot produce constant laser range due to Lidar cannot rotate at same frequency. Expected and supplied laser ranges can have too much difference sometimes. When i look at the code Mapper::Process(LocalizedRangeScan * pScan) return false because of LaserRangeFinder::Validate(SensorData * pSensorData) that function , Why you expect constant size of ranges array ?

SteveMacenski commented 1 year ago

Because all professional lidars do produce constant amount of data in each rotation and this work predates those cheapo YD/RP lidar's existence. We also need to raycast out the beams of each laser scan measurement so we need to have a regular spacing and starting angle to store just the measurements and produce an occupancy grid super fast and accurately. That could be updated to store the actual angle with each measurement for use, but that would be pretty invasive and not straight forward -- and assumes that the angles provided by the drivers are accurate (which I can say from experience looking at the drivers: they're not).