Hands on with slam_toolbox

Hands on with slam_toolbox

In the past couple of weeks, as part of a project with Robosynthesis, I’ve been exploring slam_toolbox by Steven Macenski. This post summarizes my experience so far.

Here is the description of the package taken from the project repository:

Slam Toolbox is a set of tools and capabilities for 2D SLAM built by Steve Macenski while at Simbe Robotics and in his free time. This project contains the ability to do most everything any other available SLAM library, both free and paid, and more. This includes:

  • Ordinary point-and-shoot 2D SLAM mobile robotics folks expect (start, map, save pgm file) with some nice built in utilities like saving maps
  • Continuing to refine, remap, or continue mapping a saved (serialized) pose-graph at any time
  • life-long mapping: load a saved pose-graph continue mapping in a space while also removing extraneous information from newly added scans
  • an optimization-based localization mode built on the pose-graph. Optionally run localization mode without a prior map for “lidar odometry” mode with local loop closures
  • synchronous and asynchronous modes of mapping
  • kinematic map merging (with an elastic graph manipulation merging technique in the works)
  • plugin-based optimization solvers with a new optimized Google Ceres based plugin
  • RVIZ plugin for interating with the tools
  • graph manipulation tools in RVIZ to manipulate nodes and connections during mapping
  • Map serialization and lossless data storage
  • … more but those are the highlights

Our test setup

Here are the highlights of our setup:

  • Robosynthesis differential-drive mobile robot development platform
  • RPLidar A1 (hobby grade, scanning at ~7Hz)
  • Onboard computer running ROS Melodic and slam_toolbox (commit: 9b4fa1cc83c2f)
Mobile robot
Robosynthesis development platform used for slam_toolbox evaluation

First impression

The first test we’ve run was with the default parameters that come with slam_toolbox with minor changes (frame names, and max laser range).

In ROS, as a good practice, we usually have a TF tree setup in the following way (at least as a minimum when doing SLAM):

map -> odom -> base_link

If you would like to know more about the transforms then REP-105 is your friend. Sometimes we run a competition in the office who can recite it faster!

Our expectation of slam_toolbox is to provide us with a map -> odom transform. In our tests we’ll use odom -> base_link transform from wheel odometry. Is it going to drift? Yes, it will! But slam_toolbox will have our back!

Here is a short gif showing our first test, driving the robot at a reasonable speed (at least for an indoor robot) around an office:

slam_toolbox mapping
Performing SLAM with slam_toolbox (replay with 3x rate)

And if you’d like to see some of the raw data used during the above session then you can download the bag file here.

Taking it further

What you’ve seen in this blog post are only the first trials with this SLAM package. If you take a look at the configuration files you will see that there are lots of parameters that can be tuned.

A very helpful tool that comes with slam_toolbox is the RViz plugin (Panels->Add New Panel->slam_toolbox->SlamToolboxPlugin)

Rviz plugin
slam_toolbox RViz plugin window

This blog post is only the beginning of our adventure with slam_toolbox but we’ve liked it so much that we decided to share the results with you. Stay tuned for more information about the hardware and open source that we use!

Mateusz Sadowski

Mateusz Sadowski
Mat is a Robotics consultant and the author of Build Mobile Robots with ROS 2 LiveProject series.

Remote Robotics Consulting - A Five-Year Retrospective

In this blog post, I will highlight some of the updates since my last blog and offer some advice that I hope will be useful for anyone looking to get into technical consulting. Continue reading

I Created a Project-based ROS2 Course

Published on July 05, 2022

IMUs and LiDARs - Not Uncommon Pitfalls

Published on February 24, 2022