Problems with ubuntu18.04 configuring ROS2: "ROS_DISTRO was set to 'dashing' before"

After installing ROS2, open the terminal and select ROS1 or ROS2 and a prompt will appear:

ROS_DISTRO was set to 'dashing' before .
Please make sure that the environment does not mix paths from different distributions.

or

ROS_DISTRO was set to 'melodic' before .
Please make sure that the environment does not mix paths from different distributions.


It seems that no bug solution to ignore this problem has been found so far :

Modify environment variables to avoid conflicts between the two versions

sudo vim /opt/ros/melodic/share/ros_environment/catkin_env_hook/1.ros_distro.sh
# generated from ros_environment/env-hooks/1.ros_distro.sh.in
#if [ -n "$ROS_DISTRO" -a "$ROS_DISTRO" != "melodic" ]; then
#  echo "ROS_DISTRO was set to '$ROS_DISTRO' before. Please make sure that the environment does not mix paths from different distributions."
#fi
#export ROS_DISTRO=melodic

ROS2:

sudo vim /opt/ros/dashing/share/ros_environment/environment/1.ros_distro.sh
# generated from ros_environment/env-hooks/1.ros_distro.sh.in
#if [ -n "$ROS_DISTRO" -a "$ROS_DISTRO" != "dashing" ]; then
#  echo "ROS_DISTRO was set to '$ROS_DISTRO' before. Please make sure that the environment does not mix paths from different distributions."
#fi
#export ROS_DISTRO=dashing

Just annotate everything inside

Guess you like

Origin blog.csdn.net/Feizhai2/article/details/113871113