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

ROS2 slam toolbox localization mode config example

asked 2020-05-19 06:19:13 -0600

RodBelaFarin gravatar image

I could not find an example .yaml config file on how to run slam toolbox in localization mode with a pre-generated map.

I tried a lot of different ways. I ended up with the following file:

# ROS Parameters
odom_frame: odom
map_frame: map
base_frame: base_footprint
scan_topic: /scan
mode: localization #mapping 

# if you'd like to start localizing on bringup in a map and pose
map_file_name: map_1589815244.yaml
#map_start_pose: [5.0, 1.0, 0.0]

I put the .yaml and the .pgm file in a folder named _maps_ inside my slam toolbox package. I also added this folder as install directory in my CMakeLists.txt

Nevertheless, if I am starting Slam Toolbox with this configuration, it creates a new map instead of loading the "old" map.

I am using ROS2 Eloquent in Ubuntu 18.04

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2020-05-19 12:44:05 -0600

Those aren't valid serialized maps. A valid serialized map files will be .posegraph and .data. This localization mode is exclusive to maps that have been serialized to retain the entire state of the slam session (data, graph constraints, laser properties, etc).

Your issue appears to be try to load a yaml file of a map saved through a map server. This isn't a localization mode built to operate on map _images_, rather than map sesssions themselves. Please review this ROSCon talk where I try to make it very clear that a map is not an image, its a globally consistent representation of the environment and we work with that data for our method.

edit flag offensive delete link more

Comments

Just to add on, after getting .posegraph and .data. Rename them to test.posegraph and test.data and then in the map_file_name add the file to just 'test'. eg. /path/file/test

root-robot gravatar image root-robot  ( 2021-09-13 03:32:04 -0600 )edit
0

answered 2022-11-27 08:26:10 -0600

As @stevemacenski said you will need a valid serialized map to be able to use SLAM Toolbox in localization mode.

You can use the Ogm2Pgbm package to the conversion from a .pgm file to a .posegraph map.

Additionally, if you wanna run the tool in a separate docker container you can follow the instuctions in the readme, considering reserving memory space for the container.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-05-19 06:19:13 -0600

Seen: 2,454 times

Last updated: Nov 27 '22