Ask Your Question

Google cartographer-ros 3D slam empty map problem

asked 2019-02-28 04:21:12 -0600

JanOr gravatar image

updated 2019-03-02 11:51:06 -0600

I am trying to adapt the bagpack_3d tutorial of cartographer ROS to a sick laser scanner with an imu. The scanner and imu are working. However with the current setup, I do not get any localization/map (empty /submap_list). So basically somewhere in the \cartographer_node there is an error.

image description

image description

My configuration file looks like this:

include "map_builder.lua"
include "trajectory_builder.lua"
options = {
  map_builder = MAP_BUILDER,
  trajectory_builder = TRAJECTORY_BUILDER,
  map_frame = "map",
  tracking_frame = "imu_link",
  published_frame = "base_link",
  odom_frame = "odom",
  provide_odom_frame = true,
  publish_frame_projected_to_2d = false,
  use_odometry = false,
  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 = 0.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.,
TRAJECTORY_BUILDER_3D.num_accumulated_range_data = 160
MAP_BUILDER.use_trajectory_builder_3d = true
MAP_BUILDER.num_background_threads = 7
POSE_GRAPH.optimization_problem.huber_scale = 5e2
POSE_GRAPH.optimize_every_n_nodes = 320
POSE_GRAPH.constraint_builder.sampling_ratio = 0.03
POSE_GRAPH.optimization_problem.ceres_solver_options.max_num_iterations = 10
POSE_GRAPH.constraint_builder.min_score = 0.62
POSE_GRAPH.constraint_builder.global_localization_min_score = 0.66
return options

In comparison to the backpack tutorial (with 2 velodyne scanners), I have a simple horizontal lidar. Accordingly, I have changed the parameters:

  num_laser_scans = 1,
  num_point_clouds = 0

To create the tf, we call the robot urdf file with the robot state publisher in the launchfile

  <param name="robot_description"
    textfile="$(find robot_navigation)/urdf/robot_3d.urdf" />

  <node name="robot_state_publisher" pkg="robot_state_publisher"
    type="robot_state_publisher" />

  <node name="cartographer_node" pkg="cartographer_ros"
      type="cartographer_node" args="
          -configuration_directory $(find robot_navigation)/configuration_files
          -configuration_basename robot_3d.lua"
   <remap from="imu" to="imu/data_raw" />
   <remap from="scan" to="sick_s300_laser/scan" />

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

My major question: Do you have any idea, why I do not get any localization/map?

My minor question: As I am using the melodic binary version: sudo apt install ros-melodic-cartographer-ros Using the debugger from visual studio code with ROS plugin, I can launch the cartographer, but pausing the debugger does not work/give me any address in the binaries. Do you have a good idea how to debug the binary ros packages?

Thanks a lot!

edit retag flag offensive close merge delete



You miss the tf odom, you seem to have removed it from your previous question (#q316747) that might be the issue. Also you have the param use_odometry set to false, is it intended ?

Delb gravatar image Delb  ( 2019-02-28 04:38:59 -0600 )edit

The tf odom was actually not wanted, as it was provided by the pervious IMU filter. What I would like to have is that the cartographer computes the odom based on the laser and imu measurements. I think "use_odometry" should be negative here as I don't want to impose an externally calculated odom.

JanOr gravatar image JanOr  ( 2019-02-28 05:02:05 -0600 )edit

lua params seems good. but transfrom time from the tf pic, are 0.0, this will affect the transformation calculation. pls check

tianb03 gravatar image tianb03  ( 2019-03-02 01:07:27 -0600 )edit

Hi, thanks for your help. Isn't it normal that the tf time is 0.0, as those are static transformations?

JanOr gravatar image JanOr  ( 2019-03-02 11:52:31 -0600 )edit

its abnormal. tf is broadcasting to the system and no one knows that it is a static transform. It is just like a common tf, should have a proper time stamp.

tianb03 gravatar image tianb03  ( 2019-03-04 02:15:47 -0600 )edit

if possible pls indicate whats print on the terminal,any warning like tf_old_data?

tianb03 gravatar image tianb03  ( 2019-03-04 02:16:52 -0600 )edit

I disagree with you on that. Since the broadcaster is /robot_state_publisher that means base_laser_link and imu_link are defined in the urdf. When you have fixed joint then you have this kind of output in the tf tree so that's just show that those two tfs are fixed to base_link .

Delb gravatar image Delb  ( 2019-03-04 02:33:06 -0600 )edit

Hi, thanks for your input. As I still couldn't get any result, I opened the issue:

JanOr gravatar image JanOr  ( 2019-03-07 09:05:50 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-28 02:11:38 -0600

JanOr gravatar image

updated 2019-03-28 02:12:02 -0600

The problem was not with cartographer_ros, but has been a negative time-increment in the laser scanner msg.

edit flag offensive delete link more


Hi, How did you find that it was teh cause and how did you solve it?

Jona gravatar image Jona  ( 2019-08-31 17:23:51 -0600 )edit

@Jona You get a message like this if you are playing a rosbag on a loop, when you cross the starting point.

``[cartographer_node-1] [WARN] [1604374353.030127742] [cartographer_ros]: W1103 03:32:33.000000 183420] Ignored subdivision of a LaserScan message from sensor scan because previous subdivision time 621382769917806529 is not before current subdivision time 621382769390853411

Mohit Arvind Khakharia gravatar image Mohit Arvind Khakharia  ( 2020-11-02 21:37:56 -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



Asked: 2019-02-28 04:21:12 -0600

Seen: 966 times

Last updated: Mar 28 '19