Skip to content

Using slam_toolbox for localization #744

@Agri-Mechatronic

Description

@Agri-Mechatronic
  • Operating System:
    • Ubuntu 22.04
  • Installation type:
  • ROS Version
    • ROS2 Humble

Hello,

I am using turtlebot3 simulation to simulate localization in pre-saved and serialized map. I am experiencing issues with slam_toolbox in localization mode while using it in a simulation environment. Initially, the localization works correctly, but after a few seconds, the robot's pose becomes inconsistent, and it seems to jump to random position on the map. The following points describe the problem in detail:

I have ensured that there are no inf values in the laser scan ranges.
However, I still see the following warning repeatedly in the logs:

Info: clipped range threshold to be within minimum and maximum range!
I wonder if this could be affecting the scan matching process and leading to incorrect localization.

TF Tree and Topic Rates:

The TF tree looks correct, and the parent-child relationships are properly defined.
Topic rates are as follows:
/filtered_scan: ~10 Hz
/odom: ~29 Hz
/tf: ~49 Hz
Despite these seemingly correct rates, the localization eventually fails.

Attempted Solutions:

I have followed the discussions in related GitHub issues (#720, #611, #576, #465, #422, #415) but have not found a solution that resolves my problem.
I tried using debug logs and tools like swri_console to understand the issue better, but nothing conclusive was found.

Launch Command:

ros2 launch slam_toolbox localization_launch.py params_file:=/path/to/mapper_params_localization.yaml

mapper_params_localization.yaml:

slam_toolbox:
  ros__parameters:
    solver_plugin: solver_plugins::CeresSolver
    ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
    ceres_preconditioner: SCHUR_JACOBI
    ceres_trust_strategy: LEVENBERG_MARQUARDT
    ceres_dogleg_type: TRADITIONAL_DOGLEG
    ceres_loss_function: None

    # ROS Parameters
    use_sim_time: true
    mode: "localization"
    map_file_name: "/home/user/ros2_ws/maps/map_for_localization"
    scan_topic: /filtered_scan
    base_frame: base_footprint
    odom_frame: odom
    map_frame: map
    transform_publish_period: 0.1
    map_update_interval: 0.5
    transform_tolerance: 0.1

    # if you'd like to start localizing on bringup in a map and pose
    #map_file_name: test_steve
    map_start_pose: [0.0, 0.0, 0.0]

    debug_logging: false
    throttle_scans: 1
    transform_publish_period: 0.05 #if 0 never publishes odometry
    map_update_interval: 0.0
    resolution: 0.05
    min_laser_range: 0.15 #for rastering images
    max_laser_range: 3.5 #for rastering images
    minimum_time_interval: 0.5
    transform_timeout: 0.2
    tf_buffer_duration: 100.0
    stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps

    # General Parameters
    use_scan_matching: true
    use_scan_barycenter: true
    minimum_travel_distance: 0.2
    minimum_travel_heading: 0.2
    scan_buffer_size: 5
    scan_buffer_maximum_scan_distance: 8.0
    link_match_minimum_response_fine: 0.1  
    link_scan_maximum_distance: 1.5
    do_loop_closing: true 
    loop_match_minimum_chain_size: 3
    loop_match_maximum_variance_coarse: 3.0  
    loop_match_minimum_response_coarse: 0.35    
    loop_match_minimum_response_fine: 0.45
    
    scan_queue_size: 50
    scan_qos_history: "keep_last"
    scan_qos_reliability: "reliable"
    scan_qos_durability: "volatile"
    num_threads: 4

    # Correlation Parameters - Correlation Parameters
    correlation_search_space_dimension: 0.5
    correlation_search_space_resolution: 0.01
    correlation_search_space_smear_deviation: 0.1 

    # Correlation Parameters - Loop Closure Parameters
    loop_search_space_dimension: 8.0
    loop_search_space_resolution: 0.05
    loop_search_space_smear_deviation: 0.03
    loop_search_maximum_distance: 3.0

    # Scan Matcher Parameters
    distance_variance_penalty: 0.5      
    angle_variance_penalty: 1.0    

    fine_search_angle_offset: 0.00349     
    coarse_search_angle_offset: 0.349   
    coarse_angle_resolution: 0.0349        
    minimum_angle_penalty: 0.9
    minimum_distance_penalty: 0.5
    use_response_expansion: true

Thanks everyone...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions