ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The primary thing that happens when you source your catkin workspace's devel/setup.bash
file is that you are setting environment variables.
For example, you'll notice a difference in many environment variables before & after sourcing the setup file:
rosrun <pkg> <node>
actually works.(There are others, there are just the important ones).
As an example, this is my ROS_PACKAGE_PATH before and after sourcing the setup file in some random catkin workspace:
$ cd /path/to/my/catkin_ws
$ echo $ROS_PACKAGE_PATH
/opt/ros/indigo/share:/opt/ros/indigo/stacks
$ source devel/setup.bash
$ echo $ROS_PACKAGE_PATH
/path/to/my/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks
Note the addition of my catkin workspace's src/
directory to the ROS_PACKAGE_PATH. This enables me to run any nodes I have defined in my workspace, otherwise only the system-installed packages are available. (Side note: /opt/ros/<distro>/
basically acts as one big catkin workspace too.)
Normally, you always source the global /opt/ros/<distro>/setup.bash
every time you open a terminal because it's in your .bashrc
file. However, since new terminal sessions don't carry over environment variables, you need to source your workspace's setup file again each time you open a new session.
If you do not want to have to source the workspace setup file yourself each time you open a new terminal, you can always add it to your .bashrc
file:
echo "source /path/to/your/workspace/devel/setup.bash" >> ~/.bashrc
Obviously this only works if you have a single catkin workspace.
2 | No.2 Revision |
The primary thing that happens when you source your catkin workspace's devel/setup.bash
file is that you are setting environment variables.
For example, you'll notice a difference in many environment variables before & after sourcing the setup file:
rosrun <pkg> <node>
actually works.(There are others, there are just the important ones).
As an example, this is my ROS_PACKAGE_PATH before and after sourcing the setup file in some random catkin workspace:
$ cd /path/to/my/catkin_ws
$ echo $ROS_PACKAGE_PATH
/opt/ros/indigo/share:/opt/ros/indigo/stacks
$ source devel/setup.bash
$ echo $ROS_PACKAGE_PATH
/path/to/my/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks
Note the addition of my catkin workspace's src/
directory to the ROS_PACKAGE_PATH. This enables me to run any nodes I have defined in my workspace, otherwise only the system-installed packages are available. (Side note: /opt/ros/<distro>/
basically acts as one big catkin workspace too.)
Normally, you always source the global /opt/ros/<distro>/setup.bash
every time you open a terminal because it's in your .bashrc
file. However, since new terminal sessions don't carry over environment variables, you need to source your workspace's setup file again each time you open a new session.
If you do not want to have to source the workspace setup file yourself each time you open a new terminal, you can always add it to your .bashrc
file:
echo "source /path/to/your/workspace/devel/setup.bash" >> ~/.bashrc
Obviously this only works if you have a single catkin workspace.