Simple movement goal problem
Hi, when I try to run the following code to move the turtlebot 1 meter forward it becomes unresponsive (possibly when it is waiting for the server), and prints "None" if I do a keyboard interrupt:
#!/usr/bin/env python
import roslib; roslib.load_manifest('robot_red')
import rospy
import actionlib
#move_base_msgs
from move_base_msgs.msg import *
def simple_move():
rospy.init_node('simple_move')
#Simple Action Client
sac = actionlib.SimpleActionClient('move_base', MoveBaseAction )
#create goal
goal = MoveBaseGoal()
#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 = 'first_move'
goal.target_pose.header.stamp = rospy.Time.now()
#start listner
sac.wait_for_server()
#send goal
sac.send_goal(goal)
#finish
sac.wait_for_result()
#print result
print sac.get_result()
if __name__ == '__main__':
try:
simple_move()
except rospy.ROSInterruptException:
print "Keyboard Interrupt"
I think I may have to start a server seperately for the SimpleActionClient but am not sure what it would be. If anyone can describe what the problem might be I'll be eternally grateful. Thanks!
I changed the parameter for the SimpleActionClient, but it's still stuck at wait_for_server(). Is there an actual action server I need to start separately?
Yes, as I said in my answer, there is. The launch file is provided by the package turtlebot_navigation. Have a look at the tutorials.
Thanks for posting, I had good use of your code to make my own basic move_base thing with Python
I have a simple question, what does goal.target_pose.pose.orientation.w = 1.0 mean?