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

Revision history [back]

First of all, you must think that odom topic doesn't provide you the robot pose, just a dead-reckoning estimation of the robot motion since startup. The robot pose (not the real one, but the one robot "thinks" he is) is obtained by correcting the odom pose with a localization system, as amcl. See the bottom of amcl wiki for a better explanation.

So better you use the initial robot pose as provided by map -> base_footprint tf, e.g:

    try:
        now = rospy.Time.now()
        listener.waitForTransform('map', 'base_footprint', now, rospy.Duration(10.0))
        (bf_trans, bf_rot) = listener.lookupTransform('map', 'base_footprint', now)
    except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException) as e:
        rospy.logerr(e)

and send it to move_base instead of the odom first message.

That said, we need more information to guess what is your problem. What error messages provides move_base? Are you using amcl for localizaiton, and if so, what is the initial pose? If not 0, 0, 0, this is a probable cause of your problem, because you are telling the robot to go back to the origin of the map, not to its initial position.