I'm looking to convert a ROS1 project setup to ROS2.
In ROS1, I was using a LIDAR, Transforms, Laser Scanner Matcher, and slam_gmapping.

With ROS2, I am still using a LIDAR, Transforms. I had to install the Laser Scanner Matcher from source. And of course, slam_gmapping isn't the SLAM of choice with ROS2, so I am using the SLAM toolkit.

Currently, I am not getting a /pose or /map from SLAM, but I am seeing this warning:

[sync_slam_toolbox_node-1] [WARN] [1709756749.648499254] [slam_toolbox]: Failed to compute odom pose

Once the LIDAR is running (and /scan is populated) I set up a transform:

run tf2_ros static_transform_publisher --x 0 --y 0 --z 0 --roll 0 --pitch 0 --yaw 0 --frame-id base_link --child-frame-id laser

and then launch the laser scanner:

ros2 run ros2_laser_scan_matcher laser_scan_matcher \
--ros-args -p use_imu:=false \
--ros-args -p use_odom:=false \
--ros-args -p base_frame:=base_link \
--ros-args -p fixed_frame:=odom \
--ros-args -p publish_tf:=true \
--ros-args -p sigma:=0.1
--ros-args -p max_linear_correction:=0.10 \
--ros-args -p max_angular_correction_deg:=15.0 \
--ros-args -p kf_dist_linear:=0.1 \
--ros-args -p kf_dist_angular:=0.12 \
--ros-args -p max_correspondence_dist:=0.05

(I also tried launching it with '--ros-args -p publish_odom:=odom' but there isn't any change)

Then I launch SLAM:

ros2 launch slam_toolbox online_sync_launch.py \
odom_frame:=odom \
map_frame:=map \
base_frame:=base_link \
scan_topic:=/scan \
map_update_interval:=1 \
max_laser_rang:=5 \
minimum_travel_distance:=0.1 \
use_scan_matching:=true \
minimum_travel_heading:=1.57 \

My TFs look like this.
enter image description here

The zeros are concerning. But I don't know what causes that.

enter image description here

Thank you!


2 Answers 2



Using the python launch file was ignoring the parameters. Running the executable directly with ros2 run, like so, fixed this.

ros2 run slam_toolbox sync_slam_toolbox_node \
--ros-args -p odom_frame:=odom \
--ros-args -p base_frame:=base_link \
--ros-args -p map_frame:=map \
--ros-args -p scan_topic:=/scan \
--ros-args -p map_update_interval:=1.0 \
--ros-args -p max_laser_range:=5.0 \
--ros-args -p minimum_travel_distance:=0.1 \
--ros-args -p use_scan_matching:=true \
--ros-args -p minimum_travel_heading:=1.57 \
--ros-args -p do_loop_closing:=true

It seems you are not feeding the scan matcher with Odom and IMU data:

ros2 run ros2_laser_scan_matcher laser_scan_matcher \
--ros-args -p use_imu:=false \
--ros-args -p use_odom:=false \

Shouldn't you switch to use_imu:=True and use_odom:= True ?

Or this package doesn't need other input data, but only scan data to output the pose?

  • $\begingroup$ Those items are not required. With the ROS2 version of the laser scanner matcher the are not even supported. I've removed those from my command, too. $\endgroup$
    – jgauthier
    Mar 7 at 2:36
  • $\begingroup$ Did you try to check if this issue is related to the mapper_params_online_sync.yaml configuration file? When I worked with slam toolbox in ROS2 I have fixed related issues changing values from this file $\endgroup$ Mar 7 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.