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

Simple movement goal problem

asked 2012-10-10 14:49:24 -0500

highencast gravatar image

updated 2014-01-28 17:13:54 -0500

ngrennan gravatar image

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!

edit retag flag offensive close merge delete

Comments

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?

highencast gravatar image highencast  ( 2012-10-11 01:35:01 -0500 )edit

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.

Lorenz gravatar image Lorenz  ( 2012-10-11 01:37:14 -0500 )edit

Thanks for posting, I had good use of your code to make my own basic move_base thing with Python

korkor gravatar image korkor  ( 2015-05-08 05:29:56 -0500 )edit

I have a simple question, what does goal.target_pose.pose.orientation.w = 1.0 mean?

aarontan gravatar image aarontan  ( 2018-06-16 14:33:41 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2012-10-10 23:23:00 -0500

Lorenz gravatar image

The parameter you pass to SimpleActionClient is the name of the action, not the name of your node. Normally it's something like move_base. Make sure the navigation stack and move_base are running. Have a look at the turtlebot_navigation tutorials.

edit flag offensive delete link more

Comments

The link is blank for jade and kinetic.

Also http://wiki.ros.org/navigation#Tutorials is scewy- 'Setup the Navigation Stack for TurtleBot' is listed twice but goes to different pages links but similar looking content.

lucasw gravatar image lucasw  ( 2016-07-07 13:07:56 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2012-10-10 14:49:24 -0500

Seen: 5,278 times

Last updated: Oct 11 '12