How to properly use the localization mode of slam_toolbox

asked 2022-01-27 03:41:47 -0500

Azeem gravatar image

Hi, I am still a newbie in ROS and I came across slam_toolbox 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 slam_toolbox 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 SCHUR_JACOBI preconditioner. [ INFO] [1643274146.886554971]: Using plugin solver_plugins::CeresSolver Load From File /home/mohammed-azeem/slam_toolbox_ws/src/slam_toolbox-noetic-devel/maps/2011-01-24-06-18-27/t2.posegraph Mapper <- Module Mapper <- m_pSequentialScanMatcher Mapper <- m_pGraph MapperGraph <- Graph; Graph <- m_Edges; Graph <- m_Vertices MapperGraph <- m_pMapper; MapperGraph <- m_pLoopScanMatcher; MapperGraph <- m_pTraversal Mapper <- m_pMapperSensorManager MapperSensorManager <- m_ScanManagers; MapperSensorManager <- m_Scans Mapper <- m_Listeners Finished serializing Mapper Load From File Serializing Dataset Dataset <- m_SensorNameLookup Dataset <- m_Data Dataset <- m_Lasers Dataset <- m_pDatasetInfo 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 [base_laser_link] to frame [base_footprint]) [slam_toolbox-2] process has died [pid 484858, exit code 255, cmd /home/mohammed-azeem/slam_toolbox_ws/devel/lib/slam_toolbox/localization_slam_toolbox_node __name:=slam_toolbox __log:=/home/mohammed-azeem/.ros/log/d8d4ab62-7f4f-11ec-8ddf-0b09d3f78d63/slam_toolbox-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.

edit retag flag offensive close merge delete

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.

osilva gravatar image osilva  ( 2022-01-27 18:17:21 -0500 )edit

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%.

Azeem gravatar image Azeem  ( 2022-01-30 22:10:37 -0500 )edit