Map distortion with Hector Slam

asked 2020-10-30 21:07:47 -0600

KennyxD gravatar image

updated 2020-10-30 21:08:51 -0600

Hi, I was wondering if anyone can help me with my map distorting when my car robot rotates (spins in place). Here is a link to a recorded video of my issue:

My car robot (raspberry pi) is running ROS Kinetic and I have a VMware that is running ROS Noetic.

I have looked at both the Hector Slam and Navigation Stack tutorials (links below) on how to set up my arguments/parameters of the base_link and odom frames and as well as the arguments/parameters of the tf for the base_link to laser on the hector_mapping.launch file depending on how I built my car robot.

Hector Slam:

Navigation Stack:

Unfortunately, I am new here in ROS so I don't have enough points to post a picture, but if you take a look at the Navigation Stack link there is an example picture of a car robot. My car robot is set up just the same except the offset of the base_laser from the base_link is x: ~8cm and z: ~8cm.

The changes that I made to my hector_mapping.launch file are three lines:

<arg name="base_frame" default="base_link"/>"
<arg name="odom_frame" default="base_link"/>

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

The first to lines were change by following these github instructions: While the last line was changed following the Navigation Stack to set up the laser's offset.

In case you guys need it, the full launch file is shown below:

  <arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>

  <!--  <arg name="base_frame" default="base_footprint"/> MODIFIED BY KM -->
  <arg name="base_frame" default="base_link"/>

  <!--  <arg name="odom_frame" default="nav"/> MODIFIED BY KM -->
  <!-- This car robot does not have an odometry. So we set it to the base link -->
  <arg name="odom_frame" default="base_link"/>

  <arg name="pub_map_odom_transform" default="true"/>
  <arg name="scan_subscriber_queue_size" default="5"/>
  <arg name="scan_topic" default="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" /> ...
edit retag flag offensive close merge delete