I've read many answers about how ROS sourcing works and I'm a bit confused on a couple things:
Can you source an overlay before building it?
This answer says you can add the following to your .bashrc
:
source /opt/ros/indigo/setup.bash
source ~/catkin_ws/devel/setup.bash
However, the ROS2 tutorials say the following:
Before sourcing the overlay (your workspace), it is very important that you open a new terminal, separate from the one where you built the workspace. Sourcing an overlay in the same terminal where you built, or likewise building where an overlay is sourced, may create complex issues.
The first answer results in your overlay always being sourced every time you open a terminal. This contradicts the ROS2 tutorial that says you shouldn't source the overlay before building it.
Why do you need to source both /opt/ros/<distro>/setup.bash
and ~/catkin_ws/devel/setup.bash
?
I looked at the environment variables with printenv
when I sourced both of them vs. just the latter and they were the same. It seems like you only need to source ~/catkin_ws/devel/setup.bash
given that you have sourced /opt/ros/<distro>/setup.bash
before running catkin_make
.
Originally posted by EricW on ROS Answers with karma: 15 on 2021-02-06
Post score: 1