ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to use multiple laser scanners for slam and navigation

asked 2021-11-23 16:00:18 -0500

Darkproduct gravatar image

updated 2021-11-23 17:30:32 -0500

Hi, we have multiple Robots on ROS2 Foxy and we would like to use Navigation2 with the slam_toolbox.

Almost all of our robots have two laser scanners which seems to be not supported anywhere with the exception of cartographer, which is poorly supported on ROS2. I don't really understand the reason behind this, because this is a common issue.

I found this where the developer of the slam_toolbox states:

There is no support for multi-laser configs. Try a laser scan assembler.

I found laser_assembler which has a ROS2 branch, but the last commit is from 2018 and the code base is 9 years old. The documentation states that this package will consume multiple LaserScan messages and output one PointCloud which is not an acceptable input format for the slam_toolbox.

There is also the ira_laser_tools package which does the same, but is currently not available for ROS2. But this package can output a merged_scan message, which is a LaserScan message including a best fit for all other scans. This is created from the merged PointCloud.

Currently, I think all solutions I found are bad and there are several reasons:

  1. Converting everything to one PointCloud and then creating a new LaserScan is slow and has some other problems:
    • Time: All messages have a time stamp, which is critical for SLAM, and now all of those are lumped into one. This should degrade the SLAM performance.
    • The new merged LaserScan is only a best fit. It is not possible to merge two LaserScan messages from different frames into one new message without data loss.
  2. I think it weird that this is not supported by the slam_toolbox, because they even support cloud mapping from multiple robots. I mean two scanners on one robot isn't that different. The only difference there is the tf tree.

What do you think is the best solution for this? Should we make an effort to port the ira_laser_tools package to ROS2 or, what is in my opinion the better option, accept multiple LaserScan topics (slam_toolbox, nav2, ...).

Edit: Yes, it is not hard to merge scans together, but that is not my question. Please state what you think is the better solution and why. Please respond to the arguments listed above.

PS: The laser scanners are aligned to one plane, so this is still 2D SLAM.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2021-11-23 22:59:22 -0500

You are right that it is not impossibly hard, in fact I started this effort back in 2019 on this branch However, I ran out of time while working on a few issues in it and never was able to complete it. Since I didn't have a particular need at the time for it, this work was dropped and no one has expressed significant enough interest in picking it back up again.

The issues were definitely solvable, I just never quite got to the root of them. I have some comments in the branch about what I was doing at the time (meant for my personal consumption, never meant to be read by others but happy to clarify to the best of my memory). I believe if memory serves it was related to loop closures and the optimizer, potentially frames, where the graphs generated by different sensors were not merging or matching together correctly and causing offsets / failures.

I'd be happy to have your help if this is something you require and would be open to contributing back. Happy to help answer any questions I can. The ticket is here for the task:

edit flag offensive delete link more


This would be great. I'll have a look at that branch as soon as possible. Unfortunately, there are currently other projects that require my time, but I'll comment on that branch as soon as I got back to this.

Darkproduct gravatar image Darkproduct  ( 2021-12-05 08:18:48 -0500 )edit

answered 2021-11-24 01:36:22 -0500

Staredeath gravatar image

updated 2021-11-24 01:41:41 -0500

You can use laser scan merger in ros2. It can help you merge 2 laser scan to 1 laser scan. Here is link text about this. It worked on my project !!!

edit flag offensive delete link more


Yes, I know that this package exists. I've included ira_laser_tools already in my question and yes, I know that this unofficial port to ROS2 exists as well. There is currently a big issue on GitHub to port this package to ROS2 Foxy.

Darkproduct gravatar image Darkproduct  ( 2021-11-24 12:15:04 -0500 )edit

Here is package which ported to ROS2 Foxy and it worked for my project in ROS2 Foxy. Can you try it ???

Staredeath gravatar image Staredeath  ( 2021-11-25 01:41:29 -0500 )edit

Are you Vietnamese ???

Staredeath gravatar image Staredeath  ( 2021-11-25 01:42:44 -0500 )edit

answered 2021-11-23 17:02:18 -0500

Geoff gravatar image

If your laser scanners are aligned in one plane, then I think the simplest solution would be to write your own laser scan assembler. It would be trivial to write. Or you could modify the existing laser_assembler to output a LaserScan message, but I don't know if that requires adding an assumption of co-planar lasers that it doesn't currently have.

edit flag offensive delete link more


It's trivial for a best fit solution, but it is not possible to merge two LaserScan messages from different frames into one new frame, because the msg is not capable of a dynamic step size for the angle. And then there is the issue with the time stamps again. The best solution would be to average all time stamps used for the new message, but there is still a loss of data.

Darkproduct gravatar image Darkproduct  ( 2021-11-23 17:04:17 -0500 )edit

Question Tools



Asked: 2021-11-23 16:00:18 -0500

Seen: 1,304 times

Last updated: Nov 24 '21