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

Trying to a build a map from sensor data (Gmapping)

asked 2016-07-27 10:09:32 -0600

patrchri gravatar image


I am using ROS Kinetic and I am trying to use a hokuyo laser sensor to a build a map from. I have seen the gmapping package, but I have some questions regarding this. As I understand:

  1. I will use the messages (Type: sensor_msgs/LaserScan) from the /my_robot/laser/scan topic.
  2. I need to use the required tf for that. Could someone explain to me what does this mean ? Should I add the tf at my URDF code or follow this tutorial?
  3. After that I will rosrun gmapping slam_gmapping and from the data I will get from the sensor, I will build a map at nav_msgs/OccupancyGrid .
  4. I will visualize the map on rviz, after adding by topic /map.

Have I understood correctly the sequence of steps I need to follow to complete the building of the map or I am missing something?

edit retag flag offensive close merge delete


What did you use to as a driver for your laser? I used urg_node on ros indigo but that package is not available yet on kinetic?

angryhippo gravatar image angryhippo  ( 2016-09-28 12:41:34 -0600 )edit

I wasn't using the actual sensor when I did the question, but a urdf model of the sensor. Now I am using the rplidar, which has a relevant package regarding the driver of the sensor. For your case, I would suggest trying to find a node for your sensor type.

patrchri gravatar image patrchri  ( 2016-09-28 14:46:31 -0600 )edit

I cannot help you further, because in real life I am not using a hokuyo sensor, but if you search it, I don't believe you will meet an issue about the driver.

Good luck !:)

patrchri gravatar image patrchri  ( 2016-09-28 14:47:59 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-27 11:59:25 -0600

More or less. Gmapping subscribes to the /scan topic, so you will need to remap /my_robot/laser/scan to /scan or vice versa.

For the tf, you need a transform from the laser sensor to the robot base. You can add the sensor to the URDF model if you want a visualization of it in RVIZ or you can use a static transform publisher.

Gmapping requires an odometry source. You don't state if you have one or not so I figured I would just point it out.

edit flag offensive delete link more


My frames from the frames_viewer can be seen here .As you can see my tf tree consists of only /odom->/base_footprint So I would need this tutorial to continue with the static transform publisher ?

patrchri gravatar image patrchri  ( 2016-07-28 10:06:25 -0600 )edit

You can follow that tutorial if you want to build your own transform broadcaster. As you only need a single link for this at the moment, you can also use the tf static_transform_publisher

Icehawk101 gravatar image Icehawk101  ( 2016-07-28 10:42:36 -0600 )edit

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: 2016-07-27 10:09:32 -0600

Seen: 1,117 times

Last updated: Jul 27 '16