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

Revision history [back]

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.

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.