Rosanswers logo

We built our own robotic platform with a home made LIDAR which is composed of four Time of Flight Sensors to get range information of the environment. For odometry information we are using optical encoders. I recorded a rosbag file to save /scan /odom /tf topics which are obtained in real life setup. Unfortunately, I couldn't be able to get nice mapping performance. I tried several parameters and I digged into gmapping parameters.

Here is my best case gmapping parameters:

<param name="base_frame" value="$(arg set_base_frame)"/>
<param name="odom_frame" value="$(arg set_odom_frame)"/>
<param name="map_frame"  value="$(arg set_map_frame)"/>
<param name="map_update_interval" value="2.0"/>
<param name="maxUrange" value="3.0"/>
<param name="sigma" value="0.05"/>
<param name="kernelSize" value="1"/>
<param name="lstep" value="0.05"/>
<param name="astep" value="0.05"/>
<param name="iterations" value="5"/>
<param name="lsigma" value="0.075"/>
<param name="ogain" value="3.0"/>
<param name="lskip" value="0"/>
<param name="minimumScore" value="10"/>
<param name="srr" value="0.01"/>
<param name="srt" value="0.02"/>
<param name="str" value="0.01"/>
<param name="stt" value="0.02"/>
<param name="linearUpdate" value="0.05"/>
<param name="angularUpdate" value="0.2"/>
<param name="temporalUpdate" value="0.5"/>
<param name="resampleThreshold" value="0.5"/>
<param name="particles" value="100"/>
<param name="xmin" value="-10.0"/>
<param name="ymin" value="-10.0"/>
<param name="xmax" value="10.0"/>
<param name="ymax" value="10.0"/>
<param name="delta" value="0.01"/>
<param name="llsamplerange" value="0.01"/>
<param name="llsamplestep" value="0.01"/>
<param name="lasamplerange" value="0.005"/>
<param name="lasamplestep" value="0.005"/>

My home made LIDAR properties:

360 Degree
64 point
1 Hz 

I know that my LIDAR is not perfect, but I moved very slowly while recording rosbags. How can I improve the mapping performance? Do you know any other SLAM algorithm which could provide better performance for my case?

Here is a link to download my recorded bag file: real_data5.bag

EDIT1: Here is the gmapping result for these parameters.

EDIT2: oko_cartographer.launch file to call necessary cartographer_ros nodes with given kamu_robotu.lua (this lua file is provided below by @allenh1 : oko_cartographer.launch:

  <param name="/use_sim_time" value="true" />
  <node name="cartographer_node" pkg="cartographer_ros"
      type="cartographer_node" args="
          -configuration_directory $(find cartographer_ros)/configuration_files
          -configuration_basename kamu_robotu.lua"

  <node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"
      type="cartographer_occupancy_grid_node" args="-resolution 0.05" />

EDIT3: Here is my cartographer_ros result.

I really appreciate for your help. Thanks in advance!

Originally posted by samialperen on ROS Answers with karma: 70 on 2019-04-23

Post score: 0

Original comments

Comment by spiritninja on 2019-04-23:
Is your odometry reflecting fairly accurate changes in robot positions when you move it around ?

Comment by samialperen on 2019-04-23:
@spiritninja , yes odometry and LIDAR data is correct. I can see them in rviz seperately. I also measured their accuracy and they both are okay.

Comment by samialperen on 2019-04-23:
Note: Robot does not move immediately in the provided bag file. You need to wait a bit to see odometry change.

Comment by allenh1 on 2019-04-23:
Playing it back locally, it seemed that the tf frames were lining up pretty well (if you increase fade time and rotate, you should be able to keep a wall in place, as I could see when your robot was rotating), and the ranges looked pretty good (especially for a home made sensor -- nice work!). I didn't use GMapping when I made a map, so I'm curious to see what yours looked like (please attach to the question!), but the map I made with Cartographer looked pretty decent (I'll upload this when I have some spare time, together with the configuration file I used).

Comment by samialperen on 2019-04-23:
@allenh1 , Thank you very much. I edited the post and add the link to image of gmapping result. I tried to launch cartographer, but I couldn't. I really appreciate if you can share your .launch and .lua files for cartographer

Comment by allenh1 on 2019-04-24:
@samialperen that looks really good to me, actually. My results were not much better, and, to be frank, that's about as good as you will get with your setup and GMapping. Now, you can increase the resolution, but, if you do, you will likely get worse results due to the precision of your sensor (which, again, is extremely impressive for a homemade laser).

Comment by kosmastsk on 2019-04-24:
I would suggest using Karto SLAM. From my own experience, it gives much better results

Comment by samialperen on 2019-04-24:
@kosmastsk , Thank you for suggestion. I will try Karto SLAM as well. I tried to install it to ros kinetic, but I have compile errors :(


1 Answer 1


Rosanswers logo

You could try Cartographer out, if you wanted. I made a decent map with this lua file.

-- Copyright 2016 The Cartographer Authors
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--      http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- See the License for the specific language governing permissions and
-- limitations under the License.

include "map_builder.lua"
include "trajectory_builder.lua"

options = {
  map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "base_link",
  published_frame = "base_link",
  odom_frame = "odom",
  provide_odom_frame = true,
  publish_frame_projected_to_2d = false,
  use_odometry = true,
  use_nav_sat = false,
  use_landmarks = false,
  num_laser_scans = 1,
  num_multi_echo_laser_scans = 0,
  num_subdivisions_per_laser_scan = 1,
  num_point_clouds = 0,
  lookup_transform_timeout_sec = 1.2,
  submap_publish_period_sec = 0.3,
  pose_publish_period_sec = 5e-3,
  trajectory_publish_period_sec = 30e-3,
  rangefinder_sampling_ratio = 1.,
  odometry_sampling_ratio = 1.,
  fixed_frame_pose_sampling_ratio = 1.,
  imu_sampling_ratio = 1.,
  landmarks_sampling_ratio = 1.,

MAP_BUILDER.use_trajectory_builder_2d = true

TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
TRAJECTORY_BUILDER_2D.use_imu_data = false
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.linear_search_window = 0.15
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.angular_search_window = math.rad(35.)

POSE_GRAPH.optimization_problem.huber_scale = 1e2

return options

I ran it with these settings.

rosrun cartographer_ros cartographer_node -configuration_directory [wherever you put it] -configuration_basename realoguz.lua

And to get the grid map, run the below.

rosrun cartographer_ros cartographer_occupancy_grid_node

I got this map (it's small because the area is rather small).

image description

Originally posted by allenh1 with karma: 3055 on 2019-04-24

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by samialperen on 2019-04-24:
@allenh1 Thank you very much for providing the lua file. I saved the lua file you provided named as kamu_robotu.lua. Then I used oko_cartographer.launch, which I added into original post. I also added my mapping result, but it seems my mapping result is not as good as yours. Normally, there are two objects in the map one of them is square and the other one is cylinder. Our aim is to detect them as perfect as possible. Do you have any other suggestion? What should I do to improve the results. I really tried hard to tune gmapping, but I failed to detect objects nicely. I really appreciate for your help!


Your Answer

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