Search code examples
ros2gazebo-simurviz

how to load generated map into rviz using nav2


I am trying to load full map of my world but it doesn't work. I want to move the robot to the edge of my world using nav2 -> set goal, but by default I don't see that area.

I followed a turtlebot3 guide and moved my robot across the map running ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py I saved the map with ros2 run nav2_map_server map_saver_cli -f maps/map. Now I have .yaml, .pgm files.

After that I reopened the world and saved the map with ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True map:=.../ and ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=True map:=.../

I see saved map for a second in rviz but after that I see initial map with small opened area.

I also tried to load map ros2 run nav2_map_server map_server maps/map.yaml but it stuck at creating

[INFO] [1681571612.301461524] [map_server]: Creating

Solution

  • Ended up using slam toolbox.

    1. Open Rviz.
    2. Click Panels->Add new panel, slam toolbox plugin and import/export maps.