You can source your setup file from within any directory, i.e. you do not have to change to your workspace's directory to do this.
You can add the source /path/to/workspace/devel/setup.bash
to your ~/.bashrc
file. Though it could be confusing if in the future you forgot you did this, and your shell unexpectedly has that workspace sourced. If you add the line to your ~/.bashrc
so that it is done every time you open a shell, then you might also consider printing a message to remind yourself that this is happening.
Also, I actually prefer setting aliases rather than automatically sourcing workspaces when I open a new terminal, because I work with many workspaces at once typically. If you don't then perhaps you'd prefer just adding it directly to your ~/.bashrc
.
Originally posted by William with karma: 17335 on 2016-07-08
This answer was ACCEPTED on the original site
Post score: 4
Original comments
Comment by Morefoam on 2016-07-08:
Thanks for the help! How do you go about setting up aliases? I'm pretty new to ROS/Ubuntu, so not sure if I'll be working on multiple workspaces at once any time soon, but it would be nice to know for the future. :)
Comment by spmaniato on 2016-07-08:
Here's an example @Morefoam: alias ros="source /opt/ros/indigo/setup.bash"
(you place that in your ~/.bashrc
file) Similarly for your catkin workspaces, like William mentioned. Make sure you call them in the right order.