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

Hector slam configuration issues

asked 2021-03-28 11:54:36 -0600

sisko gravatar image

updated 2021-03-28 11:55:51 -0600

I am changing my project from using gmapping to hector slam but in rviz my robot is displaying and moving in a less than stable manner, as shown below. I've run out of ideas on things to try;

image description image description

Teleoperating the robot is even worse :

image description

I have the following error on my command-line :

[ERROR] [1616948938.487207485, 0.535000000]: Transform failed during publishing of map_odom transform: Lookup would require extrapolation into the past.  Requested time 0.030000000 but the earliest data is at time 0.205000000, when looking up transform from frame [chasis] to frame [odom]

My TF tree hierarchy is fully connected as shown below :

image description

I have hokuyo lidar setup in my xacro as follows:

  <!-- HOKUYO as  RPLIDAR -->
  <xacro:hokuyo_utm30lx name="hokuyo_laser" parent="chasis" ros_topic="hokuyo_scan" update_rate="40" ray_count="1040" min_angle="130" max_angle="-130">
    <origin xyz="0 0 0.3" rpy="0 0 0" />
  </xacro:hokuyo_utm30lx>

And my hector related configuration in my launch file is as follows :

<arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
    <arg name="base_frame" default="chasis"/>
    <arg name="odom_frame" default="odom"/>

    <arg name="pub_map_odom_transform" default="true"/>
    <arg name="scan_subscriber_queue_size" default="5"/>
    <arg name="scan_topic" default="hokuyo_scan"/>
    <arg name="map_size" default="2048"/>

    <node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
      <!-- Frame names -->
      <param name="map_frame" value="map" />
      <param name="base_frame" value="$(arg base_frame)" />
      <param name="odom_frame" value="$(arg odom_frame)" />

      <!-- Tf use -->
      <param name="use_tf_scan_transformation" value="true"/>
      <param name="use_tf_pose_start_estimate" value="false"/>
      <param name="pub_map_odom_transform" value="$(arg pub_map_odom_transform)"/>

      <!-- Map size / start point -->
      <param name="map_resolution" value="0.050"/>
      <param name="map_size" value="$(arg map_size)"/>
      <param name="map_start_x" value="0.5"/>
      <param name="map_start_y" value="0.5" />
      <param name="map_multi_res_levels" value="2" />

      <!-- Map update parameters -->
      <param name="update_factor_free" value="0.4"/>
      <param name="update_factor_occupied" value="0.9" />    
      <param name="map_update_distance_thresh" value="0.4"/>
      <param name="map_update_angle_thresh" value="0.06" />
      <param name="laser_z_min_value" value = "-1.0" />
      <param name="laser_z_max_value" value = "1.0" />

      <!-- Advertising config --> 
      <param name="advertise_map_service" value="true"/>

      <param name="scan_subscriber_queue_size" value="$(arg scan_subscriber_queue_size)"/>
      <param name="scan_topic" value="$(arg scan_topic)"/>

      <param name="tf_map_scanmatch_transform_frame_name" value="$(arg tf_map_scanmatch_transform_frame_name)" />
    </node>

    <node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="0 0 0 0 0 0 odom chasis 100"/>

My hector-slam knowledge is a work-in-progress so I would appreciate some help in understanding what's wrong with my configuration. I'm happy to provide more code if it would help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-28 19:17:19 -0600

sisko gravatar image

In my hours and hours of researching this issue, I came across this and in the hector-mapping section, it has it's static-transform-publisher defined as follows:

<node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 base_link laser 100" />

This lead me to realise my static-transform-publisher is defined incorrectly. I changed mine to publish TF data between chasis -> hokuyo_scan instead of odom -> chasis, i:e :

<node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="0 0 0 0 0 0 chasis hokuyo_scan 100"/>

And that fixed my problem in regards to rviz. The robot model no longer "hops" in place like a low-rider and the teleoperation is nice and smooth. Although, I still get the "Transform failed during publishing of map_odom transform: . . ." errors in my terminal.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-03-28 11:54:36 -0600

Seen: 412 times

Last updated: Mar 28 '21