Created
April 21, 2022 07:57
-
-
Save NovoG93/e9c74c75dcde4e8dc94f58471144135e to your computer and use it in GitHub Desktop.
Switching between ROS1 and ROS2 in .bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
srROS1() | |
{ | |
unset ROS_VERSION ROS_PYTHON_VERSION ROS_DOMAIN_ID ROS_LOCALHOST_ONLY ROS_DISTRO | |
source /opt/ros/noetic/setup.bash | |
source /home/georg/catkin_ws/devel/setup.bash | |
source /home/georg/paper_ws/devel/setup.bash | |
touch /tmp/ros1.tmp | |
rm -f /tmp/ros2.tmp || true | |
} | |
srROS2() | |
{ | |
unset ROS_VERSION ROS_PYTHON_VERSION ROS_PACKAGE_PATH ROSLISP_PACKAGE_DIRECTORIES ROS_ETC_DIR ROS_MASTER_URI ROS_ROOT ROS_DISTRO | |
source /opt/ros/foxy/setup.bash | |
source /home/georg/ros2_ws/install/setup.bash | |
export ROS_DOMAIN_ID=0 # see: https://docs.ros.org/en/foxy/Concepts/About-Domain-ID.html | |
touch /tmp/ros2.tmp | |
rm -f /tmp/ros1.tmp || true | |
} | |
if [ -f /tmp/ros2.tmp ]; then | |
srROS2 | |
else | |
srROS1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment