Ask Your Question

How can I use hector SLAM correctly?

asked 2022-01-12 16:59:51 -0500

sincoy gravatar image

updated 2022-01-20 04:08:29 -0500

Hello ROS developers,

I know that this might be a small problem but I do not know how to manage my hector SLAM launch file for my specific robot.

My tree is like: map -> base_link -> ....; map -> scanmatcher_frame; odom-> base_footprint

It should be like the following, is not it? map -> odom -> base_footprint -> base_link -> scanners; map -> scanmatcher_frame

If I am starting rviz there is no transformation between base_footprint and map. I tried it already with the following nodes "static_transform_publisher", but without success.

<node pkg="tf" type="static_transform_publisher" name="odom_to_basefootprint" args="0.0
    0.0 0.0 0 0 0.0 /odom /base_footprint 100" />
  <node pkg="tf" type="static_transform_publisher" name="basefootprint_base_link" args="0.0
    0.0 0.0 0 0 0.0 /base_footprint /base_link 100" />

My launch file: <launch>

  <arg name="open_rviz" default="true"/>
  <arg name="base_frame" default="base_link"/>
   <arg name="odom_frame" default="base_link"/>
  <arg name="map_frame"  default="map"/>

  <param name="/use_sim_time" value="true"/>

  <!-- Hector -->
  <node pkg="hector_mapping" type="hector_mapping" name="slam_hector" output="screen">
    <param name="pub_map_odom_transform" value="true"/>
    <param name="base_frame" value="$(arg base_frame)"/>
    <param name="odom_frame" value="$(arg odom_frame)"/>
    <param name="map_frame"  value="$(arg map_frame)"/>
    <rosparam command="load" file="$(find slam)/config/hector_params.yaml" />

   <!-- rviz -->
  <group if="$(arg open_rviz)">
    <node pkg="rviz" type="rviz" name="rviz" required="true"
          args="-d $(find slam)/rviz/hector.rviz">

Thank you very much!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-01-17 19:05:36 -0500

sreeji gravatar image

You dont add scan topic? <arg name="scan_topic" default="/scan"/>

Can you check the transform from baselink to laser scan frame? This error also comes when the scan frame is not broadcasted to baselink. You might try this after adding the scan topic. (laser is the frame name of /scan topic)

  <node pkg="tf" type="static_transform_publisher" name="base_to_laser" args="0.0
    0.0 0.0 0 0 0.0 /base_link /laser 100" />
edit flag offensive delete link more


Thank you for your reply! I do not have any problem with my laser scanners. My tf tree is connected from the baselink to my laserscaners. But I have a problem with my base footprint, which should be connected with the baselink.

sincoy gravatar image sincoy  ( 2022-01-20 04:08:31 -0500 )edit

Can you post the rqt tf tree. It will give more information.

sreeji gravatar image sreeji  ( 2022-02-07 01:48:28 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-01-12 16:59:51 -0500

Seen: 52 times

Last updated: Jan 20