Trouble installing ROS2 alongside ROS1
I have ROS Melodic on my Ubuntu 18.04, I installed ROS2 Eloquent and I get the following mistake//warning:
r4t@R4T:~$ source /opt/ros/eloquent/setup.bash
ROS_DISTRO was set to 'melodic' before. Please make sure that the environment does not mix paths from different distributions.
Then I do eng |grep ROS
as mentioned on another thread, and I get
ROS_ETC_DIR=/opt/ros/melodic/etc/ros
ROS_ROOT=/opt/ros/melodic/share/ros
ROS_MASTER_URI=http://localhost:11311
ROS_VERSION=2
ROS_LOCALHOST_ONLY=0
ROS_PYTHON_VERSION=3
ROS_PACKAGE_PATH=/opt/ros/melodic/share
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=eloquent
I don't know if the environment is configured correctly since everything it's kind of pointing out to Melodic version
Asked by blancoys on 2020-04-25 01:56:33 UTC
Answers
It's likely you have source /opt/ros/melodic/setup.bash
at the end of your .bashrc
(which is added at the end of the Environment Setup section of the ROS 1 installation instructions).
With just a single ROS version installed, that will be convenient (as it prevents you from having to type source /opt/ros/melodic/setup.bash
in every new terminal).
However, with multiple ROS versions installed (and this goes for both multiple ROS 1 and ROS 2 versions and a mix of those), it will cause issues such as the one you encountered.
I would recommend to remove the auto-source
-ing from your .bashrc
, and manually source
the setup file of the ROS version you want to work with instead.
Asked by gvdhoorn on 2020-04-25 04:46:53 UTC
Comments
I've removed the .bashrc autocompletion and it still keeps on telling me that the distro was set to eloquent, I've even deleted eloquent from my computer and the same keeps occurring.
Asked by blancoys on 2020-08-18 03:07:20 UTC
I've removed the .bashrc autocompletion [..]
Bash auto-completion is an integral part of the Ubuntu UX in the shell. I would not remove it.
If you've actually removed the source /opt/ros/melodic/setup.bash
line, that should have helped.
Asked by gvdhoorn on 2020-08-18 03:17:47 UTC
To make sourcing the right distro process easier for me, I've added
function sr1 {
source /opt/ros/melodic/setup.bash
}
function sr2 {
source /opt/ros/eloquent/local_setup.bash
}
to my .bashrc file. Now I just need to sr1
to source melodic, and sr2
to source eloquent.
Asked by ChuiV on 2021-06-21 09:08:26 UTC
Hi @ChuiV, how do you set the default call? Because, bashrc would be sourced every time I open a terminal right, so there needs to be a default option unless otherwise specified...
Asked by androadi on 2022-02-25 02:34:41 UTC
I don't actually set a "default" ros distro in my bashrc. I'm typically switching between them frequently that it makes sense for me to not source anything by default. When I need a terminal to use ros1, I just have to run sr1
or if I need ros2, I just need to do sr2
. My goal with those bash functions was to make it as easy as possible to source the ros version I need.
Asked by ChuiV on 2022-02-25 11:01:04 UTC
I had the same problem with Foxy and Neotic. To solve it;
- Remove Neotic and Foxy source from bash
- In Foxy worskspace install/setup.bash (line22) COLCON_CURRENT_PREFIX="/opt/ros/noetic" change noetic to foxy
- Delete and reinstall neotic
sudo apt-get remove ros-noetic-*
- Source the workspace correctly.
Asked by Ogunniran on 2021-03-10 08:04:03 UTC
Comments