Program getting stuck at line - "sac.wait_for_server()". Unable to send goals to turtlebot robo.

asked 2013-09-30 21:15:28 -0600

Brijendra Singh gravatar image

updated 2014-07-26 03:33:22 -0600

130s gravatar image

Hello All,

I have connected to turtlebot using a separate machine. Now using that separate machine, I am trying to pass goals to robo but while running code, program waits at line "sac.wait_for_server()" so goals are not able to publish to robo. But while I am using the machine and inside gazebo simulated environment(not connecting to external robo) then the code is working fine and all the goals are send, also Robo inside gazebo moving. But I am unable to figure out why the real robo is not working. Please help me in fixing the issue. also if any one of you have working python code to send goals to move turtlebot.. pls share.

Thanks for any help.

I am attaching the code here:::

#!/usr/bin/env python

import roslib; roslib.load_manifest('beginner_tutorials')
import rospy
import actionlib
from geometry_msgs.msg import *
from move_base_msgs.msg import *

def simple_move():

    #Simple Action Client
    sac = actionlib.SimpleActionClient('move_base', MoveBaseAction )

    #create goal
    goal = MoveBaseGoal()
    x = ['1.500'  , '0.000']
    location =  Pose(Point(float(x[0]),float(x[1]), 0.000), Quaternion(0.000, 0.000, 0.000, 0.777))
    goal.target_pose.pose = location

    #use self?
    #set goal
    #goal.target_pose.pose.position.x = 1.0
    #goal.target_pose.pose.orientation.w = 1.0
    goal.target_pose.header.frame_id = 'map'
    goal.target_pose.header.stamp =
    rospy.loginfo("Setted Pose")
    rospy.loginfo("wait for server")
    #start listner
    rospy.loginfo("send goal")
    #send goal
    rospy.loginfo("wait for result")
    rospy.loginfo("printing result"+str(sac.get_result()))
    #print result
    print sac.get_result()

  except Exception, inst:
    print "Error"+str(inst)

if __name__ == '__main__':

    except rospy.ROSInterruptException:
        print "Keyboard Interrupt"
edit retag flag offensive close merge delete


Bringup, mapping and move_base all are running on the turtlebot, right?

McMurdo gravatar image McMurdo  ( 2014-07-26 04:35:48 -0600 )edit

Does the server run in a namespace?

BennyRe gravatar image BennyRe  ( 2014-07-28 04:03:42 -0600 )edit

Can you see the server topics being published? type $ rostopic list -v and check that it appears something like move_base/goal, etc.. Since you are working through separate machine.. Did you do the export ROS_MASTER_URI?

maik_mico gravatar image maik_mico  ( 2016-01-11 13:22:34 -0600 )edit