introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.83k stars 787 forks source link

How to get a clean map #1363

Closed mizrex closed 3 weeks ago

mizrex commented 1 month ago

I'm using a Oak-D-Pro-W, with the depth_ai ROS2 drivers, along with their launch file and params file as below. But, I'm getting a very chaotic map, which is not able to distinguish between free space and ground. If someone can point in the direction, what to troubleshoot or tweak.

map_rtabmap

`import os from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription from launch_ros.actions import Node from launch.actions import IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource

def generate_launch_description(): parameters=[{'frame_id':'oak-d-base-frame', 'subscribe_rgbd':True, 'subscribe_odom_info':True, 'approx_sync':False, 'wait_imu_to_init':True}]

remappings=[('imu', '/imu/data')]
rtabmap_d_params = os.path.join(get_package_share_directory('sdros2_bringup'), 'config', 'rtabmap.yaml')

return LaunchDescription([

    # Launch camera driver
    IncludeLaunchDescription(
        PythonLaunchDescriptionSource([os.path.join(
            get_package_share_directory('depthai_examples'), 'launch'),
            '/stereo_inertial_node.launch.py']),
            launch_arguments={'depth_aligned': 'false',
                              'enableRviz': 'false',
                              'monoResolution': '400p'}.items(),
    ),

    # Sync right/depth/camera_info together
    Node(   
        package='rtabmap_sync', executable='rgbd_sync', output='screen',
        parameters=parameters,
        remappings=[('rgb/image', '/right/image_rect'),
                    ('rgb/camera_info', '/right/camera_info'),
                    ('depth/image', '/stereo/depth')]),

    # Compute quaternion of the IMU
    Node(
        package='imu_filter_madgwick', executable='imu_filter_madgwick_node', output='screen',
        parameters=[{'use_mag': False, 
                     'world_frame':'enu', 
                     'publish_tf':False}],
        remappings=[('imu/data_raw', '/imu')]),

    # Visual odometry
    Node(
        package='rtabmap_odom', executable='rgbd_odometry', output='screen',
        parameters=parameters,
        remappings=remappings),

    # VSLAM
    Node(
        package='rtabmap_slam', executable='rtabmap', output='screen', name='rtabmap',
        parameters=[rtabmap_d_params],
        remappings=remappings,
        arguments=['-d']),

    # Visualization
    Node(
        package='rtabmap_viz', executable='rtabmap_viz', output='screen',
        parameters=parameters,
        remappings=remappings)
])

`

Params file

` /rtabmap: ros__parameters: subscribe_depth: false subscribe_rgbd: true subscribe_stereo: false subscribe_scan: false subscribe_scan_cloud: false subscribe_user_data: false subscribe_odom_info: true approx_sync: false wait_imu_to_init: true frame_id: oak-d-base-frame map_frame_id: map odom_frame_id: odom # odometry from odom msg to have covariance - Remapped by launch file odom_tf_angular_variance: 0.03 # If TF is used to get odometry, this is the default angular variance odom_tf_linear_variance: 0.04 # If TF is used to get odometry, this is the default linear variance tf_delay: 0.02 publish_tf: true # Set to false if fusing different poses (map->odom) with UKF

odom_sensor_sync:               true
wait_for_transform_duration:    0.2
approx_sync:                    true

queue_size: 10

scan_normal_k:  0

Optimizer:
    Robust:                 false
    Strategy:               2

g20:
    Optimizer:              0
    PixelVariance:          1
    Solver:                 0
Reg:
    Force3DoF:              true

Grid:
    3D:                     false
    FlatObstacleDetected:   true
    MapFrameProjection:     false
    GroundIsObstacle:       false
    PreVoxelFiltering:      true
    RayTracing:             false
    FromDepth:              true
    NormalsSegmentation:    true
    CellSize:               0.05
    ClusterRadius:          0.1
    MinClusterSize:         20
    DepthDecimation:        1
    DepthRoiRatios:         [0.0, 0.0, 0.0, 0.0]
    FootprintHeight:        0.5
    FootprintLength:        0.40
    FootprintWidth:         0.33
    MaxGroundAngle:         30.0
    # MinGroundHeight:        -0.5
    MinGroundHeight:        0.0
    # MaxGroundHeight:        -0.4
    MaxGroundHeight:        0.0
    # MaxObstacleHeight:      0.1
    MaxObstacleHeight:      1.0
    NoiseFilteringMinNeighbors: 5
    NoiseFilteringRadius:   0.1
    NormalK:                20
    RangeMin:               0.3
    # RangeMax:               10.0
    # RangeMax:               5.0
    RangeMax:               2.5

GridGlobal:
    Eroded:                 false       # Erode obstacle cells
    FootprintRadius:        0.22        # Footprint radius (m) used to clear all obstacles under the graph
    FullUpdate:             true        # When the graph is changed, the whole map will be reconstructed instead of moving individually each cells of the map. Also, data added to cache won't be released after updating the map. This process is longer but more robust to drift that would erase some parts of the map when it should not
    MaxNodes:               0           # Maximum nodes assembled in the map starting from the last node (0=unlimited)
    MinSize:                1.0        # Minimum map size (m)
    OccupancyThr:           0.55        # Occupancy threshold (value between 0 and 1)
    ProbClampingMax:        0.971       # Probability clamping maximum (value between 0 and 1)
    ProbClampingMin:        0.1192      # Probability clamping minimum (value between 0 and 1)
    ProbHit:                0.7         # Probability of a hit (value between 0.5 and 1)
    ProbMiss:               0.4         # Probability of a miss (value between 0 and 0.5)
    UpdateError:            0.01        # Graph changed detection error (m). Update map only if poses in new optimized graph have moved more than this value
Rtabmap:
    DetectionRate:          10
# Mem:
#     IncrementalMemory:      false
#     InitWMWithAllNodes:     false
#     NotLinkedNodesKept:     false
#     BinDataKept:            false

`

mizrex commented 4 weeks ago

This is another example of a map. The green line shows the path the robot took. But it detected obstacles (black region) around it. map_rtabmap2

mizrex commented 3 weeks ago

Duplicate. Moved it here