ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Do I have to source both ros2_galactic/install/setup.bash and /opt/ros/galactic/setup.bash?

asked 2021-08-01 05:28:28 -0600

ijnek gravatar image

TLDR:

Even with a source based install of ROS2, running rosdep will install libraries into /opt/ros/galactic/. To have all packages available in every terminal I open, do I have to source both ros2_galactic/install/setup.bash and /opt/ros/galactic/setup.bash?. If so, in which order?


Description:

I installed ros2_galactic from source following the instructions in the galactic tutorial. I was next trying to install Moveit, and was coming across a CMake error indicating that the eigen_stl_containers library was missing.

Could not find a package configuration file provided by
  "eigen_stl_containers" with any of the following names:

    eigen_stl_containersConfig.cmake
    eigen_stl_containers-config.cmake

Although the rosdep command in the previous step should have downloaded eigen_stl_containers, I ran sudo apt install ros-galactic-eigen-stl-containers, but the output stated that I had the library already installed.

ros-galactic-eigen-stl-containers is already the newest version (1.0.0-3focal.20210507.020504).
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

It turned out that the problem was I was only running source ~/ros2_galactic/install/setup.bash, but the eigen_stl_containers was installed through binaries so I had to also run source /opt/ros/galactic/setup.bash.

To have all packages available in every terminal I open, do I have to add both of those commands to ~/.bashrc, and if so, in which order?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-08-02 13:14:51 -0600

shonigmann gravatar image

Any packages you want to use will need to exist on paths on the various ROS environment variables (e.g. PATH, AMENT_PREFIX_PATH, etc). The order in which you source these should be determined by what you want to have priority.

Environment variable additions are prepended so if you had both source and binary installations of a given package, priority would be given to the one you sourced the most recently. In your case, you probably want to prioritize the source installation, so you would probably want to:

source /opt/ros/galactic/setup.bash
source ~/ros2_galactic/install/setup.bash

You can add these two lines to the end of your .bashrc if you don't want to manually source both paths every time you open a new terminal.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-08-01 05:28:28 -0600

Seen: 788 times

Last updated: Aug 02 '21