iralabdisco / ira_laser_tools

All laser type assemblers and manipulators.
BSD 3-Clause "New" or "Revised" License
198 stars 215 forks source link

slam_toolbox can't build a map using multi-laser output data #51

Open Gavriel-CTO opened 1 year ago

Gavriel-CTO commented 1 year ago

Steps to reproduce issue

Additional information

gavriel@gavriel-cto:~$ rostopic info scan
Type: sensor_msgs/LaserScan

Publishers: 
 * /laserscan_multi_merger (http://gavriel-cto:45153/)

Subscribers: 
 * /slam_gmapping (http://gavriel-cto:38545/)
 * /rviz (http://gavriel-cto:34577/)
 * /move_base (http://gavriel-cto:33081/)

gavriel@gavriel-cto:~$ rostopic echo scan
header: 
  seq: 799
  stamp: 
    secs: 30
    nsecs: 604000000
  frame_id: "top_plate_link"
angle_min: -2.359999895095825
angle_max: 2.359999895095825
angle_increment: 0.005799999926239252
time_increment: 0.0
scan_time: 0.03333333134651184
range_min: 0.44999998807907104
range_max: 25.0
ranges: [26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 0.8889434337615967, 0.8728505373001099, 0.8596974015235901, 0.8484830856323242, 0.8399553894996643, 0.8299886584281921, 0.8189652562141418, 0.8121286034584045, 0.8028361201286316, 0.788140594959259, 0.7761656045913696, 26.0, 0.7607190608978271, 0.7575971484184265, 0.7574251890182495, 0.760523796081543, 0.7642761468887329, 0.7662544846534729, 0.7680457830429077, 0.7700027823448181, 0.7723833918571472, 0.7749064564704895, 0.776307225227356, 0.7796602249145508, 0.7844770550727844, 0.7876943945884705, 0.787937343120575, 0.7914657592773438, 0.7960071563720703, 0.7977455258369446, 0.7995938062667847, 0.8057575821876526, 0.8081259727478027, 0.8110975623130798, 0.8128832578659058, 0.8160967826843262, 0.8201541900634766, 0.8233633041381836, 0.8281881809234619, 0.8312384486198425, 0.833400309085846, 0.8355249166488647, 0.8396785855293274, 0.8437479734420776, 0.8449754118919373, 0.8526577949523926, 0.8558814525604248, 0.8587668538093567, 0.863347053527832, 0.8652997016906738, 0.8738859295845032, 0.8787156939506531, 0.878123939037323, 0.883574366569519, 0.8874945044517517, 0.8959623575210571, 0.8984680771827698, 0.902416467666626, 0.9065732955932617, 0.9102147221565247, 0.9170271158218384, 0.9226657152175903, 0.9266858100891113, 0.9311148524284363, 0.9349843263626099, 0.942914605140686, 0.9472222924232483, 0.9536519646644592, 0.9577603340148926, 0.9670928120613098, 0.9724058508872986, 0.9763233661651611, 0.9825613498687744, 0.9861704707145691, 0.9959887862205505, 1.0021259784698486, 1.0079954862594604, 1.0127421617507935, 1.022729754447937, 1.0285512208938599, 1.0342217683792114, 1.0406920909881592, 1.04509437084198, 1.0573290586471558, 1.0670053958892822, 1.071596622467041, 1.0767006874084473, 1.0893694162368774, 1.096360206604004, 1.1027103662490845, 1.110400676727295, 1.1151387691497803, 1.1309458017349243, 1.1380538940429688, 1.1443703174591064, 1.1527687311172485, 1.1695666313171387, 1.174713134765625, 1.184895634651184, 1.192954659461975, 1.2019850015640259, 1.218860149383545, 1.2282124757766724, 1.2372404336929321, 1.2462608814239502, 1.2539896965026855, 1.2750262022018433, 1.2855585813522339, 1.2943938970565796, 1.3028393983840942, 1.3145619630813599, 1.3375927209854126, 1.3470854759216309, 1.3611592054367065, 1.371753454208374, 1.384572982788086, 1.4103001356124878, 1.4205924272537231, 1.4360047578811646, 1.4486364126205444, 1.4611417055130005, 1.490140676498413, 1.505947470664978, 1.5208489894866943, 1.5360971689224243, 1.5504603385925293, 1.567594051361084, 1.5842443704605103, 1.6199878454208374, 1.637354850769043, 1.6557413339614868, 1.6756746768951416, 1.6957688331604004, 1.716138482093811, 1.7363518476486206, 1.7783459424972534, 1.8029897212982178, 1.8265310525894165, 1.8503828048706055, 1.876444935798645, 1.900362491607666, 1.9273090362548828, 1.9532904624938965, 2.013645648956299, 2.0453665256500244, 2.0756068229675293, 2.108285665512085, 2.1431665420532227, 2.1777093410491943, 2.2108874320983887, 2.2519917488098145, 2.291315793991089, 2.3314297199249268, 2.3758554458618164, 2.4196720123291016, 2.513453960418701, 2.5629920959472656, 2.6178934574127197, 2.673447847366333, 2.729774236679077, 2.793353319168091, 2.8571436405181885, 2.9245121479034424, 2.996345043182373, 3.0746309757232666, 3.152695417404175, 3.2363128662109375, 3.3261053562164307, 3.420165777206421, 3.5215048789978027, 3.6311161518096924, 3.745979070663452, 3.870558500289917, 4.000850200653076, 4.146318435668945, 4.297867774963379, 4.462414264678955, 4.643709182739258, 4.845107078552246, 5.057750701904297, 5.295043468475342, 5.555423736572266, 5.845219612121582, 6.169299602508545, 6.531850814819336, 6.942105770111084, 26.0, 7.3741326332092285, 7.37183952331543, 7.365645408630371, 7.36276388168335, 7.361029624938965, 7.356813430786133, 7.35439920425415, 7.35115385055542, 7.350854873657227, 7.349593162536621, 7.348794460296631, 26.0, 7.345027446746826, 7.3458099365234375, 7.345302104949951, 7.3448004722595215, 7.3444905281066895, 7.343169212341309, 7.345750331878662, 7.3454132080078125, 7.347197532653809, 7.347904682159424, 26.0, 7.352084159851074, 7.352281093597412, 7.3572492599487305, 7.358049392700195, 7.361382007598877, 7.364761829376221, 7.368617534637451, 7.371425628662109, 7.376087188720703, 7.381535053253174, 7.385735988616943, 26.0, 7.391486167907715, 7.395849704742432, 7.401980876922607, 7.407465934753418, 7.414839267730713, 7.421496868133545, 7.4277825355529785, 7.435358047485352, 7.443558216094971, 7.451615333557129, 26.0, 7.4608154296875, 7.467899322509766, 7.476623058319092, 7.483972072601318, 7.4955339431762695, 7.507135391235352, 7.515416622161865, 7.526758193969727, 7.536526203155518, 7.548981189727783, 26.0, 7.559510707855225, 7.572847843170166, 7.5845255851745605, 7.595062255859375, 7.610170841217041, 7.623710632324219, 7.638037204742432, 7.651139259338379, 7.667383670806885, 7.681463718414307, 26.0, 7.6963348388671875, 7.71235466003418, 7.727313995361328, 7.745697498321533, 7.762416839599609, 7.777956485748291, 7.796645641326904, 7.81321907043457, 7.83225154876709, 7.853155136108398, 26.0, 7.869750499725342, 7.891319751739502, 7.911050319671631, 7.930513381958008, 7.951352119445801, 7.972161293029785, 7.994212627410889, 8.01665210723877, 8.040428161621094, 26.0, 8.06250286102295, 8.086291313171387, 8.111668586730957, 8.134875297546387, 8.159875869750977, 8.18676471710205, 8.211165428161621, 8.238286972045898, 8.26617431640625, 26.0, 8.294144630432129, 8.321702003479004, 8.352011680603027, 8.382037162780762, 8.40909481048584, 8.441547393798828, 8.473420143127441, 8.505228996276855, 8.53646183013916, 26.0, 8.568779945373535, 8.603157043457031, 8.637289047241211, 8.670641899108887, 8.707594871520996, 8.744729995727539, 8.782062530517578, 8.817867279052734, 8.857707977294922, 26.0, 8.896562576293945, 8.937758445739746, 8.977327346801758, 9.018861770629883, 9.060942649841309, 9.10495662689209, 9.146082878112793, 9.191726684570312, 26.0, 9.238192558288574, 9.284586906433105, 9.330262184143066, 9.379110336303711, 9.427470207214355, 9.477866172790527, 9.526871681213379, 9.580082893371582, 26.0, 9.545295715332031, 9.476091384887695, 9.407978057861328, 9.338632583618164, 9.271072387695312, 9.206778526306152, 9.14474105834961, 9.08140754699707, 9.019721031188965, 8.959413528442383, 8.902326583862305, 26.0, 8.842764854431152, 8.785682678222656, 8.731610298156738, 8.679024696350098, 8.622869491577148, 8.569963455200195, 8.514482498168945, 8.459683418273926, 8.405550003051758, 8.368152618408203, 8.322879791259766, 8.301786422729492, 8.253820419311523, 8.205485343933105, 8.156810760498047, 8.107983589172363, 8.0934419631958, 8.049243927001953, 8.007635116577148, 7.9666428565979, 7.92621374130249, 7.885307312011719, 7.845414638519287, 7.844087600708008, 7.801971435546875, 7.760900497436523, 7.7217698097229, 7.682403087615967, 7.64506721496582, 7.625537872314453, 7.589714050292969, 7.557106971740723, 7.52278470993042, 7.490432262420654, 7.458662986755371, 7.431118965148926, 7.424729347229004, 7.395886421203613, 7.362374782562256, 7.332522869110107, 7.3018035888671875, 7.270868301391602, 7.238681793212891, 7.21950626373291, 7.193066596984863, 7.165719509124756, 7.136837959289551, 7.126297950744629, 7.096619606018066, 7.069312572479248, 7.062407493591309, 7.033790111541748, 7.014214992523193, 6.989625930786133, 6.966914176940918, 6.942140102386475, 6.920390605926514, 6.8988471031188965, 26.0, 6.876871585845947, 6.854771137237549, 6.835156440734863, 6.812829494476318, 6.794553279876709, 6.774613380432129, 6.753663539886475, 6.736555576324463, 6.716184616088867, 6.697796821594238, 26.0, 6.681095600128174, 6.664041042327881, 6.646238327026367, 1.3421621322631836, 1.3390880823135376, 1.334984302520752, 1.331992506980896, 1.330308198928833, 1.3279088735580444, 1.3253555297851562, 1.3228093385696411, 1.3192646503448486, 1.3156324625015259, 1.3132387399673462, 1.3122658729553223, 6.468549728393555, 1.3091906309127808, 1.3061877489089966, 1.303786277770996, 1.3026549816131592, 1.2999067306518555, 1.2978415489196777, 1.3189510107040405, 1.364598274230957, 1.3858671188354492, 1.4127569198608398, 1.4640551805496216, 1.4889886379241943, 1.5158275365829468, 1.5770149230957031, 1.6061642169952393, 1.639378309249878, 1.708664059638977, 1.7450180053710938, 1.7827385663986206, 1.8624666929244995, 1.9054317474365234, 1.9967564344406128, 2.0465621948242188, 2.096992254257202, 2.208771228790283, 2.2650442123413086, 2.38444185256958, 2.4661874771118164, 2.5409367084503174, 2.704402446746826, 2.7942068576812744, 2.9901933670043945, 3.1018242835998535, 3.2169957160949707, 3.4826607704162598, 3.6295409202575684, 3.967524528503418, 4.161223888397217, 4.608726978302002, 4.870730876922607, 5.164175987243652, 5.873355388641357, 6.302819728851318, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0, 26.0]
intensities: []
IvanVN commented 1 year ago

Not sure if it was the same problem I was having (I'm in a ROS2 fork) but in my case it was not working because there was a difference in the expected size of the ranges[] vector between ira_laser_tools and slam_toolbox.

My workaround was simply adding 1 to the calculated ranges_size in this line, from:

uint32_t ranges_size = std::ceil((output->angle_max - output->angle_min) / output->angle_increment); to

uint32_t ranges_size = std::ceil((output->angle_max - output->angle_min) / output->angle_increment) + 1;

maker-ATOM commented 6 months ago

Decreasing by 1 worked for me as I received, LaserRangeScan contains 1084 range readings, expected 1083 while using slamtoolbox to generate the map.