Ask Your Question

Odometry with Cartographer

asked 2018-12-20 16:12:27 -0600

LunarJeff gravatar image

I am running ROS Kinetic on Ubuntu 16.04.

I am working on getting the navigation stack working and I am stuck with the Odometry input. I am currently working with an Ouster LIDAR alongside with an IMU. I have set up SLAM using cartographer, which will give me the map input into the navigation stack.

I was wondering if their is a way to obtain Odometry message from Cartographer itself or build it from the sensors that I am currently using. I am fairly new to ROS and I do not know where to start.

Thanks for any help/information you can provide.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-12-24 21:51:20 -0600

updated 2019-12-13 02:11:12 -0600

You can set cartographer to publish odometry, or else you can generate odometry using some other algorithms. But you cannot do both at the same time.

You may need to know that odometry which provided by wheel encoder is odom->base_link, map->odom is the drift error and provided by mapping process.

reference: https://google-cartographer-ros.readt...

If you only want to use cartographer with your lidar and IMU, and do not want to use a supplementary odometry, set use_odometry to false, and published frame should be base_footprint or base_link. Because a mapping procedure normally publish tf from map to odom, which indicates the drift error. The drift error plus a raw odometry we will have the pose of base_link w.r.t. map.

Then you can configure whether you want cartographer provide the odom frame. set provide_odom_frame to false the mapping process will give you base_link to map directly, however as a convention, better set provide the odom frame to true and the odom frame will be published. Then you can have the odom info from cartographer.

  map_frame = "map",
  tracking_frame = "IMU_link",

  use_odometry = false,
  published_frame = "base_footprint",

  provide_odom_frame = true,
  odom_frame = "odom",

As you have already disabled odometry, you could set imu to true, this gives better SLAM result.

  TRAJECTORY_BUILDER_2D.use_imu_data = true

Another case is that you can use some other method to generate odom instead of cartographer. For example if you use velodyne you can try, or rplidar you can try

if you have wheel encoder, it is similar configuration. if you set provide odom frame to true, cartographer node wont die but the odom frame will oscillating because tf to odom is broadcasted by two nodes. In this case, odom_frame has no use.

Even if you set imu to true, it will not adjust the perception according to imu readings. Sensor readings are attached to base_link which is provided by odom->base_link which is provided by odometry.

  map_frame = "map",
  tracking_frame = "base_footprint",

  use_odometry = true,
  published_frame = "odom",

  provide_odom_frame = false,
  odom_frame = "odom",

(Some conclusion is not fully tested but I think it will be.)

If you are interested in the full code, I am busy updating an racecar project recently. you could check this out:

edit flag offensive delete link more


thanks a lot !

jackchin gravatar image jackchin  ( 2019-12-11 23:10:14 -0600 )edit

when use_odometry = false, trancking_frame = imu, cartographer doesn't work

rjosodtssp gravatar image rjosodtssp  ( 2020-07-15 00:40:20 -0600 )edit

Maybe you can check whether your IMU output is correct. I remember that cartographer requires the angular velocity. you could open a new question with a detailed description

tianb03 gravatar image tianb03  ( 2020-07-15 03:59:20 -0600 )edit

answered 2018-12-21 07:26:52 -0600

updated 2018-12-21 07:31:36 -0600

You can start with the ROS Navigation Tutorials. More specifically, the Publishing Odometry Information over ROS tutorial explains how to publish odometry messages for a predefined movement. Normally you would use your sensors (e.g. encoders + imu) to determine the odometry.

edit flag offensive delete link more


I saw the odometry tutorial on odometry, my problem is that I only have an IMU and no encoders. Is there a way to obtain odometry just from the IMU itself or in combination with the LIDAR?

LunarJeff gravatar image LunarJeff  ( 2018-12-21 09:03:18 -0600 )edit

Yes, you can use laser scans to match between frames and then back out the estimated change in position. There may be some packages that do this for you - but none come to mind at this moment.

stevemacenski gravatar image stevemacenski  ( 2018-12-21 15:37:13 -0600 )edit

Robot_localization can be used for state estimation based any number of sensors. I don't know if you can use it without encoders.

Wilco Bonestroo gravatar image Wilco Bonestroo  ( 2018-12-23 15:30:11 -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: 2018-12-20 16:12:27 -0600

Seen: 3,854 times

Last updated: Dec 13 '19