With ROS2 Jazzy, when I trying to run SLAM in locationzation mode, I'm getting:
serialization::Read: Failed to open requested file: /home/<user>/map/map.yaml.
DeserializePoseGraph: Failed to read file: /home/<user>/map/map.yaml.
My SLAM config:
slam_toolbox:
ros__parameters:
# Plugin params
solver_plugin: solver_plugins::CeresSolver
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
ceres_preconditioner: SCHUR_JACOBI
ceres_trust_strategy: LEVENBERG_MARQUARDT
ceres_dogleg_type: TRADITIONAL_DOGLEG
ceres_loss_function: None
# ROS Parameters
odom_frame: odom
map_frame: map
base_frame: body_link
scan_topic: /scan
use_map_saver: true
mode: localization
map_file_name: /home/<user>/map/map.yaml
map_start_pose: [0.0, 0.0, 0.0]
But the file exist and having the right mode
drwxrwxr-x 2 <user> <usergroup> 4096 Jul 4 16:39 ./
drwxrwxr-x 15 <user> <usergroup> 4096 Jul 11 01:26 ../
-rw-rw-rw- 1 <user> <usergroup> 87752 Jul 2 02:37 map.pgm
-rw-rw-rw- 1 <user> <usergroup> 159 Jul 4 16:36 map.yaml
The content of the map.yaml file:
image: "/home/<user>/map/map.pgm"
mode: trinary
resolution: 0.1
origin: [-19.2, -11.2, 0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.25
I spent multiple hours trying to figure it out, without any success.
Does someone have any idea?
-
If you want to do localization with slam toolbox itself you need to serialize the map instead of saving it (saving is for external plugins/programs) This should generate a .data file and a .posegraph file Like this: ros2 service call /slam_toolbox/serialize_map slam_toolbox/srv/SerializePoseGraph "{filename: 'test_mapi'}"lolboer9999999– lolboer99999992025年07月24日 10:23:07 +00:00Commented Jul 24, 2025 at 10:23
1 Answer 1
First of all, as in the comment above, you need to serialize the map. You can do it this way:
- Open RViz2 with launched slam_toolbox.
- Select above "Panels > Add New Panel" and add SlamToolboxPlugin.
- In the opened plugin window, to the right of the "Serialize card" button, write the filename. You can leave the name "map".
- Click "Serialize Map". As a result, files with extensions ".data" and ".posegraph" will be saved in your working directory.
After that you need to specify the path to these files without the file extension, only the file name.
In your case:
map_file_name: /home/<user>/map/map
Sign up to request clarification or add additional context in comments.