Ask Your Question
0

Getting 'rosgraph resource not found' when trying to get turtlebot local_plan?

asked 2016-09-09 17:05:12 -0500

piraka9011 gravatar image

Hi,

I'm trying to get the 'geometry_msgs/Poses' message from the '/move_base/DWAPlannerROS/local_plan' topic for the Kobuki Turtlebot. My current code is as follows: (This is an extremely minimal implementation where I am just accessing the value of the X position).

#!/usr/bin/env python
import rospy
from nav_msgs.msg import Path

def callback(data):
    global xPos
    xPos = data.Pose.position.X;

def getPlan():
    rospy.init_node('plangetter', anonymous=False);

    while not rospy.is_shutdown():
        rospy.Subscriber('/move_base/DWAPlannerROS/local_plan', Path, callback);
        rospy.sleep(1);
        print "X is: " + xPos;

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

My questions are:

1) Why am I getting a 'rospkg.common.ResourceNotFound: rosgraph' error when running this code? I have checked my ROS_PACKAGE_PATH and used rospack find rosgraph to confirm that ROS has access to the package. I have also made sure my PYTHONPATH is correct.

2) Am I correctly subscribing to the topic and getting the data? If not, what is the correct way?

Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-09-13 13:25:21 -0500

piraka9011 gravatar image

updated 2016-10-04 08:34:16 -0500

I was running the script from my IDE directly. To any one new with ROS: Do not do that...Instead build and run from the terminal using rosmake or catkin, then rosrun [package name] [script]

EDIT: For completeness, see this link that tells you how to setup your IDE for ROS.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2016-09-09 17:05:12 -0500

Seen: 985 times

Last updated: Oct 04 '16