ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

how to start a map

asked 2021-03-31 12:28:18 -0500

harish556 gravatar image

updated 2021-03-31 12:32:11 -0500

i want to add a map node to my robot but I don't where to put it, this is my launch file

<?xml version="1.0"?>
<include file="$(find gazebo_ros)/launch/willowgarage_world.launch">
  <param name="robot_description" command="cat '$(find robot)/urdf/robot.xacro'"/>

  <arg name="x" default="0"/>
  <arg name="y" default="0"/>
  <arg name="z" default="0.5"/>

  <node name="robot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
      args="-urdf -param robot_description -model robot -x $(arg x) -y $(arg y) -z $(arg z)" />

<!-- send fake joint values -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
  <param name="use_gui" value="False"/>

<!-- Combine joint values -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
<!-- Show in Rviz   -->
<node name="rviz" pkg="rviz" type="rviz" />


when I start a rviz and add map I get the message "No map received" what should I do now?

and when use

rostopic list

I am getting these topics

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2021-04-02 04:40:09 -0500

Roberto Z. gravatar image

If you already have a map in YAML format and as an PGM file (or other compatible format) you need to run map_server to publish the map on a ros topic.

To add it to your launch file include this:

<node name="map_server" pkg="map_server" type="map_server" args="$(find your_package_name)/map/your_map_name.yaml"/>
edit flag offensive delete link more


I don't have a YAML file. how should I create one?

harish556 gravatar image harish556  ( 2021-04-02 09:18:42 -0500 )edit

See @tryan 's answer on how to create a map.

Roberto Z. gravatar image Roberto Z.  ( 2021-04-03 03:49:15 -0500 )edit

answered 2021-04-02 10:00:18 -0500

tryan gravatar image

updated 2021-04-02 10:12:49 -0500

There are many SLAM packages and tutorials for how to use them. I suggest following one of those to start. Here are a couple examples to get you going, but some quick searching will turn up others:

  1. gmapping
  2. hector_slam

Here's a good resource for simulation and SLAM with a turtlebot. If you successfully complete the tutorial(s) and inspect the files, you should be able to transfer that knowledge to your own robot, but if you run into issues, feel free to post a new question.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-03-31 12:28:18 -0500

Seen: 129 times

Last updated: Apr 02 '21