Slam_toolbox utilizing lidar odometry

Hello, I’m building my first mobile robot with raspberry pi in the hopes of solidifying my understanding with ROS2 and some packages, but also trying to lower the barrier of setting up a low cost slam robot.

I’ve gotten the RPlidar A1 to run on it and publishing laser scan just fine at 7 Hz.
I have a TF ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 base_link laser

and I launched the slam_toolbox with ros2 run slam_toolbox async_slam_toolbox_node --ros-args --params-file ~/Desktop/my_custom_config.yaml

Below is my configuration:

slam_toolbox:
  ros__parameters:
    use_sim_time: false
    update_rate: 1.0
    publish_period: 0.1
    resolution: 0.05
    max_laser_range: 8.0
    scan_topic: /scan
    odom_frame: base_link  # since you don't have odometry, the map can be used as an odom frame
    base_frame: base_link
    mode: mapping
    map_update_interval: 5.0 # 8.0
    max_occupied_threshold: 0.65
    min_free_threshold: 0.196
    minimum_time_interval: 0.5
    transform_publish_period: 0.02
    linear_update: 0.1 # 0.5
    angular_update: 0.1 #0.436
    scan_buffer_size: 10
    scan_buffer_maximum_scan_distance: 8.0
    lookup_transform_timeout_sec: 0.5
    submap:
      number_of_cells: 3500

I’m only getting an initial map when I run the slam_toolbox… after that the /map topic is showing the same data and /map_updates isn’t publishing anything…

I don’t have other forms of odometry, I thought slam_toolbox would know to utilize laser scan as lidar odometry when setting my odom_frame to base_link in the configuration?

Mapping or localization, which one you want to do?
You want to use lidar as odometry, right?
Then you should set odometry frame as /scan, but I never try it, so I don’t kown if it works.

my understanding is that the odom_frame setting as base_link would make the slam_toolbox estimate the motion as well… but I’m not too sure as the document is a bit lacking on the lidar portion…

Hello @Genozen ,

Have a look at this Open Class: https://app.theconstructsim.com/open-classes/33a5afd7-2ef2-4074-ab72-0c54aa48fc61

I think it might be helpful here.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

@MagicalBrain your response is not correct, you are confusing frame by topic. Usually /scan is the name of the topic that published lidar data. The lidar data is referenced to a frame in the robot, usually named laser.

So @Genozen you need another extra ROS node that computes odometry and publishes it in the /odom topic. If your robot is not publishing odometry (maybe because it doesn’t have encoders in the wheels), you can use the package GitHub - Adlink-ROS/rf2o_laser_odometry that does that computation.
Once you launch that node and the odometry is being published by it, then you can use slam_toolbox to create your map