navigation using hector_slam odometry and amcl not working

asked 2018-07-09 07:59:05 -0500

kesuke gravatar image

updated 2018-07-12 09:40:48 -0500

hi ,

i'm trying to get odometry from hector_slam by using hokuyo laser because the odometry that i'm getting from wheel encoder is not so good , so i configured the hector_slam and i'm getting a good odometry data , these odometry data are used by amcl to get localization but the problem is that when i'm trying to navigate i'm getting a wrong localization
here is an exemple of what i'm getting , what do you think it's causing troubles ?

image description

when the robot turn i'm getting this :

image description

and here is the launch file i used to get the navigation :

  <!--laser stuff-->
  <node name="hokuyo" pkg="hokuyo_node" type="hokuyo_node" >   
  <remap from="/scan" to="/scan" />
  <param name="scan" value="scan" />
  <param name="frame_id" value="base_laser"/>

  <arg name="odom_frame_id"   default="odom"/>
  <arg name="base_frame_id"   default="base_link"/>
  <arg name="global_frame_id" default="map"/>
  <arg name="odom_topic" default="odom" />
  <arg name="laser_topic" default="scan" />
  <!--getting odometry from hector_slam -->
  <include file="$(find hector_slam_launch)/launch/odom_hector.launch" > </include> 
  <!--tf  base_link  odom -->
  <node name="odomtransformer" pkg="tf_hector_odom" type="" output="screen">
  <param name="odom_input" value="odom" />
  <param name="tf_output" value="base_link"/>
  <!--map_saver load existing map -->
  <node name="map_server" pkg="map_server" type="map_server" args="$(find flo_navigation_rviz)/maps           /map_essai3.yaml" output="screen"/>
  <include file="$(find amcl)/examples/essai1.launch" > </include> 

  <!--navigation stuff-->
  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">   
  <rosparam file="$(find flo_navigation_rviz)/launch/costmap_common_params.yaml"   command="load"ns="global_costmap" />
 <rosparam file="$(find flo_navigation_rviz)/launch /costmap_common_params.yaml"command="load"ns="local_costmap"/>  <rosparam file="$(find flo_navigation_rviz)/launch/local_costmap_params.yaml" command="load"/>
  <rosparam file="$(find flo_navigation_rviz)/launch/global_costmap_params.yaml" command="load" />
  <rosparam file="$(find flo_navigation_rviz)/launch/dwa_local_planner_params.yaml" command="load" />
  <rosparam file="$(find flo_navigation_rviz)/launch/navfn_global_planner_params.yaml" command="load"/>
  <rosparam file="$(find flo_navigation_rviz)/launch/global_planner_params.yaml" command="load"/>

here is the launch file i used to get odometry from hector :

<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
<remap from="map" to="map_hector"/>
<remap from="scanmatch_odom" to="odom"/>
<param name="tf_map_scanmatch_transform_frame_name" value="odom" />   
<param name="pub_map_odom_transform" value="false"/>
<param name="pub_map_scanmatch_transform" value="false"/>
<param name="pub_odometry" value="true" />
<param name="base_frame" value="base_link"/>
<param name="odom_frame" value="odom"/>
<param name="output_timing" value="false"/>    
<param name="use_tf_scan_transformation" value="false"/>
<param name="use_tf_pose_start_estimate" value="false"/>
<param name="scan_topic" value="scan"/>

<!-- Map size / start point -->
<param name="map_resolution" value="0.025"/>
<param name="map_size" value="2048"/> 
<param name="map_start_x" value="0.5"/>
<param name="map_start_y" value="0.5" />

<!-- 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="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" />
<param name="tf_map_scanmatch_transform_frame_name" value="scanmatcher_frame" />

@pengjiawei here is the node that provide tf between odom and base_link :

#!/usr/bin/env python
import rospy, tf, tf2_ros, geometry_msgs.msg, nav_msgs.msg

def callback(data, args):
  bc = tf2_ros.TransformBroadcaster()
  t = geometry_msgs.msg.TransformStamped()

  t.header.stamp = rospy ...
edit retag flag offensive close merge delete


what is the package "tf_hector_odom"

pengjiawei gravatar image pengjiawei  ( 2018-07-10 20:44:30 -0500 )edit

it's a node that publish the tf between odom and base_link

kesuke gravatar image kesuke  ( 2018-07-11 02:12:22 -0500 )edit

There might be a problem.

pengjiawei gravatar image pengjiawei  ( 2018-07-11 02:15:14 -0500 )edit

@pengjiawei i edit my question can you have a look to the node that provide this tf

kesuke gravatar image kesuke  ( 2018-07-12 09:41:44 -0500 )edit

what does the odom publisher looks like?

pengjiawei gravatar image pengjiawei  ( 2018-07-12 20:05:33 -0500 )edit

@pengjiawei the odometry is published by hector_slam , it publises the odometry data bu using laser scan , you can have a look on the launch file

kesuke gravatar image kesuke  ( 2018-07-13 02:19:23 -0500 )edit

oh ,Ok.and then what does the "essai1.launch" looks like in amcl package?

pengjiawei gravatar image pengjiawei  ( 2018-07-13 02:26:37 -0500 )edit

@pengjiawei the amcl configuration

kesuke gravatar image kesuke  ( 2018-07-13 02:30:19 -0500 )edit