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

Revision history [back]

This is usually handled by the setup.bashfiles included with the distribution, and built in each workspace. When you create a workspace that overlays a base install, the setup.bash built in that workspace will setup your environment such that ROS packages included in your workspace are found before any duplicate packages in the base install.

So to directly answer your question: if you want to use the version you cloned from Git, you'll want to source the setup.bash from your workspace that contains that package. If you want to use the version installed from apt, source the setup.bash from /opt/ros/DISTRO/. If you need to combine packages from a workspace with the base install and still be able to toggle between an apt and source version of a package, then I'd recommend workspace overlaying. You could have the source package overlay your normal workspace such that sourcing the overlay will find the source version of the target package, and sourcing the underlay will find the apt version.