ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

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" />
  </node>

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

Thank you very much!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-07-14 17:02:32 -0500

adityatandon gravatar image

updated 2022-07-14 17:05:20 -0500

In your specific case, the issue exists since there is no frame called /odom as such that can be found. The odometry frame in the context of the Hector Mapping node is available as the argument "odom_frame" that you are setting as base_link. This has to be set as /odom to be used in your configuration.

I would recommend using the following for your use-case :

<arg name="base_frame" default="base_footprint">
<arg name="odom_frame" default="odom"/>

<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_to_base" args="0.0 0.0 0.0 0 0 0.0 base_footprint base_link 100" />

<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" />

If there really are no transformations between the different frames and they lie on the same point, you can just omit the base_footprint and odom link altogether by setting both base_frame and odom_frame to be equal to base_link and keep only the transform between laser and base_link.

edit flag offensive delete link more
0

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

Comments

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

Question Tools

1 follower

Stats

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

Seen: 450 times

Last updated: Jul 14 '22