ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Do I have to go into my catkin workspace and source devel/setup.bash every time before I can use my launch file?

asked 2016-07-08 16:34:50 -0600

Morefoam gravatar image

Hello, I would like to be able to open a terminal and type roslaunch <filename>.launch OR roslaunch <packagename> <filename>.launch and have it launch. Currently I have to cd into my catkin workspace and do "source devel/setup.bash" EVERY time I open a new terminal. How can I make it launch without having to do this every time? Thanks in advance for the help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-08 16:56:48 -0600

William gravatar image

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.

edit flag offensive delete link more


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. :)

Morefoam gravatar image Morefoam  ( 2016-07-08 17:36:15 -0600 )edit

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.

spmaniato gravatar image spmaniato  ( 2016-07-08 17:58:34 -0600 )edit

Your Answer

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

Add Answer

Question Tools



Asked: 2016-07-08 16:34:50 -0600

Seen: 1,736 times

Last updated: Jul 08 '16