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

Move_base goals in 'base_link' for Turtlebot

asked 2015-02-27 18:21:10 -0500

velveteenrobot gravatar image

We're trying to get the Turtlebot to drive to points relative to the /base_link frame. We looked at the Sending Simple Goals tutorial. We've successfully gotten the robot to move by running amcl_demo.launch and using goals (either move_base_simple or regular move_base goals with actionlib) in /map frame. However, when we try to set goals in /base_link, relative to the robot, nothing happens. Our code is:

#!/usr/bin/env python

import roslib
import rospy
import actionlib

from people_msgs.msg import PositionMeasurementArray
from geometry_msgs.msg import *
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal

def callback(data):
    # publish to whatever message the driving is going to take place
    pub = rospy.Publisher("move_base_simple/goal", PoseStamped, queue_size = 10)
    client = actionlib.SimpleActionClient("move_base", MoveBaseAction)
    #client.wait_for_server()

    if len(data.people) > 0:
        #person found
        rospy.loginfo("Found person, generate goal")
        target_goal_simple = PoseStamped()
        #target_goal = MoveBaseGoal()

        #forming a proper PoseStamped message
        target_goal_simple.pose.position = data.people[0].pos
        target_goal_simple.pose.position.z = 0
        target_goal_simple.pose.orientation.w = 1
        target_goal_simple.header.frame_id = 'base_link'
        target_goal_simple.header.stamp = rospy.Time.now()
        #target_goal.target_pose.pose.position = data.people[0].pos

        #sending goal
        rospy.loginfo("sending goal")
        pub.publish(target_goal_simple)
        #client.send_goal(target_goal)

def follower():
    rospy.init_node('human_follower')
    rospy.Subscriber('people_tracker_measurements',PositionMeasurementArray, callback)
    rospy.spin()

if __name__ == '__main__':
    try:
        follower()
    except rospy.ROSInterruptException:
        pass

I guess in general I'm wondering if there's a way to run navigation without a map and send goals relative to the robot? It seems to be possible, but I can't figure out how (what to launch? how to set my goals?). Any help would be appreciated! Thanks!

-Sarah

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-02-27 18:49:04 -0500

tfoote gravatar image

updated 2015-02-27 18:49:40 -0500

I believe that move_base actually explicitly rejects messages received in the base_link because it is not achievable to reach said goal. Since 2m forward will always be 2m forward. I didn't find the logic in a quick search but think you could find it if you looked.

To make it work relatively quickly you could simply query for the current robot pose in odom, and then add the offset you want to drive to in your script. This will allow move_base to persist the goal in the odom frame and be able to reach it.

edit flag offensive delete link more

Comments

Ah, it makes sense why /base_link wouldn't work. Although it is confusing that the Sending Simple Goals tutorial specifies goals in that frame.

So basically if we publish goals in the odom frame it might work?

velveteenrobot gravatar image velveteenrobot  ( 2015-02-27 18:55:39 -0500 )edit

I think so, but I may be out of date.

tfoote gravatar image tfoote  ( 2015-02-27 19:13:33 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2015-02-27 18:21:10 -0500

Seen: 2,009 times

Last updated: Feb 27 '15