在多个ros环境中进行切换时,通过下面的设置.bashrc可以实现终端环境的切换
如果是ros2的foxy环境时输入foxy,如果是ros1的noetic环境时使用noetic:
alias foxy="unset ROS\_DISTRO && \
unset ROS\_ROOT && \
unset ROS\_PACKAGE\_PATH && \
unset ROS\_MASTER\_URI && \
unset ROS\_VERSION && \
unset ROS\_PYTHON\_VERSION && \
unset ROS\_ETC\_DIR && \
unset CMAKE\_PREFIX\_PATH && \
source /opt/ros/foxy/setup.bash"alias noetic="unset ROS\_DISTRO && \
unset ROS\_ROOT && \
unset ROS\_PACKAGE\_PATH && \
unset ROS\_MASTER\_URI && \
unset ROS\_VERSION && \
unset ROS\_PYTHON\_VERSION && \
unset ROS\_ETC\_DIR && \
unset CMAKE\_PREFIX\_PATH && \
source /opt/ros/noetic/setup.bash"alias galactic="unset ROS\_DISTRO && \
unset ROS\_ROOT && \
unset ROS\_PACKAGE\_PATH && \
unset ROS\_MASTER\_URI && \
unset ROS\_VERSION && \
unset ROS\_PYTHON\_VERSION && \
unset ROS\_ETC\_DIR && \
unset CMAKE\_PREFIX\_PATH && \
source /opt/ros/galactic/setup.bash"