Rviz map not received unit 2 ros2 navigation

Hello,

I cannot load the saved map in rviz. I saw that this is a common question, but could not find any remedy. I checked the policies and the nav2_map_server.launch.py is working fine (I think). Tried to close and relaunch it with the rviz open, but also no result.

Please show me what I am missing because I can’t find it.


Hi @stefanitro ,

This is one of the issues working with ROS2 at present. I believe it will be solved in the future versions.

The way to get this working is to have the map_server start after RViz has finished launching.

You would practically start the RViz node first in your launch file, followed by the map_server node.
Make sure you set the QoS policy for Map topic correctly on RViz.

You can also schedule the start of map_server node after a delay time in the launch file using EventHandlers in the launch file.
Refer: Using event handlers — ROS 2 Documentation: Humble documentation
You can use a combination of EventHandler with OnProcessStart and TimerAction delay time to launch the map_server node after the launch of rviz node.

Regards,
Girish

Hi @girishkumar.kannan ,

Thank you for the fast reply.

I tried to launch rviz and map_server from the same launch file and also independently. None of them worked as I had the same warning in rviz. When launched from different terminals, I tried also to let the rviz running, with the /map topic selected, and relaunched the map_server.

Just to be sure that everything is working as it should be, I attached the nodes graph. Please tell me if it’s something wrong and if I could provide more informations to solve the problem.

Thank you,
Stefan

Hi @stefanitro ,

I just noticed something from your initial post. In the RViz image that you have shared, the Fixed Frame under Global Options is set to base_footprint. This is the reason why you are unable to see the map on RViz.

Set the Fixed Frame to map and you should be able to see the map.

Please let me know if this fixed your issue.

Regards,
Girish

Hi @girishkumar.kannan ,

Thank you very much, it seems that you found the issue and now it’s working fine, it still needs one or two resets.

I did not realize that this was supposed to be the frame because it wasn’t in the dropdown list. If you could, please explain to me why the map is shown only if the map frame is selected as I taught that the frame changes only the plane which is at “height 0”, like if I choose base_link or lidar frame.

Thank you again for solving the problem,
Stefan

Hi @stefanitro ,

This is obvious, the map exists only in map frame. The map data does not get propagated onto any other child frames in the TF tree, simply because the map data exists only at map frame level.
That is the reason why Global TFs like world or odom or map exists as one of the top layers in the TF tree and all other links are sub-nodes or children in the TF tree.

Map is essentially like the (partially-known) environment around the robot.
Think about navigating with Google maps for example. You look into your phone to find where you are with the help of GPS. Although you know the place around you, you do not know it completely. The things that you see immediately around you is your navigable area. Therefore, for you to navigate through the map, you need only instantaneous information from the map and not the whole map.
This is essentially why map frame acts as a global frame. The robot and its TF does not have the necessity to know where it is on the map or the map data. You acquire only the information of where the robot is on the map and then use that information for navigation.

I hope this clarifies your doubt.

Regards,
Girish

1 Like

Hi @girishkumar.kannan ,

Thank you very much for the detailed response. It’s all clear now.

Best regards,
Stefan

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.