0
$\begingroup$

Rosanswers logo

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


Originally posted by velveteenrobot on ROS Answers with karma: 136 on 2015-02-27

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by tfoote with karma: 58457 on 2015-02-27

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by velveteenrobot on 2015-02-27:
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?

Comment by tfoote on 2015-02-27:
I think so, but I may be out of date.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.