# Unstable map on conversion of Turtlebot2 from gmapping to hector_slam

I have the basic Turtlebot tutorials (http://learn.turtlebot.com) running successfully on my Turtlebot2, but now I'm trying to move from the default gmapping solution to hector_slam for mapping. The documentation at http://wiki.ros.org/hector_slam/Tutor... made it seem like the only thing that was needed to move from gmapping to hector_mapping was to make sure that the four parameters listed matched the values that they had in gmapping; this was a little bit of a challenge in my case because the gmapping configuration didn't have a map_frame parameter, but the default of "map" seems right. I switched my launch file to call the default launch file for hector_mapping rather than the one for gmapping, made sure that the other parameters were set as specified, and ran it.

The solution runs and appears to have the correct tf tree and connections, but as soon as I try to teleoperate the vehicle to build a map the estimate of the robot's position starts jumping all over the place. The problem seems to be with the calculation of the transform from map to odom and I'm assuming has something to do with an incomplete configuration on my part, but after searching through documentation and help forums I can't seem to figure out where this might have happened in the changes I made or how to set it right. For now, I'm including the two launch files in this post because I'm not sure whether anything else is relevant, but I can happily provide other files if needed. Can anyone point me in the direction of a solution?

Both of the launch files are run in the context of already running the bringup script of the turtlebot, which starts the mobile_base, diagnostic_aggregator, robot_state_publisher, and other nodes necessary for interacting with the kobuki base. This second script is responsible for running the camera control nodes, safety controller, move_base, and the mapping. I've confirmed that the list of active ROS nodes after running both scripts is the same excepting that the first runs slam_gmapping and the second runs hector_mapping. This is the gmapping version of the launch file:

<launch>
<!-- 3D sensor -->
<arg name="3d_sensor" default="$(env TURTLEBOT_3D_SENSOR)"/> <!-- r200, kinect, asus_xtion_pro --> <include file="$(find turtlebot_bringup)/launch/3dsensor.launch">
<arg name="rgb_processing" value="false" />
<arg name="depth_registration" value="false" />
<arg name="depth_processing" value="false" />

<!-- We must specify an absolute topic name because if not it will be prefixed by "$(arg camera)". Probably is a bug in the nodelet manager: https://github.com/ros/nodelet_core/issues/7 --> <arg name="scan_topic" value="/scan" /> </include> <!-- Gmapping --> <arg name="custom_gmapping_launch_file" default="$(find turtlebot_navigation)/launch/includes/gmapping/$(arg 3d_sensor)_gmapping.launch.xml"/> <include file="$(arg custom_gmapping_launch_file)"/>

<!-- Move base -->

</launch>


And this is the hector_mapping version of the launch file:

<launch>
< ...
edit retag close merge delete