I had my VM paused from yesterday, turned PC on, resumed VM, opened one terminal, typed roscore, opened another one, typed rosrun package_name, hit tab key twice and the exe appeared.
Every time you open a new terminal, a new bash
session is started.
if you have your .bashrc
setup to do source ~/catkin_ws/devel/setup.bash
for you, then new terminals will cause your workspace to be source
d.
If you add a package, build your workspace, then don't source
it, the package will not be found.
If you now open a new terminal - as you say you did - that terminal will start a new bash
session, causing your workspace to be source
d. And as the new package has now been built, it will be added to the appropriate environment variables and can then be found - in the new terminals - by rosrun
and roslaunch
.
For already open terminals (really: bash
sessions), just source ~/catkin_ws/devel/setup.bash
yourself, and new packages should now be found.
Edit: some related questions:
- #q269784: setup.bash every time?
- #q229365: Do I really need to $ source ~/catkin_ws/devel/setup.bash ?
- #q200174: How to aviod running the command "source devel/setup.bash"
- #q188309: What does source command actually do?
Please edit your question to provide more information. There's not enough here to reproduce your problem. Please provide the full context of commands you're running with their outputs and any debugging commands you're trying as well.
Hi tfoote, There is not much I can add.
1. (terminal 1) catkin_make <- builds 100%
2. (terminal 2) roscore
3. (terminal 3) rosrun package_name <- double tab doesn't resolve path
Do you do a
source ~/catkin_ws/devel/setup.bash
after step 1? Your.bashrc
is only evaluated when you open a new terminal, there is no magic there that makesbash
update itself if/when you runcatkin_make
.Without the
source
step,rosrun
can't find your package.Hi gvdhoorn, so how come turtlesim works fine all the time?
Isn't this the magic trick:
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
that makesbash
update itself evertimecatkin
is run ?No. Again:
.bashrc
is only evaluated (ie: read) when you start a new instance ofbash
. That is typically only when you start a new terminal.See What is the purpose of .bashrc and how does it work? for some more info on that.
technical but: because the
turtlesim
packages were already present on theROS_PACKAGE_PATH
when you started yourbash
session.Either in your
catkin_ws
or in/opt/ros/$distro
.And just to clarify: this is a "Linux thing", not something specific to ROS.
If you can confirm that things work after you
source
thesetup.bash
after you built your workspace, I'll write an answer.