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

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

lorenzo gravatar image

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

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 image stevemacenski  ( 2020-02-10 09:57:50 -0500 )edit

What are QoS settings?

lorenzo gravatar image lorenzo  ( 2020-02-10 10:41:44 -0500 )edit

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

lorenzo gravatar image lorenzo  ( 2020-02-11 01:54:23 -0500 )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 image stevemacenski  ( 2020-02-11 13:28:12 -0500 )edit

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

lorenzo gravatar image lorenzo  ( 2020-02-12 02:22:56 -0500 )edit

Stevemacenski, Thanks for pointing to a very generic article about QoS that was so generic to be not very helpful. and then you closed the question. How about something like the map server should have x profile or have history value of x depth value of y reliability value of x and durability value of v. Also how does Qos affect the map server not publishing the map? I could see maybe rviz2 not displaying because its not getting a map that is fresh enough. That could be a QoS issue. But the mapserver not publishing the topic at all points to something else. I repeated lorenzo's steps and then ran ros2 topic info /map and I see subscribers=1 publishers=0. that tells me mapserver is not working.

Sorry but I am a bit jaded since I saw these claims about how ros2 was so much better and ...(more)

ed gravatar image ed  ( 2020-11-26 14:23:46 -0500 )edit