# Cartographer SLAM with LiDAR

Hello, First of all, I'm new to ROS so I apologize if my explanation isn't the most accurate one. Currently, I'm trying to use Cartographer ros with a 3D LiDAR (Velodyne VLP16, to be exact) for SLAM process. However, at the moment I don't have an IMU or any external odometry source, so I was expecting that cartographer could simulate the odometry data from the LiDAR. For now I can build the 2D map of my environment, but as soon as I move de LiDAR it seems that the submaps start "drifting" or "dragging" (please see the images below with the before and after as I move the sensor).

Before: https://ibb.co/TPLDFQf

After moving the sensor: https://ibb.co/fvjxF5C

Any guesses what it could be? I have a feeling that it could be related to the lack of odometry data, but any suggestions on how could I solve that? I've also attached my .lua configuration file below. Thank you for your time! Any kind of help will be highly appreciated!

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

options = {
map_builder = MAP_BUILDER,
trajectory_builder = TRAJECTORY_BUILDER,
map_frame = "map",
odom_frame = "odom",
provide_odom_frame = true,
publish_frame_projected_to_2d = false,
use_pose_extrapolator = true,
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 = 1,
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.,
}

MAP_BUILDER.use_trajectory_builder_2d = true
TRAJECTORY_BUILDER_2D.num_accumulated_range_data = 1

--TRAJECTORY_BUILDER.pure_localization = true

--TRAJECTORY_BUILDER_2D.min_range = 0.3
--TRAJECTORY_BUILDER_2D.missing_data_ray_length = 1.
TRAJECTORY_BUILDER_2D.use_imu_data = false

--TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
--TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.linear_search_window = 0.1
--TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.translation_delta_cost_weight = 10.
--TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.rotation_delta_cost_weight = 10.

--TRAJECTORY_BUILDER_2D.ceres_scan_matcher.translation_weight = 10
--TRAJECTORY_BUILDER_2D.ceres_scan_matcher.rotation_weight = 40

POSE_GRAPH.optimization_problem.huber_scale = 5e2
POSE_GRAPH.optimization_problem.odometry_rotation_weight= 0

POSE_GRAPH.optimize_every_n_nodes = 320
POSE_GRAPH.global_sampling_ratio = 0.0001
POSE_GRAPH.constraint_builder.sampling_ratio = 0.03
POSE_GRAPH.constraint_builder.min_score = 0.62
--POSE_GRAPH.global_constraint_search_after_n_seconds = 20
POSE_GRAPH.optimization_problem.ceres_solver_options.max_num_iterations = 10
POSE_GRAPH.constraint_builder.global_localization_min_score = 0.66
--TRAJECTORY_BUILDER_2D.ceres_scan_matcher.ceres_solver_options.max_num_iterations = 5