[ROS-SLAM-Cartographer] Various questions and need support

asked 2019-07-13 04:26:27 -0500

nhphuong gravatar image

updated 2019-07-15 11:53:14 -0500

Hi everyone, I'm experimenting 2D SLAM using cartographer-ros and had various random questions to which I failed to find an answer. I'm very grateful if anyone can support me with them! Here is my setup:

  • A turtle robot using arduino for driving motors & getting IMU data
  • Attached on it is a Jetson TX2 which running on Ubuntu 16.04 LTS + ROS Kinetic. It collect data from arduino as well as from rpLIDAR A1 from USB port. roscore is running on this one.
  • A PC that wirelessly connect to the robot for running heavier tasks like SLAM and navigation. It has Ubuntu 18.04 LTS + ros melodic installed

Here are my questions:

  1. Do I need to sync the timestamp for all published/broadcasted data? For example: the arduino publishes wheel speed data to the base controller node on Jetson, from then, it calculates and publish/broadcast odometry data for cartographer node. Do I have to set the timestamp of odom topic to match the timestamp that is published by arduino? Or I can use ros::time::now() for the published odom topic? Same goes for the tf broadcasting.
  2. My robot only work in 2D environment, so would the ros-localization-wiki here be any useful? Or I can directly calculate and publish/broadcast necessary data (like /odom) according to navigation tutorial?
  3. My current result of SLAM using cartographer has a problem but I don't know which one is the culprit behind it. The local suimage descriptionbmap is good but whenever it is added to the global map, it get a slight shift (rotate to be concrete) - see below. Can anyone provide me a suggestion which parameters I should tune in order to get the loop closure to be correct? Could it be because of a drifting in my IMU sensor reading or odom calculation?
  4. The tuning guide from cartographer doc lack of visual illustration to describe what is a good tuning for local SLAM when global SLAM disabled. Can anyone here share your sample picture or something like for this part of cartographer tuning process?

Thanks so much for your support!

Update:

POSE_GRAPH.optimize_every_n_nodes = 1

TRAJECTORY_BUILDER_2D.submaps.num_range_data = default (untouched) Screenshot

edit retag flag offensive close merge delete

Comments

I don't know about the rest, but:

Do I need to sync the timestamp for all published/broadcasted data?

yes. Always yes.

It's impossible to relate sensor data (ie: messages) without having a common or synced clock.

Think about a rotating robot with some sensor on it. A sensor processing node will try to use TF to lookup the exact pose of the robot at the time the sensor data was captured. Imagine a 30 seconds delta-t between the producer and the consumer. How is the consumer ever going to retrieve the correct pose of the robot if it's not time-synced?

gvdhoorn gravatar image gvdhoorn  ( 2019-07-13 08:24:05 -0500 )edit

Tks gvdhoorn! That was also my initial thought when I first know about timestamp in ROS. However, will it cause any problem for the cartographer pkg to run? For example, the latest topic as well as tf odom has timestamp too far in the past while the scan data might be up to 3s newer? This question pop up when I got the validate result from cartographer_rosbag_validate tool. It warns about a huge time gap between received data which is ~3s different!

nhphuong gravatar image nhphuong  ( 2019-07-13 11:25:30 -0500 )edit

Unsynced clocks with multiple hosts in a single ROS nodegraph can cause all sorts of strange problems.

I would definitely first fix that. Then start looking at other things.

gvdhoorn gravatar image gvdhoorn  ( 2019-07-13 12:12:56 -0500 )edit