0
$\begingroup$

I am currently comparing different localization methods for nav2 on my ROS2-humble workspace. Right now, I'm trying to integrate slam_toolbox's localization_launch.py with nav2. I've generated .posegraph files for my map and have tried setting mode: localization and map_file_name:/path/to/file/filename (I've tried entering both the .posegraph and .data, and .yaml filenames) in my mapper_params_localization.yaml file, but it does not seem to work as RVIZ still shows me a fresh map each time.

I feel like I've hit a brick wall and am unsure of how to proceed. I'd greatly appreciate any help on this.

$\endgroup$

2 Answers 2

0
$\begingroup$

SLAM Toolbox localization uses a serialized pose-graph from a SLAM Toolbox mapping session, you cannot use pre-rastered maps with it and should not be loading or serving a map yaml when using it.

$\endgroup$
3
  • $\begingroup$ continuing from my previous reply, I also tried generating the serialized posegraph using online async launch mode and tried deserializing it when running localization launch but I get this error, [localization_slam_toolbox_node-1] [ERROR] [1711459328.431704839] [slam_toolbox]: Requested a non-localization deserialization in localization mode. $\endgroup$ Commented Mar 26 at 13:23
  • $\begingroup$ You have to serialize your map from your mapping session. $\endgroup$ Commented Mar 26 at 18:57
  • $\begingroup$ I tried serializing my map from the localization launch session like you've said but I get this error [localization_slam_toolbox_node-1] [ERROR] [1711365801.527196557] [slam_toolbox]: LocalizationSlamToolbox: Cannot call serialize map in localization mode!. Is the localization launch mode not designed for this? If so, could you please tell me the intended way to use the localization launch file? $\endgroup$ Commented Apr 1 at 7:21
0
$\begingroup$

have you found any solution? As I am stuck with the same problem and I am not able to load my map.

I am using ros2-humble, slam_toolbox, (mode:localization) and I am trying to load the map using the parameter file (map_file_name:/path/to/file/filename).

I know I have to use the serialized map and that I need to write the path without the extension, .data or .posegraph.

But the map does not load and rviz starts with a fresh map instead of starting with the map I am trying to pass through the params_file. The funny thing is that the slam_toolbox node does not give me any error when trying to load the params_file.

Edit: I found the answer to my doubt and I hope this will help you so I am going to leave the question and the answer

When trying to launch the slam_toolbox I used: ros2 launch slam_toolbox online_async_launch.py slam_params_file:=/path/to/customized/params/file use_sim_time:=true

note that the params file argument is (slam_params_file) my problem was that I was using (params_file) as I followed other tutorials in which they used foxy (I think that was the main difference) so make sure you use the right keyword when assigning the path to your paramas file.

$\endgroup$
2
  • $\begingroup$ Hi Marq and welcome. You might want to edit your answer and reframe the post as a statement (rather than a question) of your situation/issue and that you have the solution. I only say that because questions aren't really allowed in the answer section of Stack Exchange, and so your answer might be flagged as a follow up question, rather than a solution. Hopefully that makes sense.. $\endgroup$ Commented Apr 23 at 17:42
  • $\begingroup$ Hi Marq, Slam Toolbox provides multiple launch files such as online_async_launch.py which work as intended when you run the command you've mentioned. However, they've also provide a localization_launch.py file and this causes the problem that I've mentioned in my post and in my replies to Steve. I apologize for the lack of clarity in my initial post. $\endgroup$ Commented Apr 29 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.