Rosanswers logo

I have a custom model which I created from my xacro files and I can move around using a teleop node. BUT I now want to map a virtual room and I added the AMCL and Gmapping nodes to my launch file but I notice a number of things in Rziv which are definately NOT right :

  1. The occupancy grid is not visible in Rviz so the room is not being mapped
  2. The /map topic has no data published into it
  3. 2D pose estimates in Rviz does not show particle filters

The following is my launch file:

<?xml version="1.0"?>

    <!-- PARAMETERS -->
    <param name="robot_description" command="$(find xacro)/xacro $(find sweep_bot)/urdf/cleaner.xacro"/>

    <!-- RVIZ -->
    <node name='robot_state_publisher' pkg='robot_state_publisher' type='robot_state_publisher'/>
    <node name='joint_state_publisher_gui' pkg='joint_state_publisher_gui' type='joint_state_publisher_gui'/>
    <node name='rviz' pkg='rviz' type='rviz'/>

    <!-- GAZEBO -->
    <include file="$(find gazebo_ros)/launch/willowgarage_world.launch"></include>
    <node name='sweeper_bot' pkg='gazebo_ros' type='spawn_model' args='-urdf -model sweeper -param robot_description'/>

    <!--- Run AMCL --> 
    <include file="$(find amcl)/examples/amcl_omni.launch" />

    <!-- GMAPPING -->
    <node pkg="gmapping" type="slam_gmapping" name="gmapping" output="screen"></node>

    <!-- Move Base -->
    <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen"/>


My /tf and /odom topics show data is being published into them.

My terminal prints the following message repeatedly:

[ WARN] [1612313212.923369324, 5.005000000]: Timed out waiting for transform from base_link to map to become available before running costmap, tf error: canTransform: source_frame base_link does not exist.. canTransform returned after 0.1 timeout was 0.1.

image description As shown in the image above, rviz shows the laser detects obstacles but the occupancy grid does not display.

My questions :

  • I know my /tf is generated from joints as defined in my urdf file(s) but is the data in the /odom topic also auto generated from the urdf ?

  • Can anyone give me any insight into why my /map topic is empty ?


Below is the tf : image description

Originally posted by sisko on ROS Answers with karma: 247 on 2021-02-02

Post score: 1

Original comments

Comment by Delb on 2021-02-02:
First AMCL is for localization when you already know the map and gmapping is for localization while creating the map so they shouldn't be used at the same time. You should try to create the map first using only gmapping and then use AMCL with the map you've created.

Now you might have something wrong with your TFs, can you show us your tf tree ? (Using rosrun rqt_tf_tree rqt_tf_tree)

Comment by sisko on 2021-02-02:
@Delb: Thanks for your input. I added my tf tree as requested.


2 Answers 2


Rosanswers logo

/odom topics are not automatically generated by urdf. For example, you need to use diff_drive_controller to generate /odom topics from urdf.

Also, even if you can generate an /odom topic, it may not create a map.

Even if you can generate an /odom topic, the map may not be created, because amcl and gmapping are not usually handled at the same time. amcl is a package that uses /map and /scan for localization. gmapping is a package that uses /scan to localize while issuing /map.

  1. Generate /map by running gmappingwithout using amcl.
  2. Save it with map_saver.
  3. Read the saved map with map_server and publish a /map topic.
  4. Localization with amcl.

You can probably get what you want by proceeding as follows.

Originally posted by miura with karma: 1908 on 2021-02-02

This answer was NOT ACCEPTED on the original site

Post score: 1

Original comments

Comment by sisko on 2021-02-02:
I appreciate your comments. There is a lot I don't know so please bare with me.

The AMCL node in the launch file is commented out of my current build BUT I still find the occupancy grid does not display in Rviz.

Also, isn't the diff_drive_controller meant for a two wheeled robot ? My robot is four wheeled.

I added my tf tree above if that would help clarify things.

Comment by miura on 2021-02-04:
I'm glad to hear that it has been resolved. diff_drive_controller seems to be a node for motorcycles. ( I've only used it on two wheels. ) However, there seems to be a way to use it on four wheels.

Comment by sisko on 2021-02-04:
@Miura: Thank you for your input. I've only ever hear of the diff_drive_controller used on robots like the turtlebot 3 in a side-by-side configuration. It would be interesting to see if it can be used for motocycles.


Rosanswers logo

I figured it out.

The GMapping node was missing configuration parameters which would tell it agongst other things, what topic to publish map data to. See below :

<node pkg="gmapping" type="slam_gmapping" name="gmapping" output="screen">
   <param name="map_frame" value="map"/>
   <param name="base_frame" value="chasis"/> 
   <param name="odom_frame" value="odom"/> 

All available parameters are listed at http://wiki.ros.org/gmapping.

Originally posted by sisko with karma: 247 on 2021-02-03

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.