0
$\begingroup$

Rosanswers logo

Hello, I would like to be able to open a terminal and type roslaunch .launch OR roslaunch .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.


Originally posted by Morefoam on ROS Answers with karma: 27 on 2016-07-08

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.