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

[rospack] Error: package 'beginner_tutorials' not found

asked 2016-01-22 06:13:38 -0600

RosUser gravatar image

updated 2016-01-22 06:55:40 -0600

Hi I'm trying to learn the ROS tutorial --> Writing a Simple Publisher and Subscriber (C++) In terminal it can find: rosrun turtlesim turtlesim_node but not: rosrun beginner_tutorials talker It give the message: [rospack] Error: package 'beginner_tutorials' not found

I have tried to find a solution in this side but I'm not sure what should I set in .bashrc, this is what I have in my file:

source /opt/ros/indigo/setup.bash
export ROS_ROOT=/opt/ros
export PATH=$ROS_ROOT/bin:$PATH
export ROS_MASTER_URI=http://mypc:11311/
export PYTHONPATH=$PYTHONPATH:$ROS_ROOT/opt/ros/indigo/lib/python2.7/dist-packages/roslib
#export PYTHONPATH=$PYTHONPATH:$ROS_ROOT/core/roslib/src
export PATH=$PATH:/usr/local/smr/bin
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/smr/lib"
# vim editor
export EDITOR='nano -w'
#export EDITOR='emacs -nw'
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2016-01-22 07:03:19 -0600

updated 2016-01-22 09:24:38 -0600

In your .bashrc, you shouldn't need to be messing with the PATH, PYTHONPATH, or ROS_ROOT environment variables (at least as far as ROS is concerned). The setup.bash files should be managing your environment for you. To see this, comment out all of the ROS stuff in your bashrc and open a new terminal. The command env |grep ROS should show you that you have not environment variables with ROS in them. Now run source /opt/ros/indigo/setup.bash, and then re-run env |grep ROS. Now you should see a bunch of ROS variables set. Finally, try sourcing the setup.bash file in your workspace; something like source ~/catkin_ws/devel/setup.bash. If you re-run env |grep ROS, you'll see that this setup.bash file has modified the environment variables. Now the current terminal should be setup to use your workspace "overlayed" on the base ROS install. Further, if beginner_tutorials is in this workspace, rosrun should now be able to find it.

EDIT

It is completely up to you to decide how and when particular setup.bash scripts should be sourced. If you only have one workspace, and you want every terminal to be using this workspace then you could source this workspace's setup.bash script in your bashrc. In a different scenario, let's say you have many workspaces that are all used fairly often. The best option then might be to only source the /opt/ros/indigo/setup.bash in your bashrc (that way every terminal can use ROS command line tools), and select which workspace is active in each individual terminal by manually sourcing the correct workspace setup.bash file.

The setup.bash files are automatically created when you run catkin_make for the first time. The setup.bash file that gets created for a particular workspace will "overlay" that workspace on top of the current environment. Sourcing any workspace's setup.bash is sufficient to setup your environment in the same configuration that was defined with the workspace was initially built. All you need to do to switch workspaces is source the correct setup.bash

More about these concepts can be read in the Using a Workspace and Workspace Overlaying catkin tutorials.

edit flag offensive delete link more

Comments

I have changed my .bashrc file to: source /opt/ros/indigo/setup.bash export ROS_ROOT=/opt/ros/indigo/share/ros export PATH=$ROS_ROOT/bin:$PATH export ROS_MASTER_URI=http://mypc:11311/ export ROS_PACKAGE_PATH=/home/hjt/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks

RosUser gravatar image RosUser  ( 2016-01-22 09:01:27 -0600 )edit

Okay now it is working, by running each time: source ./devel/setup.bash in a new terminal. Can I avoid this or do I have to run: source ./devel/setup.bash every time I have new terminal ?

Ps. And I have already included: source /opt/ros/indigo/setup.bash in my .bashrc file !

RosUser gravatar image RosUser  ( 2016-01-22 09:08:23 -0600 )edit

I edited my answer to provide some more information about when and where to source the setup.bash files.

jarvisschultz gravatar image jarvisschultz  ( 2016-01-22 09:25:37 -0600 )edit

Thanks it is working

RosUser gravatar image RosUser  ( 2016-01-25 14:35:14 -0600 )edit

Question Tools

Stats

Asked: 2016-01-22 06:13:38 -0600

Seen: 16,631 times

Last updated: Jan 22 '16