How can I visualize a map on rviz2? (ros2 eloquent) [closed]

asked 2020-02-10 09:00:42 -0600

lorenzo gravatar image

updated 2020-02-11 01:59:23 -0600

I am running "nav2_map_server" togheter with "rviz2". I used the "nav2_util" to call the map_server. Following the output of the terminals.

Terminal 1:

lorenzoteo@lorenzoteo-HP-ZBook-15v-G5:~$ ros2 run nav2_util lifecycle_bringup map_server

Terminal 2:

lorenzoteo@lorenzoteo-HP-ZBook-15v-G5:~$ ros2 run rviz2 rviz2
[INFO] [rviz2]: Stereo is NOT SUPPORTED
[INFO] [rviz2]: OpenGl version: 3.1 (GLSL 1.4)
[INFO] [rviz2]: Stereo is NOT SUPPORTED

Terminal 3:

lorenzoteo@lorenzoteo-HP-ZBook-15v-G5:~$ ros2 run nav2_map_server map_server --ros-args --params-file /home/lorenzoteo/Downloads/map_server_params.yaml
[INFO] [map_server]: Creating
[INFO] [map_server]: Configuring
[INFO] [map_server]: OccGridLoader: Creating
[INFO] [map_server]: OccGridLoader: Configuring
[INFO] [map_server]: Loading yaml file: /home/lorenzoteo/Downloads/map.yaml
[INFO] [map_server]: Loading image_file: /home/lorenzoteo/Downloads/map.png
[INFO] [map_server]: Activating
[INFO] [map_server]: OccGridLoader: Activating

I have attached the rviz window setup in which I cannot see the map even if I select the map topic.

C:\fakepath\Screenshot from 2020-02-10 15-54-27.png


I found that with a configuration file (for rviz2) of a tutorial it displays the map. Why? The file could be found here:

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by stevemacenski
close date 2020-02-12 15:50:48.551593


Do you see the map topic being published before you run rviz?

If so, make sure your QoS settings are correct.

stevemacenski gravatar imagestevemacenski ( 2020-02-10 09:57:50 -0600 )edit

What are QoS settings?

lorenzo gravatar imagelorenzo ( 2020-02-10 10:41:44 -0600 )edit

Even if I run it alone it doesn't publish the topic /map. See the edit.

lorenzo gravatar imagelorenzo ( 2020-02-11 01:54:23 -0600 )edit

With your edit: again, pelase look at the QoS settings. You are required to understand QoS and their interactions as part of working with ROS2.

stevemacenski gravatar imagestevemacenski ( 2020-02-11 13:28:12 -0600 )edit

Thank you so much Steve. I read the QoS and understood

lorenzo gravatar imagelorenzo ( 2020-02-12 02:22:56 -0600 )edit