ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

how to load a map in rviz

asked 2020-03-21 07:41:50 -0500

sinou00 gravatar image

updated 2021-06-02 22:49:45 -0500

jayess gravatar image

hello, I loaded a map in gazebo but in rviz i dont have the same. So how can i load my map in rviz? i am working in ubuntu. thanks in advance for youre answers

edit retag flag offensive close merge delete

Comments

Gazebo is a simulator, rviz a visualization software. In rviz you only get the data the robot perceives (sensors) or has in its databse. You need to SLAM/map the gazebo world to make its robot perception equivalent available in rviz. So the robot needs to "scan" the gazebo world, translate it into some kind of map format, and publish it (via a map server in many cases). Most of the time this is done via SLAM, and after that, the generated map is used for navigation. There are also possibilities to SLAM and navigate at once, but that is more advanced.

Dragonslayer gravatar image Dragonslayer  ( 2020-03-21 11:04:04 -0500 )edit

thank you. I already have a generated map i just want to be shown in rviz

sinou00 gravatar image sinou00  ( 2020-03-22 07:26:23 -0500 )edit

if it is a .yaml file format (which will also have .pgm beside it) u can go into the file directory folder and then do rosrun map_server map_server NAME_OF_FILE.yaml

AK3874 gravatar image AK3874  ( 2020-03-22 15:28:13 -0500 )edit

ak3847 is correct. However, as with that setup your ready for navigation anyway, you might want to check out the different localization nodes, which include map_server functionality themselfs. ros_rtabmap for example is used for mapping, which you have already done, and can then be switched to localization mode. But even in slam mode it serves the building map to rviz and in localization mode as well. If you used gmapping to build the map, I think you could use amcl to provide the map via map_server and it will as well localize. Usually mapping is done to be able to use pathplanning and localization for navigation.

Dragonslayer gravatar image Dragonslayer  ( 2020-03-25 12:24:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-06-02 09:37:53 -0500

AlexandrosNic gravatar image

Old question but just for future reference I will reply as I perceive the question.

To add map in rviz you simply click the "Add" button on the left panel of rviz. Then the easiest way is to choose "By topic" and scroll until you find the map topic you want to visualize. This will be either the /map or /move_base/global_costmap/costmap and /move_base/local_costmap/costmap.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2020-03-21 07:41:50 -0500

Seen: 7,190 times

Last updated: Jun 02 '21