Robotics StackExchange | Archived questions

How to properly use the localization mode of slam_toolbox

Hi, I am still a newbie in ROS and I came across slamtoolbox which intrigued me to try out. I looked at the roscon video as well the git repository. With these, I tried to create a map using a bag file from MIT and I was successful in generating one. But when I tried to use the localization mode of the slamtoolbox it initialises perfectly, but when I try to re-run the same bag to check if it's localizing properly it throws me this error,

[ INFO] [1643274146.831738269]: Node using stack size 40000000 [ INFO] [1643274146.886483355]: CeresSolver: Using SCHURJACOBI preconditioner. [ INFO] [1643274146.886554971]: Using plugin solverplugins::CeresSolver Load From File /home/mohammed-azeem/slamtoolboxws/src/slamtoolbox-noetic-devel/maps/2011-01-24-06-18-27/t2.posegraph Mapper <- Module Mapper <- mpSequentialScanMatcher Mapper <- mpGraph MapperGraph <- Graph; Graph <- mEdges; Graph <- mVertices MapperGraph <- mpMapper; MapperGraph <- mpLoopScanMatcher; MapperGraph <- mpTraversal Mapper <- mpMapperSensorManager MapperSensorManager <- mScanManagers; MapperSensorManager <- mScans Mapper <- mListeners Finished serializing Mapper Load From File Serializing Dataset Dataset <- mSensorNameLookup Dataset <- mData Dataset <- mLasers Dataset <- mpDatasetInfo Finished serializing Dataset Registering sensor: [Custom Described Lidar] [ INFO] [1643274146.969252289]: Waiting for incoming scan to get metadata... [ INFO] [1643274147.087472258]: Got scan!

[ERROR] [1643274147.087628005]: Failed to compute laser pose, aborting continue mapping (Lookup would require extrapolation at time 1295878707.937325239, but only time 1295878707.873259306 is in the buffe, when looking up transform from frame [baselaserlink] to frame [basefootprint]) [slamtoolbox-2] process has died [pid 484858, exit code 255, cmd /home/mohammed-azeem/slamtoolboxws/devel/lib/slamtoolbox/localizationslamtoolboxnode _name:=slamtoolbox _log:=/home/mohammed-azeem/.ros/log/d8d4ab62-7f4f-11ec-8ddf-0b09d3f78d63/slamtoolbox-2.log]. log file: /home/mohammed-azeem/.ros/log/d8d4ab62-7f4f-11ec-8ddf-0b09d3f78d63/slam_toolbox-2*.log

My launch file is as follows:

<launch>
  <node pkg="slam_toolbox" type="localization_slam_toolbox_node" name="slam_toolbox" output="screen">
    <rosparam command="load" file="$(find slam_toolbox)/config/localization.yaml" />
  </node>
    <node type="rviz" name="rviz" pkg="rviz" args="-d $(find slam_toolbox)/rviz/mera_rviz.rviz" />
    <param name="/use_sim_time" value="true"/>
</launch>

My localization.yaml file is the same as default except the following params as follows:

odom_frame: odom_combined
map_frame: map
base_frame: base_footprint
scan_topic: /base_scan
mode: localization
map_file_name: /home/mohammed-azeem/slam_toolbox_ws/src/slam_toolbox-noetic-devel/maps/2011-01-24-06-18-27/t2
map_start_pose: [0.0, 0.0, 0.0]

After creating the map, i serialized the map and even deserialized the same while running the localization mode. I have attached my tf tree as well, I sense there's some error in tf but I can't quite figure it out and IDK where I am going wrong, so can someone please point out my mistake. I am using ROS Noetic on Ubunutu 20.04.

Asked by Azeem on 2022-01-27 04:41:47 UTC

Comments

Hi @Azeem, you are right that the error failing to compute could be caused by tf transforms from two different frames. But it could also be due to your device not keeping up. Is it possible to check your CPU/GPU utilization while running this node? I prefer to check that first as it's an easy check.

Asked by osilva on 2022-01-27 19:17:21 UTC

Sorry, I was AFK for the past few days, @osliva I checked my CPU utilisation and it looks fine to me. It's utilisation hovers between 10 - 20%.

Asked by Azeem on 2022-01-30 23:10:37 UTC

Answers